Skip to content

Fix build against phpstan/phpstan 2.3.8 - #526

Merged
ondrejmirtes merged 1 commit into
2.1.xfrom
fix-phpstan-2-3-8
Nov 27, 2026
Merged

ondrejmirtes merged 1 commit into
2.1.xfrom
fix-phpstan-2-3-8

Conversation

@ondrejmirtes

Copy link
Copy Markdown
Member

phpstan/phpstan 2.3.8 (currently 2.3.x-dev) no longer merges a constant array option default into the general array type. For an array option with a [1] default, getOption() now returns array{1}|array<int, string|null> instead of array<int, 1|string|null>. The new type is more precise and still correct.

  • Update the affected assertions in ExampleOptionCommand and ExampleOptionLazyCommand.
  • Require phpstan/phpstan: ^2.3.8, so the lowest-deps CI job doesn't resolve to an older 2.3.x that still gives the old type.

Amp thread: https://ampcode.com/threads/T-01a21d5b-5d9b-7142-9da2-6a828b042aa0

Array option defaults are no longer merged into the general array type,
so getOption() returns array{1}|array<int, string> for a [1] default.

Amp-Thread-ID: https://ampcode.com/threads/T-01a21d5b-5d9b-7142-9da2-6a828b042aa0
@ondrejmirtes
ondrejmirtes merged commit 53f600c into 2.1.x Nov 27, 2026
52 checks passed
@ondrejmirtes
ondrejmirtes deleted the fix-phpstan-2-3-8 branch November 27, 2026 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant