? ? Pending

User tests: Successful: Unsuccessful:

avatar ditsuke
ditsuke
1 Jul 2021

Considering Joomla 4.0 requires a minimum PHP 7.2.5, it should be safe to add
type declarations supported by PHP >= 7.2.

Summary of Changes

This PR adds argument and return type declarations compatible with PHP >= 7.2
to src/Router. It also cleans up some phpdocs and inline comments,
and some more minor cleanup.

Testing Instructions

Test on PHP 7.2.5

Documentation Changes Required

None

avatar ditsuke ditsuke - open - 1 Jul 2021
avatar ditsuke ditsuke - change - 1 Jul 2021
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 1 Jul 2021
Category Libraries
avatar ditsuke
ditsuke - comment - 1 Jul 2021

@richard67 what do you think of this?

avatar brianteeman
brianteeman - comment - 1 Jul 2021

definitely can't be done in 4.0 at this late stage

avatar ditsuke
ditsuke - comment - 1 Jul 2021

definitely can't be done in 4.0 at this late stage

Would it be possible for 4.1?

avatar dgrammatiko
dgrammatiko - comment - 1 Jul 2021

definitely can't be done in 4.0 at this late stage

May I ask why? It's just type-hinting, the return or the arguments are already expected to be a specific type and this PR just forces what should have been the default

avatar wilsonge
wilsonge - comment - 1 Jul 2021

May I ask why? It's just type-hinting, the return or the arguments are already expected to be a specific type and this PR just forces what should have been the default

Because anyone with a custom router (i don't know if it's still the case but pretty sure e.g. kunena had at one point) will have a b/c break :( PHP throws static if you don't have the same type declaration in child classes.

avatar dgrammatiko
dgrammatiko - comment - 1 Jul 2021

The API part is brand new code so it could be done at least there

avatar wilsonge
wilsonge - comment - 1 Jul 2021

The API part is brand new code so it could be done at least there

Like I said there's php notices thrown if the parent class doesn't match with the child class. You can't just do it in the API. Has to be the parent Router class and all it's children or nothing. That's why adding in typehints across core is going to be so painful on the "old" pre-4.0 classes

avatar brianteeman
brianteeman - comment - 1 Jul 2021

... and why it cannot be done at this moment in time with a release caandidate

avatar RickR2H
RickR2H - comment - 8 Jul 2021

Should this be tested?

avatar ditsuke ditsuke - change - 31 Jan 2022
Labels Added: ? Conflicting Files
avatar ditsuke
ditsuke - comment - 31 Jan 2022

@Quy I've resolved the conflicts here

avatar HLeithner
HLeithner - comment - 27 Jun 2022

This pull request has automatically rebased to 4.2-dev.

avatar joomla-bot
joomla-bot - comment - 27 Jun 2022

This pull requests has been automatically converted to the PSR-12 coding standard.

avatar laoneo
laoneo - comment - 21 Oct 2022

I'm going to close this one as it is not possible to add typehinting to existing library classes, because it is not possible to have a transition period. It is an all or nothing backwards compatibility break. What you can do is to create new functions with the typehinted arguments and deprecate the old ones.

avatar laoneo laoneo - close - 21 Oct 2022
avatar laoneo laoneo - change - 21 Oct 2022
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2022-10-21 14:06:25
Closed_By laoneo
Labels Added: ? ?
Removed: ? Conflicting Files

Add a Comment

Login with GitHub to post a comment