-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Quality Assurance > The use of function sizeof() is discouraged; use count() instead #25226
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
Quality Assurance > The use of function sizeof() is discouraged; use count() instead #25226
Conversation
Hi @lfluvisotto. Thank you for your contribution
For more details, please, review the Magento Contributor Guide documentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @lfluvisotto,
Your changes looks good, however in files that you’ve changed we have failing static tests. Could you review and fix static tests failures?
This is my contribution to solving a part of this Static Tests problem. Several pull requests from other contributors are not going through Static Tests because the legacy code is not covered by php code sniffer + magento standard coding. I intend to fix the other violations in other pull requests with specific scopes so as not to get all mixed up and confused. |
Hi @lfluvisotto, Some pieces could be just ignored if it requires refactoring Thank you! |
12a93f3
to
0ed4fcb
Compare
0ed4fcb
to
60e77f0
Compare
@magento run all tests |
Hi @VladimirZaets, thank you for the review. |
@magento run all tests |
✔️ QA Passed |
…ouraged; use count() instead #25226
Hi @lfluvisotto, thank you for your contribution! |
$params = array_merge($action['url']['params'], $params); | ||
$params[] = $action['url']['params']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my opinion - this line introduces the bug, as previously you had:
$action['url']['params'] = ['a' => 'A', 'b' => 'B'];
$params = ['x' => 'X'];
$params = array_merge($action['url']['params'], $params);
resulted in having keys a
, b
and x
.
The new approach results in:
'x' => 'X',
[
'a' => 'A',
'b' => 'B'
]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! Could you create Pull request for that?
Quality Assurance > The use of function sizeof() is discouraged; use count() instead
Description (*)
According to PHP Code Sniffer + Magento Coding Standard
https://github.com/squizlabs/PHP_CodeSniffer/blob/ae3aae46a11e3978f088552160ccca13a01b28e1/src/Standards/Generic/Sniffs/PHP/ForbiddenFunctionsSniff.php#L30
Discourages the use of alias functions. Alias functions are kept in PHP for compatibility with older versions. Can be used to forbid the use of any function.
Fixed Issues (if relevant)
N/A
Manual testing scenarios (*)
N/A
Questions or comments
N/A
Contribution checklist (*)