Skip to content

Stop instanciating an object to check its class name. #290

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

Merged
merged 1 commit into from
Feb 9, 2020

Conversation

niconoe-
Copy link
Contributor

@niconoe- niconoe- commented Feb 6, 2020

Fixes #246
When set on master, where PHP 5.3 is not maintained anymore, this could be a little bit improved.

I did not use is_a because of the function call (not good for performance) and I did not use instanceof neither because $class is a string, not an object. We are actually comparing 2 strings, so let's just compare 2 strings...

I'm aware it has not the exact same behavior in case of $class is a string evaluated to a class name of a child of FunctionCall class, but it appears that FunctionCall has no children, so the misbehavior here is not applicable.

@codecov
Copy link

codecov bot commented Feb 6, 2020

Codecov Report

Merging #290 into QA will not change coverage.
The diff coverage is 100%.

@@          Coverage Diff          @@
##               QA   #290   +/-   ##
=====================================
  Coverage     100%   100%           
+ Complexity   1865   1864    -1     
=====================================
  Files          63     63           
  Lines        4527   4527           
=====================================
  Hits         4527   4527

@williamdes williamdes self-assigned this Feb 9, 2020
@williamdes williamdes added this to the 4.5.1 milestone Feb 9, 2020
williamdes added a commit that referenced this pull request Feb 9, 2020
williamdes added a commit that referenced this pull request Feb 9, 2020
Signed-off-by: William Desportes <[email protected]>
@williamdes williamdes merged commit be2f4da into phpmyadmin:QA Feb 9, 2020
@williamdes williamdes linked an issue Feb 9, 2020 that may be closed by this pull request
@williamdes
Copy link
Member

Thank you @niconoe- for this fix !

@niconoe- niconoe- deleted the fix-246 branch February 27, 2023 14:51
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.

Use is_a() instead of creating an object to check for its class
2 participants