-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
Support Attributes #194
Support Attributes #194
Conversation
xepozz
commented
Mar 21, 2023
•
edited
Loading
edited
Q | A |
---|---|
Is bugfix? | ❌ |
New feature? | ✔️ |
Breaks BC? | ✔️ |
Fixed issues | #179 #193 |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #194 +/- ##
============================================
- Coverage 97.57% 95.26% -2.32%
+ Complexity 139 137 -2
============================================
Files 9 9
Lines 413 422 +9
============================================
- Hits 403 402 -1
- Misses 10 20 +10
☔ View full report in Codecov by Sentry. |
Need docs and additional tests. |
|
||
Only two properties are required: `methods` and `pattern`. The rest properties are optional. | ||
|
||
> Parsing attributes is up to user. The package does not provide a solution for parsing and constructing routes tree. |
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.
Need to link to the guide on how to achieve colleccting attributes or to describe it right here.
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.
We don't have any attributes collectors. I'll add it later if we merge this example
Overall I like it 👍 |
} | ||
|
||
private function buildDispatcher( | ||
?MiddlewareDispatcher $dispatcher, |
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.
?MiddlewareDispatcher $dispatcher, | |
MiddlewareDispatcher $dispatcher, |
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 dispatcher is nullable
if ($dispatcher === null) { | ||
throw new RuntimeException(sprintf('There is no dispatcher in the route %s.', $route->getData('name'))); | ||
} | ||
|
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.
if ($dispatcher === null) { | |
throw new RuntimeException(sprintf('There is no dispatcher in the route %s.', $route->getData('name'))); | |
} |
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.
?
if ($this->dispatcher !== null && !$this->route->getData('hasDispatcher')) { | ||
$this->route->injectDispatcher($this->dispatcher); | ||
if ($dispatcher->hasMiddlewares()) { | ||
return $dispatcher; |
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.
Router
pass middlware dispatcher to MatchingResult
and this dispatcher almost always contain middlewares. In this case route middlewares will not work.
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.
I don't understand what you are saying
See #196 |
Closed in favor of #196 |