Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong parenthesis in union types (Docblocks) #8839

Open
Sergiobop opened this issue Sep 24, 2024 · 1 comment
Open

Wrong parenthesis in union types (Docblocks) #8839

Sergiobop opened this issue Sep 24, 2024 · 1 comment
Labels

Comments

@Sergiobop
Copy link

Sergiobop commented Sep 24, 2024

Bug Report

Subject Details
Rector version 1.2.5

Using importNames is bugged when parameters in docblock are union types

Minimal PHP Code Causing Issue

https://getrector.com/demo/cf0e000e-4926-4427-9bad-6193e6ff4a58

Expected Behaviour

Original phpdoc:

  • @method static orderByDistance(\Illuminate\Database\Query\Expression|string $column, \Illuminate\Database\Query\Expression|string $geometryOrColumn)

The resulting phpdoc after executing rector is:

    • @method static orderByDistance((Expression | string) $column, (Expression | string) $geometryOrColumn)

This is wrong (the parenthesis is wrong), the code should be:

    • @method static orderByDistance(Expression | string $column, Expression | string $geometryOrColumn)
@Sergiobop Sergiobop added the bug label Sep 24, 2024
@samsonasik
Copy link
Member

Reprinting doc is by phpstan's phpdoc-parser, so add the parentheses on union under @method param definition on print seems expected there, probably related with issue phpstan/phpdoc-parser#74.

Not really an issue when read by phpstan afaik. Not sure if it worth tweak on rector side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants