Feature Request
Given the following code:
class A
{
public const A1 = 'A1 Value';
protected const A2 = 'A2 Value';
private const A3 = 'A3 Value';
}
in PHP 8.0+, we can code:
$reflectionClass = new ReflectionClass('A');
+var_dump($reflectionClass->getConstants(ReflectionClassConstant::IS_PUBLIC));
It stil no downgrade rule to downgrade it to be like this in PHP 7.x:
$reflectionClass = new ReflectionClass('A');
+$reflectionClassConstants = $reflectionClass->getReflectionConstants();
+$result = [];
+array_walk($reflectionClassConstants, function ($value) use (&$result) {
+ if ($value->isPublic()) {
+ $result[$value->getName()] = $value->getValue();
+ }
+});
+var_dump($result);
Ref #6864 which currently manually fixed by downgrade to php 7.x compatible syntax at rectorphp/rector-src#1474