
get_class_to_class_keyword
¶Replace get_class
calls on object variables with class keyword syntax.
--- Original
+++ New
<?php
-get_class($a);
+$a::class;
--- Original
+++ New
<?php
$date = new \DateTimeImmutable();
-$class = get_class($date);
+$class = $date::class;
The rule is part of the following rule sets:
Using the @PHP80Migration:risky rule set will enable the get_class_to_class_keyword
rule.
Using the @Symfony:risky rule set will enable the get_class_to_class_keyword
rule.