phpdoc

PHP docBlock @return className

一曲冷凌霜 提交于 2019-12-10 13:09:25
问题 How do I create a PHP DocBlock stating an @return which states the return of a class. This is at the moment fairly simple by doing /** * This returns an object of the "User" class * @return User */ public function getUser() { return $this->user; } I use this to get intellisense through my IDE for these return values. (in my case Netbeans) However I have a class that returns a class based on a variable name. (for example:) /** * This returns an object of the $param * @param String $className *

phpDocumentor page-level docBlock in html included file

早过忘川 提交于 2019-12-10 11:29:40
问题 I'm using the tool from phpdoc.org and i'm stuck when I have a PHP file such as header.inc.php with only HTML inside. <?php /** * Header content * * @author My name * * @since 1.0.0 */ ?> <!DOCTYPE html> <html lang="fr" class="no-js"> <head> ... I get an error in my phpdoc "No page-level DocBlock was found in file...". I googled it but I didnt find any user with my case. How to fix that error? Any tips are welcome. Thank's! Regards 回答1: I just ran across this posting and though it's older, I

Documenting Get/Post Parameters with Doxygen or PHPDoc [closed]

穿精又带淫゛_ 提交于 2019-12-10 02:25:02
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed last year . I was looking through the documentation for PHPDoc and could not find a good way to document the Post variables I was sending to various methods. So, I started to look into Doxygen with the hopes that it would provide me with a better way to document all of these variables. My code

What is the correct way to document PHP constants (define) with phpDocumentor

拟墨画扇 提交于 2019-12-10 01:07:20
问题 How must we document (with phpDocumentor) constants defined with define() in PHP? I found nothing in the docs, but found the following example (which I don't see it's use) in the sample2.php: /**#@+ * Constants */ /** * first constant */ define('testing', 6); /** * second constant */ define('anotherconstant', strlen('hello')); Anyone can tell me what's the best way to document constants in PHP with phpDocumentor? 回答1: Define statements are in general only commented with a descriptive text, so

How to use PHPdoc in Eclipse

巧了我就是萌 提交于 2019-12-09 19:07:04
问题 We are currently in the beginning of a new project, and would like to (for once) comment as much as possible from the start to help future development. I have tried to find out what best practices are of using phpDoc in Eclipse, but with pretty slim results. Can you share your best practices and tricks of using phpDoc to comment stuff in Eclipse? 回答1: There is no "real standard" about what should be commented and how, but some tags are used by pretty much anyone who comments his code. For

PHP Doc generic type declaration

最后都变了- 提交于 2019-12-09 15:52:00
问题 I'm working on a library which uses the phpDocumentor specification on determining the type system using reflection. However, I couldn't find any information about generic type declarations. Is there any way a generic type declaration should be specified? For example: is there any specification (in-progress) which specifies anything like: /** * @template <T extends Base> */ class Collection { /** * @return Iterator<T> */ function get_iterator(); } Note that the code above is just an example

Anything better than PHPDoc out there? [closed]

邮差的信 提交于 2019-12-08 21:08:23
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . Does anybody use anything else to document their PHP code than PHPDoc? Are there any tools that read the same documentation syntax but give richer output? 回答1: I´ll go for doxygen too. Here are several reasons : compatible with phpdoc tags and other popular ones : it´s interoperable works with various

PHPStorm and magic methods

巧了我就是萌 提交于 2019-12-08 21:04:30
问题 I am using PHPStorm and have written a class that utilises the SimpleXML class. Everything is fine, except when I traverse an XML string I will get "Undefined Property" warnings. $xml = simplexml_load_string($string); //Returns SimpleXML Element echo $xml->childElement; //PHPStorm reports "Undefined Property I believe this is because the magic properties are not properly defined in PHPStorm. Is anyone aware of a nice little work around? It annoys me because I am pedantic about having nice

How to document an accessor/mutator method in phpDoc/javaDoc?

 ̄綄美尐妖づ 提交于 2019-12-08 12:17:58
问题 Given a function which behaves as either a mutator or accessor depending on the arguments passed to it, like this: // in PHP, you can pass any number of arguments to a function... function cache($cacheName) { $arguments = func_get_args(); if (count($arguments) >= 2) { // two arguments passed. MUTATOR. $value = $arguments[1]; // use the second as the value $this->cache[$cacheName] = $value; // *change* the stored value } else { // 1 argument passed, ACCESSOR return $this->cache[$cacheName]; //

phpDoc and Code Completion via '->' T_OBJECT_OPERATOR in NetBeans 8.0

心已入冬 提交于 2019-12-08 10:24:43
问题 How can code completion occur with phpDoc blocks loaded using the T_OBJECT_OPERATOR without having to preset the variables as is shown is the source below? The only class that matters is the parentExample as it set's the needed $cc that does offer a working solution but it is not desired to preset variables in this manner. The example code shows the undesired solution and multiple non-working attempts. As code completion is based on previously set information, preferred to use the full