Repository navigation
chore(analysis): keep runtime fetch guards valid under PHPStan 2.3 - #35
Merged
Merged
Conversation
PHPStan 2.3.1 (resolved by CI because phpstan/phpstan is ^2.1 and no lock file is tracked) reports the defensive is_array()/is_string() checks on PDOStatement::fetch() results as always true. The guards are exercised by PdoPaginatorFailureTest::testInvalidScalarFetch, so they stay. The fetch result is declared mixed instead, which matches what a driver or test double may return. No behavior change; no baseline or ignore added. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
Problem
CI
Quality (PHP 8.2)fails onmaincontent with PHPStan 2.3.1:phpstan/phpstanis^2.1and no lock file is tracked, so CI resolves the newest release. Reproduced on a clean checkout ofmain(fc1459b) with a freshcomposer update; the last greenmainCI ran on 2026-09-18, before 2.3.x. Three errors (function.alreadyNarrowedType):src/Pdo/Pagination/PdoPaginator.php:210and:215tests/Support/MySql/OrderingStateReader.php:80Change
The
is_array()/is_string()guards stay:PdoPaginatorFailureTest::testInvalidScalarFetchcovers the scalar-fetch guard, and PDO can return integer keys for numeric column names. The fetch result is declared/** @var mixed */, matching what a driver or test double may return. No behavior change, no baseline, no ignore, no version pin.Verification
Fresh resolve (phpstan 2.3.1), MySQL 8.4.11: validate, autoload, platform reqs, audit, PHPStan max (no errors), unit 260, regression 41, integration 94, consumer harness, php-cs-fixer,
git diff --check.Unblocks #34, which is unrelated to these errors.
🤖 Generated with Claude Code