Skip to content

Commit b555bd2

Browse files
committed
Updated Rector to commit d17d3e814eada2fa3ada3601034407df01d84568
rectorphp/rector-src@d17d3e8 [TypeDeclaration] Better approach for native type check on ReturnStrictTypeAnalyzer (#6343)
1 parent cdbdb1b commit b555bd2

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

rules/TypeDeclaration/TypeAnalyzer/ReturnStrictTypeAnalyzer.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
use PhpParser\Node\Stmt\Return_;
2121
use PHPStan\Analyser\Scope;
2222
use PHPStan\Reflection\ClassReflection;
23-
use PHPStan\Reflection\FunctionVariantWithPhpDocs;
23+
use PHPStan\Reflection\Native\NativeFunctionReflection;
24+
use PHPStan\Reflection\ParametersAcceptorWithPhpDocs;
2425
use PHPStan\Type\MixedType;
2526
use PHPStan\Type\StaticType;
2627
use PHPStan\Type\Type;
@@ -116,18 +117,13 @@ public function resolveMethodCallReturnType($call) : ?Type
116117
return null;
117118
}
118119
$parametersAcceptorWithPhpDocs = ParametersAcceptorSelectorVariantsWrapper::select($methodReflection, $call, $scope);
119-
if ($parametersAcceptorWithPhpDocs instanceof FunctionVariantWithPhpDocs) {
120+
if ($methodReflection instanceof NativeFunctionReflection) {
121+
$returnType = $parametersAcceptorWithPhpDocs->getReturnType();
122+
} elseif ($parametersAcceptorWithPhpDocs instanceof ParametersAcceptorWithPhpDocs) {
120123
// native return type is needed, as docblock can be false
121124
$returnType = $parametersAcceptorWithPhpDocs->getNativeReturnType();
122125
} else {
123126
$returnType = $parametersAcceptorWithPhpDocs->getReturnType();
124-
// around PHPStan 1.12.4+ handling
125-
if (\method_exists($parametersAcceptorWithPhpDocs, 'getNativeReturnType')) {
126-
$nativeReturnType = $parametersAcceptorWithPhpDocs->getNativeReturnType();
127-
if ($nativeReturnType instanceof MixedType && !$nativeReturnType->isExplicitMixed()) {
128-
$returnType = $nativeReturnType;
129-
}
130-
}
131127
}
132128
if ($returnType instanceof MixedType) {
133129
if ($returnType->isExplicitMixed()) {

src/Application/VersionResolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ final class VersionResolver
1919
* @api
2020
* @var string
2121
*/
22-
public const PACKAGE_VERSION = '697b37b340c3b4c73ad6f8e4cea26b7bf60ddf62';
22+
public const PACKAGE_VERSION = 'd17d3e814eada2fa3ada3601034407df01d84568';
2323
/**
2424
* @api
2525
* @var string
2626
*/
27-
public const RELEASE_DATE = '2024-10-01 18:10:51';
27+
public const RELEASE_DATE = '2024-10-01 20:02:39';
2828
/**
2929
* @var int
3030
*/

0 commit comments

Comments
 (0)