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

Replace Hungarian notation with PHP type delarations #35

Open
Rumperuu opened this issue Feb 23, 2021 · 3 comments · May be fixed by #191
Open

Replace Hungarian notation with PHP type delarations #35

Rumperuu opened this issue Feb 23, 2021 · 3 comments · May be fixed by #191
Assignees
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers security Anything with security implications
Milestone

Comments

@Rumperuu
Copy link
Collaborator

Rumperuu commented Feb 23, 2021

Currently, variables are named using Hungarian notation (e.g., $l_str_foo). This is both harder to read and provides no programmatic type guarantees (as as variable with $l_str in the name can just as easily be assigned any type of value, not just a string).

This should be refactored to use the type declarations introduced in PHP 7, ensuring that errors will be thrown if implicit type coercion is detected.

Note: I'm not sure if WP Plugins have to target a specific version of PHP, in which case we may not have access to type declarations

Related: #36

@Rumperuu Rumperuu added documentation Improvements or additions to documentation good first issue Good for newcomers security Anything with security implications labels Feb 23, 2021
@Rumperuu Rumperuu added invalid This doesn't seem right and removed invalid This doesn't seem right labels Feb 23, 2021
@Rumperuu
Copy link
Collaborator Author

@lolzim
Copy link
Contributor

lolzim commented Mar 12, 2021

According to WP, 9 months ago 25% of WP was running on PHP 5.x:

image

I have no 5.6 instance but those that have updated Wordpress as far as possible should now see a huge warning saying something like "Get a decent PHP version NOW".
And recent WP release should not install/update on 5.6; from what I know 7.2 is teh minimal PHP version for current WP version.

That said, yes, this notation sucks.

Rumperuu added a commit that referenced this issue Apr 14, 2021
Renames the current production flag variable to be shorter,
non-Hungarian (presaging changes to come in #35) and not specifically
CSS_-related.

See #80
@markcheret markcheret added this to the 2.7.1 milestone Apr 16, 2021
@markcheret
Copy link
Owner

we currently have PHP 7.0 as required. It sounds reasonable to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers security Anything with security implications
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants