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

PHP 7 Reserved Keywords Clash #1

Open
chestnutcase opened this issue Apr 19, 2018 · 0 comments
Open

PHP 7 Reserved Keywords Clash #1

chestnutcase opened this issue Apr 19, 2018 · 0 comments

Comments

@chestnutcase
Copy link

chestnutcase commented Apr 19, 2018

Good day.

Your classnames for types (PHPAST\Integer, PHPAST\Float etc) clashes with reserved keywords in PHP 7.

Attempting to load your library in your provided examples will result in the following:

Fatal error: Cannot use 'Float' as class name as it is reserved in /project/vendor/flaviovs/phpast/src/core/types.php on line 42

From the PHP manual,

The following words cannot be used to name a class, interface or trait, and they are also prohibited from being used in namespaces.

float (as of PHP 7)

I suggest suffixing your classnames with something like Token or Type, so your classes become FloatToken or FloatType to get around this issue.

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

No branches or pull requests

1 participant