Bug #80686 [Com]: PHP reflection bug, PHP doesn't see the PHPDoc for the 2nd property.

From: Date: Fri, 29 Jan 2021 20:12:45 +0000
Subject: Bug #80686 [Com]: PHP reflection bug, PHP doesn't see the PHPDoc for the 2nd property.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-231834@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80686&edit=1 ID: 80686 Comment by: darrens at gmail dot com Reported by: darrens at gmail dot com Summary: PHP reflection bug, PHP doesn't see the PHPDoc for the 2nd property. Status: Not a bug Type: Bug Package: Class/Object related Operating System: Ubuntu 20.04.2 PHP Version: 7.4.14 Block user comment: N Private report: N New Comment: Thank you for your quick response. I missed that in the documentation. Previous Comments: ------------------------------------------------------------------------ [2021-01-29 19:50:39] requinix@php.net Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php https://www.php.net/manual/en/reflectionproperty.getdoccomment.php > If multiple property declarations are preceeded by a single doc comment, the doc > comment refers to the first property only. ------------------------------------------------------------------------ [2021-01-29 16:21:45] darrens at gmail dot com Description: ------------ Specific PHP Version is 7.4.3 (Default PHP version installed with Ubuntu). PHP reflection bug, PHP doesn't see the PHPDoc for the 2nd property. I encountered this bug while using PHPStan: https://github.com/phpstan/phpstan/issues/4454 and package maintainer referenced a second related instance: https://github.com/phpstan/phpstan/issues/4445 Test script: --------------- https://3v4l.org/oL3Ke <?php declare(strict_types = 1); class Client { /** * Pass Login variable * * @var array<string, string|null> */ private array $_login, $_created_ip; } $ref = new \ReflectionClass(Client::class); foreach ($ref->getProperties() as $prop) { var_dump($prop->getDocComment()); } Expected result: ---------------- string(84) "/** * Pass Login variable * * @var array<string, string|null> */" Actual result: -------------- string(84) "/** * Pass Login variable * * @var array<string, string|null> */" bool(false) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=80686&edit=1

« previous php.bugs (#231834) next »