Repository navigation
Exempt the ICU tzdata check from PHPStan's stub, keep the guard - #35
Merged
Merged
Conversation
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
PHPStan fails
mainwith one error:This keeps the guard and exempts the line, rather than deleting the branch PHPStan believes is unreachable.
Why the guard stays
PHPStan reads
IntlTimeZone::getTZDataVersion()as returningstring. That is its stub's claim, not the extension's. Measured 2026-11-13 on PHP 8.5.12 with ICU 57.2:ReflectionMethodreports no declared return type at all, and the manual has documentedstring|falsesince PHP 5. So the stub narrows further than the runtime promises, andis_string()is a real guard against a value the extension may still produce.Line 74, immediately above, handles the same
falsefor the same reason:Deleting the check to satisfy the stub would let a
falsereach$this->comparable($icu)and be interpolated into a warning message — a behaviour change on exactly the hosts the branch exists for, which~/.claude/rules/preserve.mdcalls a removal in disguise.The exemption carries its reason and its measurement
Inline
@phpstan-ignore function.alreadyNarrowedTypeon that one line, with a comment naming the PHP and ICU versions it was measured against, so the entry is a ceiling rather than a licence. NoignoreErrorsblock is added tophpstan.neon, which still has none — a config-level entry would silently cover future occurrences elsewhere.Scope
Unblocks #34, which is the security-scan rollout and touches no PHP. That PR's failure was pre-existing on
main: line 76 is byte-identical there.