Run PHPStan at level 5 [ignore_release] - #94
Merged
Merged
Conversation
…ase] getRegexMatchEntry() and getNumEntriesToCache() are annotated @return string but cast to int; the annotation also made the subtraction in WarmDeviceDetectorCache read as int minus string. writeToCache() has taken one parameter since 0c205c3, yet every call site still passed a second empty array, which PHP discarded. The constructor takes an array of client-hint headers and converts it with ClientHints::factory(), so declaring it array stops the parent signature being inherited as ?ClientHints.
The findings that would have failed it are fixed in the previous commit.
AltamashShaikh
approved these changes
Sep 14, 2026
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.
Description
This plugin had no
phpstan.neon, so the umbrella skipped the check and it has never been analysed. The configuration matches the one the rest of the fleet uses; level 5 is what the comparably sized plugins already run at, and the plugin is clean at that level.Six findings, which turned out to be three causes — all fixed in their own commit.
getRegexMatchEntry()andgetNumEntriesToCache()are annotated@return stringbut bothreturn (int)…. That one wrong annotation accounted for three of the six: the two return-type findings, and theint - non-falsy-stringon the subtraction inWarmDeviceDetectorCache, which reads$numEntriesToCachefrom that method.writeToCache()has taken a single parameter since0c205c38, but every call site — one in the command and twelve in the tests — still passed a second empty array. PHP discards extra arguments to a userland function, so nothing broke; the calls now match the signature.CachedEntry::__construct()left$clientHintsuntyped, so its type was inherited fromDeviceDetector::__construct(..., ?ClientHints $clientHints = null). The class actually takes an array of headers and converts it withClientHints::factory(), and all five call sites pass arrays. Declaring itarraystates the real contract and resolves both remaining findings.No version bump or changelog entry: the substance is static-analysis setup.
Issue No
No GitHub issue.
Steps to Replicate the Issue
skip-phpstanfor this plugin because there is no config to run.Checklist