Skip to content

[fix] Fix named arg broken printer on array_map - #7715

Merged
TomasVotruba merged 3 commits into
mainfrom
tv-sort-args-fix-1
Dec 4, 2025
Merged

[fix] Fix named arg broken printer on array_map #7715
TomasVotruba merged 3 commits into
mainfrom
tv-sort-args-fix-1

Conversation

@TomasVotruba

@TomasVotruba TomasVotruba commented Dec 4, 2025

Copy link
Copy Markdown
Member

Temporary workaround to allow printer work on named args of array_map()

Follow up to #7676

Closes rectorphp/rector#9492

@TomasVotruba
TomasVotruba force-pushed the tv-sort-args-fix-1 branch 3 times, most recently from 4438b12 to ef3aa32 Compare December 4, 2025 21:17
@TomasVotruba
TomasVotruba force-pushed the tv-sort-args-fix-1 branch 2 times, most recently from d8d7732 to 6b94299 Compare December 4, 2025 22:02

@samsonasik samsonasik left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

To support cross-platform compatibility( eg on windows) it can be changed to:

// Normalize line endings for cross-platform compatibility
$this->assertSame(
    str_replace("\r\n", "\n", $expectedContents),
    str_replace("\r\n", "\n", $printerContents)
);

in PHPStanPrinterTest.php

I can help fix it if you need :)

@TomasVotruba
TomasVotruba merged commit 539b3fe into main Dec 4, 2025
57 checks passed
@TomasVotruba
TomasVotruba deleted the tv-sort-args-fix-1 branch December 4, 2025 22:22
@samsonasik

Copy link
Copy Markdown
Member

@TomasVotruba phpstan 2.1.33 just released https://github.com/phpstan/phpstan/releases/tag/2.1.33

I think we can give phpstan 2.1.33 a try, include the ArrayMapArgVisitor so type casting will not be needed under array of strings change https://github.com/rectorphp/rector-src/pull/7715/files#diff-a848e3edfbb5abb06db37b312a6689b7f9e73d2438a141166c1ebf43613ff8d2

@samsonasik

Copy link
Copy Markdown
Member

I created PR:

for it 👍

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically locked because it has been closed for 150 days. Please open a new PR if you want to continue the work.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators May 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Sort named arguments breaks file

2 participants