You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AssertEmptyIsDiscouragedRule should respect the %strictRules.disallowedEmpty% parameter #339
The strict-rules package makes disallowing empty configurable. Disallowing assertEmpty as soon as strict-rules are installed is stricter than the project config for strict rules.
The original feature request in #270 was asking to reject assertEmpty when disallowedEmpty was set. The PR implementing it says it applies when empty usage is disallowed, but the implementation does not respect the PR title as it does not respect this flag.
Sorry that I didn't update the PR title and description accordingly. My first attempt had this config, but as said, I needed to remove it again. I would also looking forward to couple it to the right config of the strict rules
The config parameters in strict-rules predate error identifiers so I feel like it's unnecessary to add more of them or even support them in this cross-package way.
I think we could remove these options altogether in 3.0 and tell people to ignore by identifier with ignoreErrors in phpstan.neon.
Btw the new "empty" rule will change the identifier in the next release to be consistent with other identifiers from phpstan-phpunit. Fortunately we can do that because it's bleeding edge-only for now.
Activity
VincentLanglet commentedon Oct 1, 2026
Technically a similar issue exists with AssertEqualIsDiscouraged and nobody reported it.
For context this may require more work because accessible disallowedEmpty will crash when strict rules is not installed
#325 (comment) cc @staabm
Could be great having the feature on PHPStan though.
mitelg commentedon Oct 1, 2026
Sorry that I didn't update the PR title and description accordingly. My first attempt had this config, but as said, I needed to remove it again. I would also looking forward to couple it to the right config of the strict rules
staabm commentedon Oct 1, 2026
PHPStan strict-rules has soo many feature flags.. I am not sure we want/can/should have all of them wired up in other extensions.
I can only see 47 projects on github.com using strict-rules but disabling "allow-empty":
https://github.com/search?q=%22disallowedEmpty%3A+false%22+language%3ANEON+NOT+is%3Afork&type=code
I totally get your point though, but I am not sure we should solve that.
in addition we plan to make this rule auto-fixable which might lower the frustration
lets see what ondrej thinks about it
ondrejmirtes commentedon Oct 1, 2026
The config parameters in strict-rules predate error identifiers so I feel like it's unnecessary to add more of them or even support them in this cross-package way.
I think we could remove these options altogether in 3.0 and tell people to ignore by identifier with ignoreErrors in phpstan.neon.
ondrejmirtes commentedon Oct 1, 2026
Btw the new "empty" rule will change the identifier in the next release to be consistent with other identifiers from phpstan-phpunit. Fortunately we can do that because it's bleeding edge-only for now.