-
-
Notifications
You must be signed in to change notification settings - Fork 740
Closed
rectorphp/rector-src
#6780Labels
Description
Bug Report
| Subject | Details |
|---|---|
| Rector version | last dev-main |
| Installed as | composer dependency |
Minimal PHP Code Causing Issue
See https://getrector.com/demo/829dba24-5560-45e3-a696-d4a438753b08
PHPStan playground: https://phpstan.org/r/28d47df0-e978-43b2-bad5-d568bf6b9135
<?php
final class SkipVoidReturn
{
public function doNohing(string $a): void
{
echo $a;
}
public function run()
{
fn() => $this->executesCallback(fn() => $this->doNohing('a'));
}
/**
* @template T
* @param callable(): T $callback
* @return T
*/
public function executesCallback(callable $callback): mixed
{
return $callback();
}
}Responsible rules
AddArrowFunctionReturnTypeRector
Expected Behavior
Either no change should be made, or a return of null should be added, instead of mixed.
Mixed causes a PHPStan issue, as the return type is incorrect. A return type of null would be (more) correct here.
Reactions are currently unavailable