Skip to content
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

[5.6] Change Resource name away from soft-reserved name #22969

Merged
merged 1 commit into from
Feb 1, 2018
Merged

[5.6] Change Resource name away from soft-reserved name #22969

merged 1 commit into from
Feb 1, 2018

Conversation

laurencei
Copy link
Contributor

@laurencei laurencei commented Jan 31, 2018

This is an issue that was identified by @joshuanoyes in an Internals post here: laravel/ideas#966

Essentially Resource is actually a soft-reserved name by PHP and its use is "highly discouraged" as documented here: http://php.net/manual/en/reserved.other-reserved-words.php

So at the moment there is no issue. Laravel 5.6 will run happily on PHP7.2.

The problem is, at short notice, an RFC might be added to PHP that includes the use of Resource, switching it to a full reserved name. If/when that occurs, 5.6 will stop working and will not be compatible with that new PHP version, effectively providing an artificial upper ceiling on what PHP version it can run on.

Unlike some of the backporting we did to allow older versions of Laravel to run on PHP7.2 with the count() issue; this fix would be a "breaking change", so you wouldnt really be able to fix it in any older versions (unless you allow a breaking change on a point release which will send Reddit into meltdown).

So I think the best option is just do the change now, place it as part of the 5.6 upgrade guide - especially while it is still a relavitely new feature and not in heavy use, and avoid any future issues.

Otherwise we leave it as is - and risk problems in the future that will be more difficult to resolve (especially if the feature is used more often).

p.s. this doesnt solve the issue for 5.5 which has LTS - so that might be affected by this at a later stage. But I guess we can cross that bridge if we come to it.

@mfn
Copy link
Contributor

mfn commented Feb 1, 2018

Breaking change into the 5.6 upgrade guide and we're good IMHO 😄

@JosephSilber
Copy link
Member

I believe only the lowercase version of resource is reserved. I don't think Resource is a soft-reserved name.

@laurencei
Copy link
Contributor Author

laurencei commented Feb 1, 2018 via email

@taylorotwell taylorotwell merged commit 9229e95 into laravel:5.6 Feb 1, 2018
@taylorotwell
Copy link
Member

Added Resource extends JsonResource so it's just a deprecation instead of a hard-break. Fixed stub you forgot to update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants