[php-src] Issue #14738: Make ::class keyword returns ReflectionClass object and add ReflectionClass->__toString() for backward compatibility
| From: | coderapers | Date: | Sun, 30 Jun 2024 21:53:09 +0000 |
| Subject: | [php-src] Issue #14738: Make ::class keyword returns ReflectionClass object and add ReflectionClass->__toString() for backward compatibility | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-247192@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/14738
Author: coderapers
Make ::class keyword returns ReflectionClass object and add ReflectionClass->__toString() for
backward compatibility.
It's needed for show us that functions, whoose really get class name as argument.
Example:
```php
function wrongFunctionDescriptor(string $className) { /* ... */ }
```
and it will be correct as
```php
function correctFunctionDescriptor(\ReflectionClass $className) { /* ... */ }
```
Because I can send to function wrongFunctionDescriptor() any string, like "FOO-BAR BUZ!"
and it will not correctly class name. When function correctFunctionDescriptor() got ONLY class
names, returned by ReflectionClass->__toString() as full class name.