[Chore]: Add PHPStan rule to enforce ClientIp resolver usage - #147
Merged
Conversation
Co-authored-by: Orrison <6799341+Orrison@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
Orrison
August 23, 2026 16:06
View session
Orrison
requested changes
Aug 23, 2026
Co-authored-by: Orrison <6799341+Orrison@users.noreply.github.com>
Orrison
approved these changes
Aug 23, 2026
danharrin
approved these changes
Aug 24, 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.
Ticket(s) or GitHub Issue
Technical Description
Direct
RequestIP accessors can return incorrect client addresses in Cloudflare + ALB deployments. This change adds a package PHPStan rule so consuming apps are guided to useClientIp::resolve()consistently.Rule implementation
UseClientIpResolverRuleundersrc/Rules/UseClientIpResolver/.Common.useClientIpResolverforIlluminate\Http\Requestcalls to:ip()ips()getClientIp()getClientIps()ClientIpclass internals to avoid flagging its fallback path.Package registration
phpstan-extension.neonso consumers including this extension receive the check.Rule coverage
tests/PHPStan/for:ip(),getClientIp())ClientIp::resolve($request))@phpstan-ignore Common.useClientIpResolver)Please apply the
Change Type | New Featurelabel.Any deployment steps required?
No
Are any Feature Flags and/or Data Migrations that can eventually be removed Added?
No
Before contributing and submitting this PR, make sure you have Read, agree, and are compliant with the contributing guidelines.