-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Ray.Aop's new binding injector _setBindings #297
Changes from all commits
f490660
8b88357
0e8c15f
fa7111b
f8e3738
559e01e
47fc6f4
63a90ea
a9711b8
4ad4d5f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
parameters: | ||
ignoreErrors: | ||
- | ||
message: '#^Negated boolean expression is always false\.$#' | ||
identifier: booleanNot.alwaysFalse | ||
count: 1 | ||
path: src/di/AnnotatedClassMethods.php |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<files psalm-version="4.30.0@d0bc6e25d89f649e4f36a534f330f8bb4643dd69"> | ||
<file src="src/di/AnnotatedClassMethods.php"> | ||
<DocblockTypeContradiction occurrences="2"> | ||
<code>! $constructor</code> | ||
<code>$constructor</code> | ||
</DocblockTypeContradiction> | ||
</file> | ||
<file src="src/di/AspectBind.php"> | ||
<MixedArrayOffset occurrences="1"> | ||
<code>$instantiatedBindings[$methodName]</code> | ||
</MixedArrayOffset> | ||
<MixedAssignment occurrences="3"> | ||
<code>$interceptorClassName</code> | ||
<code>$interceptorClassNames</code> | ||
<code>$methodName</code> | ||
</MixedAssignment> | ||
<MixedReturnTypeCoercion occurrences="2"> | ||
<code>$instantiatedBindings</code> | ||
<code>array<non-empty-string, list<MethodInterceptor>></code> | ||
</MixedReturnTypeCoercion> | ||
</file> | ||
<file src="src/di/Dependency.php"> | ||
<InvalidArgument occurrences="1"> | ||
<code>$pointcuts</code> | ||
</InvalidArgument> | ||
</file> | ||
<file src="src/di/NewInstance.php"> | ||
<InvalidArgument occurrences="1"> | ||
<code>$this->bind->inject($container)</code> | ||
</InvalidArgument> | ||
</file> | ||
</files> |
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -42,7 +42,7 @@ public function to(string $interface, string $class): ReflectionClass | |||||||||
throw new InvalidType("[{$class}] is no implemented [{$interface}] interface"); | ||||||||||
} | ||||||||||
|
||||||||||
return new ReflectionClass($class); // @phpstan-ignore-line | ||||||||||
return new ReflectionClass($class); | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix type safety issue in return type. The method promises to return Apply this diff to fix the type safety issue: - return new ReflectionClass($class);
+ /** @var ReflectionClass<T> */
+ $reflectionClass = new ReflectionClass($class);
+ return $reflectionClass; 📝 Committable suggestion
Suggested change
🧰 Tools🪛 PHPStan (2.0.3)45-45: Method Ray\Di\BindValidator::to() should return Ray\Aop\ReflectionClass but returns Ray\Aop\ReflectionClass. (return.type) |
||||||||||
} | ||||||||||
|
||||||||||
/** | ||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Verify the stability implications of using dev version.
Using
^2.x-dev
for ray/aop could introduce instability. Consider using a stable version that supports _setBindings.🌐 Web query:
💡 Result:
The latest stable version of Ray.Aop that supports the
_setBindings
method is version 2.16 "Tanabata", as indicated by its release notes[10]. However, this version introduces significant API simplifications and shifts toward usingbind()
instead of_setBindings
for aspect configuration[1][10].Key points:
_setBindings
, as seen in Laravel integration examples requiringray/aop ^2.10.1
[4].bind()
method (demonstrated in examples[1]) replaces_setBindings
in modern implementations:For projects requiring
_setBindings
, use versions ≤2.15, but consider migrating tobind()
for future compatibility[10]. Always verify method availability in specific releases via official documentation[1][10].Citations:
Stable Dependency Recommendation: Update ray/aop Version
"ray/aop": "^2.x-dev"
poses a potential risk due to instability from a dev release._setBindings
method, note that while version 2.16 "Tanabata" is the latest stable release, it shifts to usingbind()
, which may introduce breaking API changes._setBindings
, consider pinning the dependency to a stable version prior to 2.16 (e.g.,^2.15.0
or an earlier 2.x release)._setBindings
to the newbind()
method as per the API changes in 2.16.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@coderabbitai The next version still not released.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@koriym Understood, thank you for the clarification about the unreleased version.
✏️ Learnings added