Add override attribute to overridden methods
class ParentClass
{
public function foo()
{
echo 'default';
}
}
final class ChildClass extends ParentClass
{
+ #[\Override]
public function foo()
{
echo 'override default';
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\Php83\Rector\ClassMethod\AddOverrideAttributeToOverriddenMethodsRector;
return RectorConfig::configure()
->withRules([
AddOverrideAttributeToOverriddenMethodsRector::class,
]);