IBX-12654: Added ibexa/phpstan and fixed dynamic calls to static methods - #839
Merged
wiewiurdp merged 6 commits intoSep 23, 2026
Conversation
bnowak
marked this pull request as ready for review
September 23, 2026 10:32
konradoboza
reviewed
Sep 23, 2026
konradoboza
left a comment
Contributor
There was a problem hiding this comment.
There are tons of FQCNs which need to be fixed by imports to name a few:
…is:: per convention
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
bnowak
force-pushed
the
IBX-12654-added-ibexa-phpstan-and-fixed-dynamic-calls-to-static-methods
branch
from
September 23, 2026 12:11
e63d529 to
2a669f2
Compare
konradoboza
approved these changes
Sep 23, 2026
|
wiewiurdp
approved these changes
Sep 23, 2026
wiewiurdp
deleted the
IBX-12654-added-ibexa-phpstan-and-fixed-dynamic-calls-to-static-methods
branch
September 23, 2026 13:28
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.


Related PRs:
Description:
Adds
ibexa/phpstanas a dev dependency and includes its extension in the PHPStan configuration.Replaces dynamic calls to static methods (
$this->assertX(), static test helpers,assertQueryResult, ...) withself::/ClassName::calls: 463 calls fixed in 74 files. ThestaticMethod.dynamicCallstrict rule itself is enabled in the linked ibexa/phpstan PR; this PR keeps CI green once that is released. One production-code fix:src/lib/Persistence/TransformationProcessor/PcreCompiler.phpnow callsUtf8Converter::toUnicodeCodepoint()/toUTF8Character()statically instead of through the$converterproperty inside a closure. Three stale baseline entries were removed (no longer matched after theself::conversions changed PHPStan's error messages).Also fixes what the existing
ibexa/phpstanrules report: 133 closures/arrow functions got return types (Ibexa.requireClosureReturnType), across both production code (29 hits, e.g. cache decorators insrc/lib/Persistence/Cache/*,RegenerateUrlAliasesCommand,Configuration, QueryType normalizers) and tests (104 hits). NoIbexa.noConfigResolverParametersInConstructorhits were reported for this package.Judgment calls:
Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchHit::$valueObject, an unconstrained generic template; or values threaded through an untypedcallableproperty), the closure is typedmixed.willReturnCallbackclosures use anif ($matcher->numberOfInvocations() === N) { ...; return X; }chain with no default branch (safe in practice becauseexpects(self::exactly(N))guarantees the exact call count). These are typed as a nullable/union of the real branch types (e.g.?string) with an explicit trailingreturn null;, since PHPStan requires an explicit return on every path regardless of the declared type's nullability.BaseNumericValidatorTestCase.php,SearchBaseIntegrationTestCase.php,SearchMultivaluedBaseIntegrationTestCase.php,AbstractServiceTestCase.php) where the dynamic-call fix had usedstatic::for calls to abstract static methods instead of this codebase's documented convention ($this::method()); corrected in a follow-up commit..github/workflows/backend-ci.yaml: added the missingibexa/gh-workflows/actions/setup-composer-root-version@mainstep (already used byrector.yaml) beforecomposer-installin thecs-fix,deptrac,tests,integration-tests-postgres,integration-tests-mysqlandsolr-integrationjobs. Without it, PR checkouts resolve to adev-<sha>root version that doesn't satisfyibexa/phpstan's ownibexa/core: ~6.0.x-dev || ^6.0requirement, socomposer installfailed with an unresolvable circular-dependency error the momentibexa/phpstanbecame a dependency of this package. This only ever surfaced once this PR introduced the first dependency cycle (core → phpstan → core); it's a genuine CI workflow gap, not something specific to our diff.: Typeclosure-return-type insertions landing inside pre-existing, already-duplicated PHPUnit test blocks (e.g.PcreCompiler.php,TrashHandlerTest.php,FieldSortClauseParserTest.php/MapDistanceSortClauseParserTest.php); SonarCloud counts the whole pre-existing duplicated block as "new" whenever any line inside it changes. No new duplication was introduced and the flagged test fixtures are out of scope to refactor here.For QA:
No functional change. CI (PHPStan, code style, unit tests) is the verification.
Documentation:
No client-facing impact.