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

Cleanup: don't use void return value from method calls. #881

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

hostep
Copy link
Contributor

@hostep hostep commented Dec 31, 2024

Description (*)

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

Found issue 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   ext/magento/magento2-page-builder/app/code/Magento/PageBuilder/Controller/Adminhtml/Stage/Render.php
 ------ ------------------------------------------------------------------------------------------------------
  39     Result of method Magento\Backend\App\AbstractAction::__construct() (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 this related PR: magento/magento2#39516

Story

?

Bug

?

Task

?

Fixed Issues (if relevant)

N/A

Builds

?

Related Pull Requests

magento/magento2#39516

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 ext/magento/magento2-page-builder/ directory only, as running it on the entire Magento 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.

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)

Resolved issues:

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

@hostep
Copy link
Contributor Author

hostep commented Dec 31, 2024

@magento run all tests

@engcom-Hotel engcom-Hotel self-requested a review January 6, 2025 11:26
@engcom-Hotel
Copy link
Collaborator

@magento create issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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