[php-src] PR #17781: Reflection: show the type of object constants used as default properties
| From: | DanielEScherzer | Date: | Thu, 13 Feb 2025 02:51:27 +0000 |
| Subject: | [php-src] PR #17781: Reflection: show the type of object constants used as default properties | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-30745@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/17781
Author: DanielEScherzer
When a property default is based on a global constant, show the type of the default. Previously,
format_default_value() assumed that non-scalar and non-array defaults were always going
to be IS_CONSTANT_AST pointers, and when the AST expression had been evaluated and
produced an object, depending on when the ReflectionClass or
ReflectionProperty instance had been created, the default was shown as one of
callable or __CLASS__.
Instead, if the default value is an object (IS_OBJECT), show the type of that object.
Add test cases for both of the callable and __CLASS__ cases to confirm
that they now properly show the type of the constant.
Closes GH-15902