Open vpassapera opened 3 years ago
Declare public methods first, then protected ones and finally private ones. The exceptions to this rule are the class constructor and the setUp() and tearDown() methods of PHPUnit tests, which must always be the first methods to increase readability; https://symfony.com/doc/current/contributing/code/standards.html#structure
although exceptions made, none of them for abstract functions.... so basicaly the result is as intended
Given a class like:
And running with a config such as (Some rules excluded due to incompatiblity with PHP 8):
It does not make sense to trigger a failure for the method scopes, but it happens:
https://www.php-fig.org/psr/psr-2/
PSR 2 shows examples of this within the code blocks provided (not explicitly), where the abstract method declarations occur before any of the concrete method declarations.
PSR 12 does not state against this.
The scoping rules should still apply, but abstract methods are defined on top of concrete methods, following the scope rules, then concrete methods, following the scope rules. At least, that's the expectation.