Skip to content

Add PhpdocSimplifyArrayKeyFixer#13

Merged
spawnia merged 4 commits intomasterfrom
phpdoc-simplify-array-key-fixer
Jan 12, 2026
Merged

Add PhpdocSimplifyArrayKeyFixer#13
spawnia merged 4 commits intomasterfrom
phpdoc-simplify-array-key-fixer

Conversation

@spawnia
Copy link
Member

@spawnia spawnia commented Jan 8, 2026

Summary

Adds a custom fixer that simplifies array<array-key, T> to array<T>.

Since array-key is equivalent to int|string and arrays naturally have int|string keys, specifying this explicitly is redundant. The fixer also handles array<int|string, T> and array<string|int, T> variants.

Test plan

  • Install dev branch in a project: composer require mll-lab/php-cs-fixer-config:dev-phpdoc-simplify-array-key-fixer --dev
  • Run php-cs-fixer and verify it transforms array<array-key, T> to array<T>
  • Verify PHPStan still passes after the transformation

🤖 Generated with Claude Code

Adds a custom fixer that simplifies array<array-key, T> to array<T>.

Since array-key is equivalent to int|string and arrays naturally have
int|string keys, specifying this explicitly is redundant. The fixer also
handles array<int|string, T> and array<string|int, T> variants.

Co-Authored-By: Claude <noreply@anthropic.com>
@spawnia spawnia marked this pull request as ready for review January 8, 2026 11:25
@spawnia spawnia requested a review from simbig January 8, 2026 11:25
spawnia and others added 3 commits January 9, 2026 15:20
- Add PHPUnit tests with comprehensive test cases
- Add validate.yml CI workflow with PHP 7.4-8.4 matrix
- Add test target to Makefile
- Update format.yml to use checkout@v4
- Improve regex to handle whitespace variations

Co-Authored-By: Claude <noreply@anthropic.com>
- Remove <source> element from phpunit.xml (PHPUnit 10+ only)
- Use @dataProvider annotation instead of attribute (PHPUnit 9.x)
- Fix composer update command (--prefer-highest doesn't exist)

Co-Authored-By: Claude <noreply@anthropic.com>
@spawnia spawnia requested a review from simbig January 12, 2026 07:58
@spawnia spawnia merged commit 7a09574 into master Jan 12, 2026
@spawnia spawnia deleted the phpdoc-simplify-array-key-fixer branch January 12, 2026 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants