-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Closed
Labels
Area: FrameworkComponent: StaticTestIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is 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.A defect with this priority could have functionality issues which are not to expectations.Progress: doneReported on 2.4.xIndicates original Magento version for the Issue report.Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchThe issue has been reproduced on latest 2.4-develop branchTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject itIssue related to Developer Experience and needs help with Triage to Confirm or Reject it
Description
This issue is automatically created based on existing pull request: #38439: Fix PHPDocs for \Magento\Framework\Data\Collection::getItemById
Add null as possible type returned by getItemById
method.
Method returns null when item is not found.
PHPStan complains in the code using that method:
Sample usage:
$product = $productCollection->getItemById(42);
if ($product) { # phpstan: If condition is always true.
// some logic
}
Description (*)
Adds null
type to PHPDocs of \Magento\Framework\Data\Collection::getItemById
.
Fixes minor grammar issues in PHPDocs of that class.
Related Pull Requests
Fixed Issues (if relevant)
Manual testing scenarios (*)
- Create a module that uses any Collection and add code which reflects
if
condition specified in the PR summary - Configure PHPStan with enabled
Treat PHPDoc types as certain
(usually it is enabled by default) - Run static analysis (or open file in IDE with static analysis capabilities such as PHPStorm)
- There should be no warning/error
if condition is always true
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
Labels
Area: FrameworkComponent: StaticTestIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is 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.A defect with this priority could have functionality issues which are not to expectations.Progress: doneReported on 2.4.xIndicates original Magento version for the Issue report.Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchThe issue has been reproduced on latest 2.4-develop branchTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject itIssue related to Developer Experience and needs help with Triage to Confirm or Reject it
Type
Projects
Status
Done