Doc #76060 [Opn->Sus]: getDocComment() can return false
| From: | requinix@php.net | Date: | Tue, 06 Mar 2018 12:16:55 +0000 |
| Subject: | Doc #76060 [Opn->Sus]: getDocComment() can return false | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-15496@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=76060&edit=1
ID: 76060
Updated by: requinix@php.net
Reported by: benjamin dot morel at gmail dot com
Summary: getDocComment() can return false
-Status: Open
+Status: Suspended
Type: Documentation Problem
Package: Reflection related
Operating System: N/A
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
The prototype says string. The docs say it can return false.
Many functions are like this. Talk to the phpdoc mailing list to see what they think about it.
Previous Comments:
------------------------------------------------------------------------
[2018-03-06 12:05:58] benjamin dot morel at gmail dot com
Description:
------------
The manual pages for getDocComment() methods state that they return string:
http://php.net/manual/en/reflectionclass.getdoccomment.php
http://php.net/manual/en/reflectionclassconstant.getdoccomment.php
http://php.net/manual/en/reflectionfunctionabstract.getdoccomment.php
http://php.net/manual/en/reflectionproperty.getdoccomment.php
However, they can all return false when there is no doc comment:
<?php
class Foo {
public const BAR = '';
public $bar;
public function bar() {}
}
var_export((new ReflectionClass('Foo'))->getDocComment()); // false
var_export((new ReflectionClassConstant('Foo', 'BAR'))->getDocComment()); //
false
var_export((new ReflectionMethod('Foo', 'bar'))->getDocComment()); //
false
var_export((new ReflectionProperty('Foo', 'bar'))->getDocComment()); //
false
Expected result:
----------------
public string|bool ReflectionClass::getDocComment ( void )
public string|bool ReflectionClassConstant::getDocComment ( void )
public string|bool ReflectionFunctionAbstract::getDocComment ( void )
public string|bool ReflectionProperty::getDocComment ( void )
Actual result:
--------------
public string ReflectionClass::getDocComment ( void )
public string ReflectionClassConstant::getDocComment ( void )
public string ReflectionFunctionAbstract::getDocComment ( void )
public string ReflectionProperty::getDocComment ( void )
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=76060&edit=1