nette / php-generator

🐘 Generates neat PHP code for you. Supports new PHP 8.3 features.
https://doc.nette.org/php-generator
Other
2.11k stars 138 forks source link

Prevent classes and methods from declared both final and abstract #36

Closed pierredup closed 6 years ago

pierredup commented 6 years ago

Classes and methods cannot be declared final and abstract. This will now throw an exception if you try to generate a final abstract class or method. It's a BC break because of the new exception, but the generated code would never have been valid, so I doubt there is any use that will break

dg commented 6 years ago

It's probably better to check it when the code is generated, to allow this anytime:

$class->setAbstract(true)->setFinal(false);

ie. in cases when $class is already marked as final