-
-
Notifications
You must be signed in to change notification settings - Fork 741
Closed
rectorphp/rector-src
#6653Labels
Description
Bug Report
| Subject | Details |
|---|---|
| Rector version | last dev-main |
| Installed as | composer dependency |
Minimal PHP Code Causing Issue
See https://getrector.com/demo/f61e55a6-164e-47b4-9047-582521ecf703
<?php
final class DemoFile
{
public function run(?\DateTimeImmutable $param)
{
- if (null === ($paramValue = $param)) {
+ if (!$paramValue = $param instanceof \DateTimeImmutable) {
return 'no';
}
return $paramValue;
}
}Responsible rules
FlipTypeControlToUseExclusiveTypeRector
Expected Behavior
<?php
final class DemoFile
{
public function run(?\DateTimeImmutable $param)
{
- if (null === ($paramValue = $param)) {
+ if (!($paramValue = $param) instanceof \DateTimeImmutable) {
return 'no';
}
return $paramValue;
}
}Reactions are currently unavailable