Doc #76060 [NEW]: getDocComment() can return false

From: Date: Tue, 06 Mar 2018 12:05:59 +0000
Subject: Doc #76060 [NEW]: getDocComment() can return false
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-15495@lists.php.net to get a copy of this message
From: benjamin dot morel at gmail dot com Operating system: N/A PHP version: Irrelevant Package: Reflection related Bug Type: Documentation Problem Bug description:getDocComment() can return false 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 bug report at https://bugs.php.net/bug.php?id=76060&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76060&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76060&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76060&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=76060&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=76060&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=76060&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=76060&r=needscript Try newer version: https://bugs.php.net/fix.php?id=76060&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=76060&r=support Expected behavior: https://bugs.php.net/fix.php?id=76060&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=76060&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=76060&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=76060&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76060&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=76060&r=dst IIS Stability: https://bugs.php.net/fix.php?id=76060&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=76060&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=76060&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=76060&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=76060&r=mysqlcfg

« previous php.doc.bugs (#15495) next »