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

String will likely become a reserved word in PHP 7 #128

Closed
leedavis81 opened this issue Feb 17, 2015 · 2 comments · Fixed by #136
Closed

String will likely become a reserved word in PHP 7 #128

leedavis81 opened this issue Feb 17, 2015 · 2 comments · Fixed by #136

Comments

@leedavis81
Copy link

Although the whole Scalar Type Hint implementation is up in the air, it's very likely that string will become a reserved word in PHP 7: https://wiki.php.net/rfc/scalar_type_hints#reserve_for_future_use
For this reason it might be worth looking into using a different name for this class:

https://github.com/justinrainbow/json-schema/blob/master/src/JsonSchema/Constraints/String.php

Just a heads-up.

@dlaynes
Copy link

dlaynes commented Mar 18, 2015

The STH RFC was approved recently :)

Fatal error: "string" cannot be used as a class name in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/String.php on line 18

@suralc
Copy link

suralc commented Mar 18, 2015

@justinrainbow The RFC has been accepted. string, int, bool, float are now reserved. There is another rfc currently in voting to soft-reserve object (Not reserved immedeatly, but reserving it in 7.x will not be considered a BC break).

You might preserve BC by renaming the class and all its internal usages and conditionally alias (class_alias) it using it's old name on php < 7. And add a note that all projects depending on this class should use the new name if they want to be compatible with php7.

References:

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 a pull request may close this issue.

3 participants