re #96 raise PHPStan to level 8, zero baseline (completes #96)#114
Merged
Conversation
Raise phpstan.neon.dist level 7 -> 8 and fix all 35 new findings at root cause across 11 packages (parallel sub-agents + central verification). No baseline; PHPStan [OK] at level 8. Full suite green (only the pre-existing ext-mongodb-absent MongoSessionHandlerTest errors). Level 8 is null-safety: method.nonObject, return.type, argument.type from nullable/mixed flows. Representative fixes: - Map::get()/remove() typed @template TDefault -> @return TValue|TDefault, so the optional-default fallback is expressed honestly (TValue|null with no default) instead of a false non-null @return TValue. - preg_replace string|null returns coalesced to the original input (Inflector, Pluralizer, Validator/CreditCard/Iban sanitize()). - PdoSessionAdapterAwareTrait extracts createConnection(): PDO so getConnection() provably returns non-null; DigestSignatureValidator returns false for unknown users; SDK emitters narrow ?SchemaType via a local !== null guard. - IpRule/FiltersRunner null guards; HttpNotFoundException typed string $message. This completes the #96 program: level 8 with no baseline file. The only remaining ignoreErrors are documented, justified exceptions (ext-* stubs, public-API mixin traits, the intentional Cookie/CollectionTrait adapter-storage design, and Cycle's loose-union getRepository generic).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Final step of #96: raises
phpstan.neon.distlevel 7 → 8 and fixes all 35 new findings at root cause across 11 packages. No baseline; PHPStan[OK]at level 8.Level 8 is null-safety (
method.nonObject,return.type,argument.typefrom nullable/mixedflows). Representative fixes:Map::get()/remove()typed with@template TDefault→@return TValue|TDefault, so the optional-default fallback is expressed honestly (TValue|nullwhen no default) instead of a false non-null@return TValue. Behaviour unchanged (body still returns the default).preg_replacestring|nullreturns coalesced to the original input (Inflector,Pluralizer,Validator/CreditCardRule/IbanRulesanitize()).PdoSessionAdapterAwareTraitextractscreateConnection(): PDOsogetConnection()provably returns non-null;DigestSignatureValidatorreturnsfalsefor unknown users; SDK emitters narrow?SchemaTypevia a local!== nullguard;IpRule/FiltersRunnernull guards;HttpNotFoundExceptiontypedstring $message.#96 complete
This completes the static-analysis program:
ignoreErrorsremaining are documented, justified exceptions: ext-* stubs, public-API mixin traits, the intentional Cookie/CollectionTraitadapter-storage design, and Cycle's loose-uniongetRepositorygeneric.Test plan
composer stan(level 8, no baseline) —[OK] No errorscomposer cs(cache-free) — cleanvendor/bin/rector process --dry-run(full) — cleancomposer test— 5555 tests; only pre-existing localMongoSessionHandlerTestenv errors (CI loads ext-mongodb)