Skip to content

Commit c4ea127

Browse files
Merge pull request #1 from dotdash/master
Update to phpstan 0.10
2 parents ed21a99 + 2689c49 commit c4ea127

6 files changed

+10
-7
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
},
1212
"require": {
1313
"php": "~7.0",
14-
"phpstan/phpstan": "^0.9",
15-
"typo3/cms": "^8.7.0 || ~9.0"
14+
"phpstan/phpstan": "^0.10",
15+
"typo3/minimal": "^8.7.0 || ~9.0"
1616
},
1717
"autoload": {
1818
"psr-4": {

src/Reflection/RepositoryMethodsClassReflectionExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class RepositoryMethodsClassReflectionExtension implements MethodsClassReflectio
1616
*/
1717
private $broker;
1818

19-
public function setBroker(Broker $broker)
19+
public function setBroker(Broker $broker): void
2020
{
2121
$this->broker = $broker;
2222
}

src/Type/GeneralUtilityDynamicReturnTypeExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function getTypeFromStaticMethodCall(
3030
): Type {
3131
$arg = $methodCall->args[0]->value;
3232
if (!($arg instanceof \PhpParser\Node\Expr\ClassConstFetch)) {
33-
return $methodReflection->getReturnType();
33+
return ParametersAcceptorSelector::selectSingle($methodReflection->getVariants())->getReturnType();
3434
}
3535
$class = $arg->class;
3636

src/Type/ObjectManagerDynamicReturnTypeExtension.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use PHPStan\Type\ObjectType;
1010
use PHPStan\Type\Type;
1111
use PHPStan\Reflection\MethodReflection;
12+
use PHPStan\Reflection\ParametersAcceptorSelector;
1213

1314
class ObjectManagerDynamicReturnTypeExtension implements DynamicMethodReturnTypeExtension
1415
{
@@ -30,7 +31,7 @@ public function getTypeFromMethodCall(
3031
): Type {
3132
$arg = $methodCall->args[0]->value;
3233
if (!($arg instanceof \PhpParser\Node\Expr\ClassConstFetch)) {
33-
return $methodReflection->getReturnType();
34+
return ParametersAcceptorSelector::selectSingle($methodReflection->getVariants())->getReturnType();
3435
}
3536
$class = $arg->class;
3637

src/Type/ObjectStorageDynamicReturnTypeExtension.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use PHPStan\Type\ObjectType;
1010
use PHPStan\Type\Type;
1111
use PHPStan\Reflection\MethodReflection;
12+
use PHPStan\Reflection\ParametersAcceptorSelector;
1213
use PHPStan\Type\TypeCombinator;
1314
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
1415

@@ -52,6 +53,6 @@ public function getTypeFromMethodCall(
5253
}
5354
}
5455

55-
return $methodReflection->getReturnType();
56+
return ParametersAcceptorSelector::selectSingle($methodReflection->getVariants())->getReturnType();
5657
}
5758
}

src/Type/RepositoryDynamicReturnTypeExtension.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use PHPStan\Type\ObjectType;
1010
use PHPStan\Type\Type;
1111
use PHPStan\Reflection\MethodReflection;
12+
use PHPStan\Reflection\ParametersAcceptorSelector;
1213
use TYPO3\CMS\Core\Utility\ClassNamingUtility;
1314

1415
class RepositoryDynamicReturnTypeExtension implements DynamicMethodReturnTypeExtension
@@ -32,7 +33,7 @@ public function getTypeFromMethodCall(
3233
$variableType = $scope->getType($methodCall->var);
3334

3435
if (!($variableType instanceof ObjectType) || !is_subclass_of($variableType->getClassName(), $this->getClass())) {
35-
return $methodReflection->getReturnType();
36+
return ParametersAcceptorSelector::selectSingle($methodReflection->getVariants())->getReturnType();
3637
}
3738

3839
$modelName = ClassNamingUtility::translateRepositoryNameToModelName($variableType->getClassName());

0 commit comments

Comments
 (0)