File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
rules/CodeQuality/Rector/Equal Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change 1111use PhpParser \Node \Expr \BinaryOp \NotEqual ;
1212use PhpParser \Node \Expr \BinaryOp \NotIdentical ;
1313use PHPStan \Type \MixedType ;
14- use Rector \NodeTypeResolver \TypeComparator \TypeComparator ;
1514use Rector \Rector \AbstractRector ;
1615use Symplify \RuleDocGenerator \ValueObject \CodeSample \CodeSample ;
1716use Symplify \RuleDocGenerator \ValueObject \RuleDefinition ;
2120 */
2221final class UseIdenticalOverEqualWithSameTypeRector extends AbstractRector
2322{
24- public function __construct (
25- private readonly TypeComparator $ typeComparator
26- ) {
27- }
28-
2923 public function getRuleDefinition (): RuleDefinition
3024 {
3125 return new RuleDefinition (
@@ -91,8 +85,12 @@ public function refactor(Node $node): ?Node
9185 return $ this ->processIdenticalOrNotIdentical ($ node );
9286 }
9387
88+ if ($ leftStaticType ->isBoolean ()->yes () && $ rightStaticType ->isBoolean ()->yes ()) {
89+ return $ this ->processIdenticalOrNotIdentical ($ node );
90+ }
91+
9492 // different types
95- if (! $ this -> typeComparator -> areTypesEqual ( $ leftStaticType , $ rightStaticType )) {
93+ if (! $ leftStaticType -> equals ( $ rightStaticType )) {
9694 return null ;
9795 }
9896
You can’t perform that action at this time.
0 commit comments