Skip to content

Conversation

samsonasik
Copy link
Member

It happen when ->withTreatClassesAsFinal(); is used, which non-final class can have abstract method to be implemented by child.


namespace Rector\Tests\DeadCode\Rector\ClassMethod\RemoveUnusedPublicMethodParameterRector\FixtureTreatClassesAsFinal;

abstract class SkipAbstractMethod
Copy link
Member Author

@samsonasik samsonasik Jun 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TomasVotruba abstract method only exists in abstract class, this means in other rules, the check $class->isAbstract() is needed as well, since abstract never be "final".

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will create separate PR for add is abstract check on "treat final class" since abstract never be "final"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created separate PR for always verify class is abstract before FeatureFlags::treatClassesAsFinal() check at PR:

Comment on lines -20 to -23
public static function reset(): void
{
SimpleParameterProvider::setParameter(Option::TREAT_CLASSES_AS_FINAL, false);
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just moved this reset functionality to AbstractRectorTestCase::tearDownAfterClass

@samsonasik
Copy link
Member Author

All checks have passed 🎉 @TomasVotruba I am merging it ;)

@samsonasik samsonasik merged commit 7191f4f into main Jun 19, 2025
45 checks passed
@samsonasik samsonasik deleted the skip-abstract branch June 19, 2025 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant