diff --git a/rules-tests/CodeQuality/Rector/MethodCall/MatchAssertSameExpectedTypeRector/Fixture/skip_docblock_type.php.inc b/rules-tests/CodeQuality/Rector/MethodCall/MatchAssertSameExpectedTypeRector/Fixture/skip_docblock_type.php.inc new file mode 100644 index 00000000..a567ba36 --- /dev/null +++ b/rules-tests/CodeQuality/Rector/MethodCall/MatchAssertSameExpectedTypeRector/Fixture/skip_docblock_type.php.inc @@ -0,0 +1,21 @@ +assertSame('123', $this->getOrderId()); + } + + /** + * @return int + */ + private function getOrderId() + { + return '123'; + } +} diff --git a/rules/CodeQuality/Rector/MethodCall/MatchAssertSameExpectedTypeRector.php b/rules/CodeQuality/Rector/MethodCall/MatchAssertSameExpectedTypeRector.php index 4068f152..7492cdea 100644 --- a/rules/CodeQuality/Rector/MethodCall/MatchAssertSameExpectedTypeRector.php +++ b/rules/CodeQuality/Rector/MethodCall/MatchAssertSameExpectedTypeRector.php @@ -103,7 +103,7 @@ public function refactor(Node $node): ?Node $variableExpr = $node->getArgs()[1] ->value; - $variableType = $this->getType($variableExpr); + $variableType = $this->nodeTypeResolver->getNativeType($variableExpr); $directVariableType = TypeCombinator::removeNull($variableType);