Open earthiverse opened 7 months ago
@earthiverse Thank you for reporting this. I've changed the type from "bug" to "feature request" (enhancement) as the PSR2.Classes.PropertyDeclaration
sniff does not support constructor property promotion at all - and neither PSR2 nor PSR12 would expect it to, as both predate constructor property promotion, let alone readonly
properties.
As things are, what with the sniff being based on the AbstractVariableSniff
, adding support for examining properties declared via constructor property promotion to the sniff would likely warrant a complete rewrite of the sniff.
Describe the bug
PSR2.Classes.PropertyDeclaration.ReadonlyBeforeVisibility
doesn't apply when constructor property promotion is usedCode sample
To reproduce
Steps to reproduce the behavior:
test.php
with the code sample above...phpcs test.php ...
Time: 37ms; Memory: 8MB