-
-
Notifications
You must be signed in to change notification settings - Fork 742
Closed
rectorphp/rector-src
#7885Labels
Description
Bug Report
| Subject | Details |
|---|---|
| Rector version | 2.3.5 |
Minimal PHP Code Causing Issue
Select::make('away_team_id')
->label('Away Team')
->relationship(
'awayTeam',
'name',
modifyQueryUsing: function (Builder $query) {
/** @var Builder<Team> $query */
return $query->inFullNameOrder();
},
);ClosureToArrowFunctionRector changes it to this:
Select::make('away_team_id')
->label('Away Team')
->relationship(
'awayTeam',
'name',
modifyQueryUsing:
/** @var Builder<Team> $query */
fn(Builder $query) => $query->inFullNameOrder(),
);This causes the phpstan type narrowing to no longer apply to $query and there is no way (that I have found) to change the docblock in a way for phpstan to recognize it within an arrow function. I can have phpstan ignore the line instead but I'd rather keep the cleaner approach to avoid ignoring any other issues that might be introduced.
I would like for Rector to skip ClosureToArrowFunctionRector if there is a docblock inside the closure.
Reactions are currently unavailable