-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Routing] Add type-hints RequestContext and Route classes. #32181
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
Conversation
6a69605
to
cece78c
Compare
cece78c
to
d321a1a
Compare
*/ | ||
public function mount($prefix, self $builder) | ||
public function mount(string $prefix, self $builder) |
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.
prefix is a string here but could also be null in
public function import($resource, ?string $prefix = '/', string $type = null) |
but the prefix handling in this class seems strange anyway.
mount
will make the prefix an empty string when prefix is /
(the default). but in if (null !== $this->prefix) { |
''
instead.
but I would ask you to not add types in RouteCollectionBuilder because I proposed to deprecate it in #32240
this way we can merge this now and decide later if we need to worry about all those edge-cases
…rrabus) This PR was merged into the 4.4 branch. Discussion ---------- [Routing] Deprecate RouteCollection::addPrefix(null) | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | #32179 | License | MIT | Doc PR | N/A This PR deprecates the undocumented possibility to pass `null` as prefix to `RouteCollection::addPrefix()`. This allows us to add a `string` type-hint on the parameter in 5.0, see #32181 (comment) /cc @Tobion Commits ------- 2a88752 [Routing] Deprecate RouteCollection::addPrefix(null).
Please rebase, remove deprecations and revert RouteCollectionBuilder |
d321a1a
to
bb0725f
Compare
bb0725f
to
614e824
Compare
Done. |
Thanks Alexander. |
…s. (derrabus) This PR was merged into the 5.0-dev branch. Discussion ---------- [Routing] Add type-hints RequestContext and Route classes. | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #32179 | License | MIT | Doc PR | N/A This PR adds type-hints to `RequestContext` and the Route classes to give them a more php7-like feeling. Adding these type-hints on master should not be a breaking change because we require php 7.2 there, which allows downstream classes/interfaces to remove a type-hint from a method signature. Commits ------- 614e824 [Routing] Add type-hints RequestContext and Route classes.
This PR adds type-hints to
RequestContext
and the Route classes to give them a more php7-like feeling. Adding these type-hints on master should not be a breaking change because we require php 7.2 there, which allows downstream classes/interfaces to remove a type-hint from a method signature.