--Jennifer
--
Jennifer Hodgdon * Poplar ProductivityWare
www.poplarware.com
Drupal web sites and custom Drupal modules
--
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+unsubscribe@googlegroups.com.
To post to this group, send email to php...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/53BECAA2.9030605%40poplarware.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+unsubscribe@googlegroups.com.
To post to this group, send email to php...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/53BF03F3.8040402%40gmail.com.
On 07/10/2014 06:34 PM, Hari K T wrote:
> This is an interesting topic. I have seen the doc comments being passed and
> create docs in lithium.
.... [example] ....
>
> https://github.com/UnionOfRAD/li3_docs#markdown-syntax
This clearly illustrates my point -- they use
{{{ code here }}}
for embedded code samples. The "one true" Markdown uses:
````
(code here)
````
I'm not too particular on the syntax for wrapper characters, but I believe what Hari meant to point to was how we handle code embedding, for example: https://github.com/UnionOfRAD/lithium/blob/master/net/http/Media.php#L17-L32Which renders out as: http://li3.me/docs/lithium/net/http/Media
I don't love the syntax we used, but it worked for us. The important part, as far as I'm concerned, is being able to embed actual runnable code examples that can be validated in an automated way.
Clarification #1: Drupal even uses @code [...] @endcode as an Inline PHPDoc construct (within e.g. @param), in order to explain common usage or parameter values. Random example:
/**
* @param $settings_items
* An array of settings arrays, as returned by:
* @code
* $js = _drupal_add_js();
* $settings_items = $js['settings']['data'];
* @endcode
*/
Clarification #3: Most code using these kind of @code tags is legacy ~PHP4 code. The use-case is almost non-existent in modern, decoupled PHP5 code. However, PSR-5 does not make such a differentiation.
I fully agree that Markdown offers much more powerful ways to achieve the same. IMO, we should formally adopt backticks (`) for inline code, and fenced code blocks (```) for multi-line code blocks in PHPDoc. The latter optionally allowing for language specifiers (```yaml), which MAY be optionally supported by your PHPDoc generator of choice; otherwise simply rendered as PRE-formatted text.
/**
* @param $settings_items
* An array of settings arrays, as returned by:
* ```
* $js = _drupal_add_js();
* $settings_items = $js['settings']['data'];
* ```
*/
The PSR-5 spec does actively mention, encourage, and support Markdown in various ways already (primarily in descriptions for strong, emphasized, and list formatting), so advancing to inline + GFM-style fenced/multi-line code snippets sounds more than natural to me.
For completeness, the backtick operator is PHP core's internal alias for shell_exec(), so any usage of this character involves a security risk that is worth to mention. — However, you'd have to trip up your PHPDoc in serious + very unfortunate ways to produce something that doesn't produce a PHP Fatal Error to begin with, and even in the worst of all cases, the contained PHP code is hardly understood by any shell. Due to that, it should be safe to adopt the backtick character.
--
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+u...@googlegroups.com.
To post to this group, send email to php...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/296d23bc-835b-4346-97c8-1dd62dbfacb1%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/969f2b8c-270a-4072-a246-3186134fb59d%40googlegroups.com.