The following code creates an "Unnecessary parentheses" notification:
if ((/** @var DateTime $test */ $test = $_SESSION['abc']) instanceof \DateTime) {
echo 'do something';
}
Performing the auto-fix results in this invalid code:
if (/** @var DateTime $test */ instanceof \DateTime) {
echo 'do something';
}
Executing the PHP script naturally results in an error:
Parse error: syntax error, unexpected 'instanceof' (T_INSTANCEOF) in C:\[....]\test.php on line 3
Oops. Will fix it.
Fixed
Great job!
Most helpful comment
Oops. Will fix it.