Skip to content

[Issue] Small cleanup, removed duplicated keys from array #39851

Open
@m2-assistant

Description

@m2-assistant

This issue is automatically created based on existing pull request: #39844: Small cleanup, removed duplicated keys from array


Description (*)

The constants ColumnResolver::COLUMN_WEIGHT and ColumnResolver::COLUMN_WEIGHT_DESTINATION both have the same value 'Weight (and above)'

So adding those both to an array as key makes no sense.

I assume one of both was added at a later point (probably in Magento1 times) and it was forgotten to cleanup the old one.

So that's what I'm doing here. I've left both constants in place just in case somebody does use both of them. But using both in the Magento codebase makes no sense.

It's another effort in trying to get phpstan to run on level 0 on the entire codebase without errors. This only fixes 2 small warnings, but it's a small step forward nonetheless.

Related Pull Requests

Fixed Issues (if relevant)

N/A

Manual testing scenarios (*)

  1. Run phpstan analysis:
$ ./vendor/bin/phpstan analyse --level=0 -c dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/phpstan.neon app/code/Magento/ | grep 'duplicate keys'
 14491/14491 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

  26     Array has 2 duplicate keys with value 'Weight (and above)' (\Magento\OfflineShipping\Model\ResourceModel\Carrier\Tablerate\CSV\ColumnResolver::COLUMN_WEIGHT,
  91     Array has 2 duplicate keys with value 'Weight (and above)' (\Magento\OfflineShipping\Model\ResourceModel\Carrier\Tablerate\CSV\ColumnResolver::COLUMN_WEIGHT,
  1. Expected is no errors

Questions or comments

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

No one assigned

    Labels

    Issue: ready for confirmationPriority: P3May be fixed according to the position in the backlog.Reported on 2.4.xIndicates original Magento version for the Issue report.Triage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

    Type

    No type

    Projects

    Status

    Ready for Development

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions