Skip to content

Commit 86a7c67

Browse files
committed
Also make the isNotSame with CallLikes returning constants fail
1 parent abc79d5 commit 86a7c67

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

tests/PHPStan/Rules/Comparison/ImpossibleCheckTypeMethodCallRuleTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ public function testRule(): void
8484
'Call to method ImpossibleMethodCall\Foo::isSame() with \'foo\' and \'foo\' will always evaluate to true.',
8585
101,
8686
],
87+
[
88+
'Call to method ImpossibleMethodCall\Foo::isNotSame() with \'foo\' and \'foo\' will always evaluate to false.',
89+
104,
90+
],
8791
]);
8892
}
8993

tests/PHPStan/Rules/Comparison/data/impossible-method-call.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ public function doDolor(\stdClass $std1, \stdClass $std2)
9898
if ($this->isNotSame(self::createStdClass('b'), self::createStdClass('b'))) {
9999

100100
}
101-
if ($this->isSame(self::returnFoo(), self::returnFoo())) {
101+
if ($this->isSame(self::returnFoo('a'), self::returnFoo('a'))) {
102102

103103
}
104-
if ($this->isNotSame(self::returnFoo(), self::returnFoo())) {
104+
if ($this->isNotSame(self::returnFoo('b'), self::returnFoo('b'))) {
105105

106106
}
107107
}
@@ -119,7 +119,7 @@ public static function createStdClass(string $foo): \stdClass
119119
/**
120120
* @return 'foo'
121121
*/
122-
public static function returnFoo(): string
122+
public static function returnFoo(string $foo): string
123123
{
124124
return 'foo';
125125
}

0 commit comments

Comments
 (0)