Skip to content

Update phpstan/phpstan requirement from ^1.12 to ^2.1#63

Merged
donatj merged 3 commits into
masterfrom
dependabot/composer/phpstan/phpstan-tw-2.1
May 4, 2026
Merged

Update phpstan/phpstan requirement from ^1.12 to ^2.1#63
donatj merged 3 commits into
masterfrom
dependabot/composer/phpstan/phpstan-tw-2.1

Conversation

@dependabot
Copy link
Copy Markdown
Contributor

@dependabot dependabot Bot commented on behalf of github May 4, 2026

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

@dependabot dependabot Bot added dependencies Pull requests that update a dependency file php Pull requests that update Php code labels May 4, 2026
---
updated-dependencies:
- dependency-name: phpstan/phpstan
  dependency-version: 2.1.54
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot Bot force-pushed the dependabot/composer/phpstan/phpstan-tw-2.1 branch from e71f8de to ba2d18c Compare May 4, 2026 12:10
@donatj
Copy link
Copy Markdown
Member

donatj commented May 4, 2026

@copilot please fix

Copy link
Copy Markdown
Contributor

Copilot AI commented May 4, 2026

@copilot please fix

Fixed in 79fb31c. PHPStan 2.x now types $_SERVER as array<string, mixed> rather than array<string, scalar>, causing two errors in ProxyAwareSchemer.php. The fix updates the $server property type annotation to array<string, mixed> and adds is_scalar() / is_numeric() guards before the existing casts (which were already there, just now need explicit narrowing). All 30 tests still pass.

Copilot finished work on behalf of donatj May 4, 2026 12:17
Copilot AI requested a review from donatj May 4, 2026 12:17
@donatj
Copy link
Copy Markdown
Member

donatj commented May 4, 2026

@copilot remove the spaces you added in the array type definitions. There should be no spaces

Copy link
Copy Markdown
Contributor

Copilot AI commented May 4, 2026

@copilot remove the spaces you added in the array type definitions. There should be no spaces

Done in a3f67dc. Removed spaces from all array type annotations (array<string,mixed>, array<string,string>).

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the development toolchain to PHPStan 2.1 and adjusts ProxyAwareSchemer’s server-value handling so the codebase type-checks cleanly under the stricter analyzer. This fits the repo’s existing CI/static-analysis workflow by keeping the library compatible with newer tooling without changing its public surface area.

Changes:

  • Bumps phpstan/phpstan in require-dev from ^1.12 to ^2.1.
  • Broadens ProxyAwareSchemer’s server-array annotations from scalar-only to mixed values.
  • Adds runtime guards before lowercasing scheme values and parsing forwarded ports.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/ProxyAwareSchemer.php Updates parameter/property phpdoc types and adds guards around forwarded scheme/port inspection.
composer.json Raises the PHPStan development dependency to the 2.x line.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/ProxyAwareSchemer.php
Comment on lines +130 to 131
if( isset($this->server[$portKey]) && is_numeric($this->server[$portKey]) ) {
$port = (int)$this->server[$portKey];
Comment thread src/ProxyAwareSchemer.php
Comment thread src/ProxyAwareSchemer.php
@donatj donatj merged commit 07ec79a into master May 4, 2026
24 checks passed
@donatj donatj deleted the dependabot/composer/phpstan/phpstan-tw-2.1 branch May 4, 2026 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file php Pull requests that update Php code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants