A tool to add and complete PHP source code documentation [closed]

I think PHP_Codesniffer can indicate when there is no docblock — see the examples of reports on this page (quoting one of those) : ——————————————————————————– FOUND 5 ERROR(S) AND 1 WARNING(S) AFFECTING 5 LINE(S) ——————————————————————————– 2 | ERROR | Missing file doc comment 20 | ERROR | PHP keywords must be lowercase; expected “false” but … Read more

Best way to document Array options in PHPDoc?

This is how I do it instead: /** * Class constructor. * * @param array $params Array containing the necessary params. * $params = [ * ‘hostname’ => (string) DB hostname. Required. * ‘databaseName’ => (string) DB name. Required. * ‘username’ => (string) DB username. Required. * ‘password’ => (string) DB password. Required. * ‘port’ … Read more

Variable type hinting in Netbeans (PHP)

A single line is all you need: /* @var $varName Type_Name */ See this article in the NetBeans PHP Blog: https://blogs.oracle.com/netbeansphp/entry/defining_a_variable_type_in Note: At least, in version 8.2; The key seems to be: The single asterisk (/* instead of /**). Placing the type after the variable name. Having nothing before and after the type-hinting (except white-space, … Read more

PHPDoc type hinting for array of objects?

In the PhpStorm IDE from JetBrains, you can use /** @var SomeObj[] */, e.g.: /** * @return SomeObj[] */ function getSomeObjects() {…} The phpdoc documentation recommends this method: specified containing a single type, the Type definition informs the reader of the type of each array element. Only one Type is then expected as element for … Read more