phpdoc

Variable type hinting in Netbeans (PHP)

≯℡__Kan透↙ 提交于 2019-12-17 07:01:40
问题 Just curious if there's a way in netbeans to give type hints for regular variables, so that intellisense picks it up. I know you can do it for class properties, function parameters, return types, etc. but I can't figure out how to do it for regular variables. It's something that would really help in situations where you have a method that can return different object types (like a service locator). ex something like: /** * @var Some_Service $someService */ $someService = ServiceLocator::locate

Is it possible for PhpStorm to infer the return type of this method?

不问归期 提交于 2019-12-13 19:46:20
问题 I imagine I might need to add a special annotation somewhere, but I'm crossing my fingers that PhpStorm is smart enough to resolve return types given awkward inheritance patterns. For example, I have some code that resembles this: <?php class Collection extends \ArrayObject { public function __construct(array $items) { foreach ($items as $key => $value) { if (isset(static::$requiredType) && !$item instanceof static::$requiredType) $this->offsetSet($key, $value); } } public function getFirst()

How to display full docblocks for inherited methods in PhpDocumentor?

只愿长相守 提交于 2019-12-13 06:21:21
问题 I currently have code where there is an abstract parent class that defines some concrete methods, and the children classes extend this parent class, and will use the concrete methods. For example: <?php abstract class abstract_class { /** * I document foo. */ public function foo() { echo "I am the foo function!"; } } class child_class { /** * I document bar. */ public function bar() { echo "I am the bar function!"; } } ?> In my documentation for child_class, I see my bar() function well

phpDoc @var for compound statement isn't displayed correctly

匆匆过客 提交于 2019-12-13 05:14:54
问题 I have a compound statement in one of my classes and as far as I know I'm following the phpDoc docs here. This is just the relevant part of the file. The file itself and the class do have docblocks. class contact { /** * @var PDO $pdo The PDO class for database communication * @var int $id The id of the contact * @var int $clientId The id of the client the contact is linked to * @var string $name The name of the contact * @var string $address The first address line (normally street and house

PHPDoc: Is is possible to reference the object property descriptions from factory method docblock?

被刻印的时光 ゝ 提交于 2019-12-13 01:50:27
问题 If I use a factory method to instantiate objects then is it possible to reference the docblock descriptions of the class properties for the objects being instantiated? I find myself looking into the classes to remind me what parameters to give the factory method. It would be handy if I could just reference all the relevant docblock descriptions from all the objects that the factory outputs, then my IDE would prompt me when I call the factory method. 回答1: For the scenario you describe, the

PHPDoc - Function exits

喜欢而已 提交于 2019-12-12 09:56:10
问题 Is there a way to document that a particular function calls exit() ? The use case is that we have a function that is responsible for handling redirects (checks for already sent headers, set the response code, etc...) and then crucially calls exit() . Unfortunately, PHPStorm has no idea that this particular function terminates execution and thus suggests further warnings as if this function has returned when in practice, it never would. 回答1: At the moment it's not possible. https://youtrack

phpdoc variable of class ArrayObject

你。 提交于 2019-12-12 05:16:40
问题 I have a class that extends ArrayObject class Collection extends ArrayObject I know i can define array of objects using this code: /* @var $userArray Model_User[] */ But how can i define variable $userArray as an custom array of class Collection that contains objects of class Model_User ? Without changing class Collection or its phpdoc. I want to use the same class Collection for different arrays of objects. This is not the same as PHPDoc type hinting for array of objects?, because in that

Is there a correct way to signal an annotation parser to ignore an annotation inside of a docblock?

独自空忆成欢 提交于 2019-12-11 04:55:25
问题 Say I have a docblock comment that is parsed by, for example's sake, phpDocumentor and any annotation parser (let's say Doctrine common). <?php /** * @author Blah <blah@example.com> * Class to handle the generation of lorem ipsum text for our templates * To declare as a service in the DIC, __uncomment__ the following annotation * @DIC\Service("textgenerator.loremipsum") */ class LipsumGenerator implements TextGeneratorInterface { } Now, I don't want the @DIC\Service annotation to get parsed

use phpDocumentor on symfony2

点点圈 提交于 2019-12-11 01:29:39
问题 I installed a new symfony 2.4 project and I installed also phpDocumentor using composer.phar folowing these steps: 1- Adding: "require-dev": { "phpdocumentor/phpdocumentor": "2.*" } to My composer.json 2- Executing : php composer.phar update After installation terminated I can see phpdocumentor Folder in /vendor so I guess installation is terminated with success. Now I want to know how to use phpDocumentor on symfony (generate a documentation for my code source). I work on Ubuntu web server.

How to parse a phpDoc style comment block with PHP?

别来无恙 提交于 2019-12-10 16:00:04
问题 Please consider the following code with which I'm trying to parse only the first phpDoc style comment (not using any other libraries) in a file (file contents put in $data variable for testing purposes): $data = " /** * @file A lot of info about this file * Could even continue on the next line * @author me@example.com * @version 2010-05-01 * @todo do stuff... */ /** * Comment bij functie bar() * @param Array met dingen */ function bar($baz) { echo $baz; } "; $data = trim(preg_replace('/\r?\n