-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
Add attributes support & improve MatchingResult
#196
base: master
Are you sure you want to change the base?
Conversation
PR Summary
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #196 +/- ##
============================================
+ Coverage 78.66% 83.72% +5.05%
- Complexity 188 228 +40
============================================
Files 13 23 +10
Lines 586 762 +176
============================================
+ Hits 461 638 +177
+ Misses 125 124 -1
☔ View full report in Codecov by Sentry. |
MatchingResult
* Add routes via resource + attributes * Apply fixes from StyleCI * Apply Rector changes (CI) * Fix psalm * Add missing file * Apply fixes from StyleCI * Rename Resource to Provider, add more tests * Apply fixes from StyleCI * Increase coverage * Apply fixes from StyleCI * Use variadic --------- Co-authored-by: StyleCI Bot <[email protected]> Co-authored-by: rustamwin <[email protected]>
tests/RouteTest.php
Outdated
->middleware(TestMiddleware1::class) | ||
->action(static fn () => new Response(200)); | ||
|
||
$builtMiddlewares = $route->getData('builtMiddlewares'); |
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.
Due to the PR is going to raise the major version of package let's remove getData
to regular getter?
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.
Due to the PR is going to raise the major version of package let's remove
getData
to regular getter?
Rename getData()
to get()
or create separate getters?
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.
The second option
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.
This is very non-comfortable when configre routes. IDE suggestions will get in the way in application, but getters in most cases need into packages only.
MiddlewareDispatcher $dispatcher = null | ||
): self { | ||
return new self($prefix, $dispatcher); | ||
public static function create(?string $prefix = null): self |
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.
How about to eliminate this?
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.
Create group via new Group
is non-comfortable in application configuration.
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.
Most case of usage groups required chain calls.
- Now:
Group::create('/xxx')->...
- Your suggestion:
(new Group('/xxx'))->...
Brackets in second way is non-comfortable =)
@@ -86,6 +72,9 @@ public function methods(): array | |||
return $this->methods; | |||
} | |||
|
|||
/** | |||
* @psalm-assert-if-true !null $this->route |
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.
Why is it needed?
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.
Without this assertion psalm occurs PossiblyNullReference
error.
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.
It shouldn't because there is check for null in the function body 😕
TODO: move collector to https://github.com/yiisoft/router-composer-attribute-collector |
ℹ️ yiisoft/demo#589