Skip to content

Commit 66d5028

Browse files
committed
Fix some minor phpstan issues, reported in builds
1 parent 3b9c486 commit 66d5028

File tree

5 files changed

+3
-7
lines changed

5 files changed

+3
-7
lines changed

src/Aop/Framework/AbstractInterceptor.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ public static function unserializeAdvice(array $adviceData): Closure
101101
$aspect = AspectKernel::getInstance()->getContainer()->getService($aspectName);
102102
$advice = (new ReflectionMethod($aspectName, $methodName))->getClosure($aspect);
103103

104-
assert(isset($advice), 'getClosure() can not be null on modern PHP versions');
105104
self::$localAdvicesCache["$aspectName->$methodName"] = $advice;
106105
}
107106

src/Aop/Framework/ClassFieldAccess.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ final class ClassFieldAccess extends AbstractJoinpoint implements FieldAccess
2626
/**
2727
* Stack frames to work with recursive calls or with cross-calls inside object
2828
*
29-
* @phpstan-var array<int, array{object, FieldAccessType, mixed, mixed}>>
29+
* @phpstan-var array<int, array{object, FieldAccessType, mixed, mixed}>
3030
*/
3131
private array $stackFrames = [];
3232

src/Aop/Framework/DynamicClosureMethodInvocation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function proceed(): mixed
6464
// Rebind the closure if instance was changed since last time
6565
// This code won't work with {@see Closure::call()} as it fails to rebind closure created from method
6666
if ($this->closureInstance !== $this->instance) {
67-
$this->closureToCall = $this->closureToCall?->bindTo($this->instance, $this->reflectionMethod->class);
67+
$this->closureToCall = $this->closureToCall->bindTo($this->instance, $this->reflectionMethod->class);
6868
$this->closureInstance = $this->instance;
6969
}
7070

src/Core/AttributeAspectLoaderExtension.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,7 @@ protected function getAdvice(
7070
Aspect $aspect,
7171
ReflectionMethod $aspectMethod
7272
): Interceptor {
73-
$adviceCallback = $aspectMethod->getClosure($aspect);
74-
assert($adviceCallback instanceof Closure, "getClosure should always return Closure");
75-
73+
$adviceCallback = $aspectMethod->getClosure($aspect);
7674
$adviceOrder = $interceptorAttribute->order;
7775
$pointcutExpression = $interceptorAttribute->expression;
7876
return match (true) {

src/Proxy/Part/InterceptedConstructorGenerator.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ public function __construct(
5858
} else {
5959
$constructorGenerator = new MethodGenerator('__construct', [], [], $constructorBody);
6060
}
61-
assert($constructorGenerator !== null, "Constructor generator should be initialized");
6261
$this->constructorGenerator = $constructorGenerator;
6362
}
6463

0 commit comments

Comments
 (0)