DowngradeReflectionClassGetConstantsFilterRector
Downgrade ReflectionClass->getConstants(ReflectionClassConstant::IS_*)
$reflectionClass = new ReflectionClass('SomeClass');
-$constants = $reflectionClass->getConstants(ReflectionClassConstant::IS_PUBLIC));
+$reflectionClassConstants = $reflectionClass->getReflectionConstants();
+$result = [];
+array_walk($reflectionClassConstants, function ($value) use (&$result) {
+ if ($value->isPublic()) {
+ $result[$value->getName()] = $value->getValue();
+ }
+});
+$constants = $result;
Configure your rector.php:
<?php
use Rector\Config\RectorConfig;
use Rector\DowngradePhp80\Rector\MethodCall\DowngradeReflectionClassGetConstantsFilterRector;
return RectorConfig::configure()
->withRules([
DowngradeReflectionClassGetConstantsFilterRector::class,
]);