Uh oh!
There was an error while loading. Please reload this page.
chore: pay down PHPStan baseline (34 → 10) - #32
Merged
Conversation
Fix the mechanical strict-rule findings so the baseline drops from 34 to 10 entries; the remaining 10 are genuine typing work left for a follow-up (offset-access null-safety on ES responses, provider return-type covariance, one dynamic enum-constant fetch, and a console suggestedValues closure). - Replace banned empty()/short-ternary/negated-array constructs with explicit comparisons (behaviour-preserving; filters skip unset/''/[] as before). - Pass the strict flag to in_array(). - Narrow the Elasticsearch client response with @var (as ElasticSearchIndex already does) and guard file_get_contents()/json_decode() in the fixture loader. - Annotate ApiUser::$username as non-empty-string; make the paginator count non-negative. phpstan (level 8 + strict), php-cs-fixer, and the API test suite (19 tests) all pass.
✅ No changes detected in API specification |
…line-paydown # Conflicts: # CHANGELOG.md
Uh oh!
There was an error while loading. Please reload this page.
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 freeto 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.
Follow-up to #31: fix the mechanical strict-rule findings so the PHPStan baseline shrinks from 34 to 10 entries.
Fixed (behaviour-preserving)
empty()→ explicit comparisons across the six ES filters,AbstractProvider, andElasticSearchIndex. The filters still skip unset /''/[]exactly as before (a literal"0"query value is now treated as a real value rather than silently skipped — the only behavioural nuance, and arguably a fix).!$this->properties→null === … || [] === …(thebooleanNotfindings).getLastPage().in_array(…, true)strict flag inFixturesLoadCommandandFixtureLoader.FixtureLoader: guardfile_get_contents()/json_decode(),1 === preg_match(...), and narrow the client response with/** @var Elasticsearch */(same patternElasticSearchIndexalready uses).ApiUser::$usernameannotatednon-empty-string; paginatorcount()wrapped inmax(0, …).Left in the baseline (10 — genuine typing work for a separate pass)
offsetAccess.notFound—$response['_source']onarray|nullin the 5 providers (real ES-response null-safety).method.childReturnType—provide()return-type covariance vsProviderInterface(3 providers).classConstant.nameType— dynamicDateLimit::{…}fetch inDateRangeFilter.argument.type— consoleaddArgument()suggestedValuesclosure signature.Verification
phpstan analyse(level 8 + strict) → No errors (baseline: 10) ·php-cs-fixer check→ clean ·bin/phpunit→ 19 tests, 44 assertions, OK.