Skip to content
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

[Issue] Cleanup: don't use void return value from method calls. #39524

Open
2 of 5 tasks
m2-assistant bot opened this issue Jan 7, 2025 · 4 comments · May be fixed by #39516
Open
2 of 5 tasks

[Issue] Cleanup: don't use void return value from method calls. #39524

m2-assistant bot opened this issue Jan 7, 2025 · 4 comments · May be fixed by #39516
Assignees
Labels
Area: Framework Component: Downloadable Component: Eav Component: Store Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: PR in progress Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch

Comments

@m2-assistant
Copy link

m2-assistant bot commented Jan 7, 2025

This issue is automatically created based on existing pull request: #39516: Cleanup: don't use void return value from method calls.


Description (*)

This is just some minor cleanup. Sometimes we called methods that didn't return anything (void) and then used that result value. Which is really not needed.

Found issues while running phpstan on level 0 on the entire codebase:

$ vendor/bin/phpstan analyse -c ./dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/phpstan.neon --level=0 . | grep -B3 'is used'
 20783/20783 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

  Line   app/code/Magento/Downloadable/Model/Product/TypeHandler/Link.php
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  84     Result of method Magento\Downloadable\Model\Product\TypeHandler\AbstractTypeHandler::clear() (void) is used.
--
 ------ -------------------------------------------------------------------------------------------------------
  Line   app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Group.php
 ------ -------------------------------------------------------------------------------------------------------
  164    Result of method Magento\Framework\Model\ResourceModel\Db\AbstractDb::saveNewObject() (void) is used.
  181    Result of method Magento\Framework\Model\ResourceModel\Db\AbstractDb::updateObject() (void) is used.
--
 ------ ----------------------------------------------------------------------------------------
  Line   app/code/Magento/Store/Block/Store/Switcher.php
 ------ ----------------------------------------------------------------------------------------
  70     Result of method Magento\Framework\View\Element\Template::_construct() (void) is used.
--
 ------ ----------------------------------------------------------------------------------
  Line   lib/internal/Magento/Framework/HTTP/Client/Socket.php
 ------ ----------------------------------------------------------------------------------
  423    Result of method Magento\Framework\HTTP\Client\Socket::doError() (void) is used.
  470    Result of method Magento\Framework\HTTP\Client\Socket::doError() (void) is used.

This is my ongoing effort on getting the entire Magento codebase clean so running phpstan on level 0 no longer gives any errors anymore (after this PR, we have about ~440 issues to go still ...)

Also see magento/magento2-page-builder#881

Related Pull Requests

magento/magento2-page-builder#881

Fixed Issues (if relevant)

N/A

Manual testing scenarios (*)

  1. In theory, nothing should change at runtime by the changes introduced here, not sure what needs to be tested except for the phpstan check ...
  2. If you do want to test the output of PHPstan, maybe best run it on app/code/Magento/Downloadable, app/code/Magento/Eav, app/code/Magento/Store & lib/internal/Magento/Framework/HTTP/ directories only, as running it on the entire codebase might take a very long time (multiple hours sometimes, depending on how strong your machine is) ...

Questions or comments

Check the first commit to see the real changes, the second commit deals with fixing static test failures.

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)
@m2-assistant m2-assistant bot added the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label Jan 7, 2025
@m2-assistant m2-assistant bot linked a pull request Jan 7, 2025 that will close this issue
6 tasks
@engcom-Hotel engcom-Hotel self-assigned this Jan 9, 2025
Copy link
Author

m2-assistant bot commented Jan 9, 2025

Hi @engcom-Hotel. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • 3. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
  • 4. Verify that the issue is reproducible on 2.4-develop branch
    Details- If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
  • 5. Add label Issue: Confirmed once verification is complete.
  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Hotel engcom-Hotel moved this to Ready for Development in High Priority Backlog Jan 9, 2025
@engcom-Hotel
Copy link
Contributor

Hello @hostep,

Thanks for the reporting and collaboration!

We are confirming this issue for further processing.

Thanks

@engcom-Hotel engcom-Hotel added Component: Downloadable Area: Framework Component: Eav Component: Store Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch labels Jan 9, 2025
@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.adobe.com/browse/AC-13664 is successfully created for this GitHub issue.

Copy link
Author

m2-assistant bot commented Jan 9, 2025

✅ Confirmed by @engcom-Hotel. Thank you for verifying the issue.
Issue Available: @engcom-Hotel, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Framework Component: Downloadable Component: Eav Component: Store Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: PR in progress Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch
Projects
Status: Ready for Development
Development

Successfully merging a pull request may close this issue.

3 participants