Skip to content

Commit f88ab09

Browse files
staabmclxmstaab
andauthored
Remove unnecessary ParametersAcceptorSelector::selectSingle handling (#9)
* Remove unnecessary `ParametersAcceptorSelector::selectSingle` handling * Update composer.json * update class-leak * class-leak skip TypeExtenion classes * Update composer.json * Update composer.json --------- Co-authored-by: Markus Staab <[email protected]>
1 parent 5eb198b commit f88ab09

File tree

5 files changed

+7
-9
lines changed

5 files changed

+7
-9
lines changed

.github/workflows/code_analysis.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838

3939
-
4040
name: 'Check Active Classes'
41-
run: vendor/bin/class-leak check src --ansi
41+
run: vendor/bin/class-leak check src --ansi --skip-suffix "TypeExtension"
4242

4343
name: ${{ matrix.actions.name }}
4444
runs-on: ubuntu-latest

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
"illuminate/container": "^10.39",
1212
"phpstan/extension-installer": "^1.3",
1313
"phpunit/phpunit": "^10.3",
14-
"rector/rector": "^0.18",
14+
"rector/rector": "^1.2",
1515
"symfony/dependency-injection": "^6.4",
1616
"symfony/finder": "^6.2",
1717
"symplify/easy-coding-standard": "^12.0",
1818
"symplify/phpstan-rules": "^12.4",
19-
"tomasvotruba/class-leak": "^0.2",
19+
"tomasvotruba/class-leak": "^1.1.2",
2020
"tracy/tracy": "^2.9"
2121
},
2222
"autoload": {

src/TypeExtension/MethodCall/ContainerGetReturnTypeExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function getTypeFromMethodCall(
3838
MethodReflection $methodReflection,
3939
MethodCall $methodCall,
4040
Scope $scope
41-
): Type {
41+
): ?Type {
4242
return $this->classConstFetchReturnTypeResolver->resolve($methodReflection, $methodCall);
4343
}
4444
}

src/TypeExtension/MethodCall/LaravelContainerMakeTypeExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function getTypeFromMethodCall(
3636
MethodReflection $methodReflection,
3737
MethodCall $methodCall,
3838
Scope $scope
39-
): Type {
39+
): ?Type {
4040
return $this->classConstFetchReturnTypeResolver->resolve($methodReflection, $methodCall);
4141
}
4242
}

src/TypeResolver/ClassConstFetchReturnTypeResolver.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@
1818

1919
final class ClassConstFetchReturnTypeResolver
2020
{
21-
public function resolve(MethodReflection $methodReflection, MethodCall $methodCall): Type
21+
public function resolve(MethodReflection $methodReflection, MethodCall $methodCall): ?Type
2222
{
23-
$returnType = ParametersAcceptorSelector::selectSingle($methodReflection->getVariants())->getReturnType();
24-
2523
if (! isset($methodCall->args[0])) {
2624
throw new ShouldNotHappenException('Not supported without argument');
2725
}
@@ -45,6 +43,6 @@ public function resolve(MethodReflection $methodReflection, MethodCall $methodCa
4543
return new ObjectType($className);
4644
}
4745

48-
return $returnType;
46+
return null;
4947
}
5048
}

0 commit comments

Comments
 (0)