Closed rikvdh closed 1 month ago
@rikvdh I don't understand what change you are proposing/suggesting. Maybe adding some code samples would help (also for the other issue a good idea).
If I look at the specs above, the PSR2.Methods.MethodDeclaration
sniff already handles the checking of the order perfectly for methods as the readonly
keyword does not apply to methods and methods can also not be typed in this way.
Also note that for properties this is checked via the PSR2.Classes.PropertyDeclaration
sniff and, again, that sniff already handles this correctly.
I was not sure if this was fully covered yet, I'll check this.
I was not sure if this was fully covered yet, I'll check this.
It may be, it may not be. Please check before opening an issue....
Ok, this was not fully covered for PER 2.0 currently. Solved via PHPCSExtra.
For PER 2.0 we need a 'updated' variant for checking modifier keywords. In PSR-12/PER 1.0, only abstract, final and static were checked (see
PSR2.Methods.MethodDeclaration
). But for PER 2.0, this is extended:An updated version of
PSR2.Methods.MethodDeclaration
might be a good approach and might be quite simple to do for someone wanting to get into developing sniffs.