Skip to content

[Issue] Fixes incorrectly cased namespace usages. #38640

Open
@m2-assistant

Description

@m2-assistant

This issue is automatically created based on existing pull request: #37574: Fixes incorrectly cased namespace usages.


Description (*)

While playing around with phpstan on level 0 on the Magento codebase, these problems showed up (among many others, but those are for another day)

$ vendor/bin/phpstan analyse --level=0 lib | grep 'referenced with incorrect case'
 3929/3929 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

  10     Class Magento\Framework\DB\Select referenced with incorrect case: Magento\Framework\Db\Select.

$ vendor/bin/phpstan analyse --level=0 app/code/Magento | grep 'referenced with incorrect case'
 14097/14097 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

  116    Class Magento\GiftMessage\Model\Save referenced with incorrect case: Magento\Giftmessage\Model\Save.
  12     Class Magento\Sales\Model\Order\Creditmemo\Item referenced with incorrect case: Magento\Sales\Model\Order\CreditMemo\Item.
  28     Class Magento\Framework\DB\Select referenced with incorrect case: Magento\Framework\Db\Select.
  9      Class Magento\Sales\Model\Order\Creditmemo\Item referenced with incorrect case: Magento\Sales\Model\Order\CreditMemo\Item.

This PR fixes these.
I don't think these caused real issues, I think composer's autoloader is gracefully enough to load those incorrectly cased namespaces, but let's make them correct anyways.

Related Pull Requests

Fixed Issues (if relevant)

Manual testing scenarios (*)

  1. Run vendor/bin/phpstan analyse --level=0 {some-path} | grep 'referenced with incorrect case' on all Magento code, it should not output anything (don't run this on the root the M2 codebase, otherwise it will take hours and might crash your computer if you don't have at least 32 GB of memory)
  2. Test all affected code and make sure that everything keeps working as expected (I'm assuming the automated tests will take care of this)

Questions or comments

I might fix (static) test failures if they don't turn out to be too complex to handle, but won't write new automated tests, because I think that's not relevant in scope of this PR.

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)

Metadata

Metadata

Assignees

Labels

Area: FrameworkComponent: Framework/CodeIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: PR in progressReported on 2.4.xIndicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions