-
-
Notifications
You must be signed in to change notification settings - Fork 453
PhpStan: fix wrong params for strlen
#5070
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
Conversation
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.
Pull Request Overview
This pull request improves code quality by addressing PHPStan static analysis issues and enhancing variable naming conventions. The changes focus on making the codebase more maintainable and type-safe.
- Renamed ambiguous single-letter and unclear variable names to descriptive alternatives (e.g.,
$a/$b→$nodeA/$nodeB,$x/$y→$xAxis/$yAxis,$i→$index) - Fixed type casting issues for
strlen()function calls that were passing non-string values - Added missing
@throwsannotations to method docblocks for better API documentation - Removed unused variable declarations (
$font,$pageY) - Fixed incorrect condition logic (
strlen(!$serviceAreaCode)→!strlen($serviceAreaCode))
Reviewed Changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/Varien/Simplexml/Element.php | Improved variable naming in loops and XML parsing logic; updated return type documentation |
| app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf/PageBuilder.php | Renamed coordinate variables for clarity; removed unused variables; fixed logic bug; added exception documentation |
| app/code/core/Mage/Cms/Model/Wysiwyg/Images/Storage.php | Fixed docblock formatting |
| app/code/core/Mage/Catalog/Model/Layer/Filter/Price.php | Improved loop variable naming; fixed type casting for strlen; added exception documentation; repositioned deprecated tags |
| app/code/core/Mage/Catalog/Model/Layer/Filter/Decimal.php | Fixed type casting for strlen; added exception documentation |
| app/code/core/Mage/Api/Model/Server/Wsi/Handler.php | Added missing exception documentation |
| .phpstan.dist.baseline.neon | Removed resolved PHPStan errors from baseline |
Comments suppressed due to low confidence (1)
app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf/PageBuilder.php:310
- [nitpick] The variable
$pageYis used in the_drawSenderAddressmethod but wasn't renamed to follow the naming convention established by the PR. For consistency with other changes in this file where$ywas renamed to$yAxis, this variable should be renamed to$yPageAxisor similar.
if (strlen($lines[0]) > 28) {
$firstLine = array_shift($lines);
$pageY = $this->_page->drawLines([$firstLine], $this->_x(25), $this->_y(42), 28);
$this->_page->drawText($phoneNumber, $this->_x(103), $this->_y(42));
} else {
$pageY = $this->_y(42);
|
Merge w/o review. Should be safe. |
|



... added some Docs, renamed some short vars.