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

add phpstan-deprecation-rules #36148

Open
wants to merge 7 commits into
base: 2.4-develop
Choose a base branch
from

Conversation

rogerdz
Copy link
Contributor

@rogerdz rogerdz commented Sep 15, 2022

Description (*)

Static Tests: add phpstan/phpstan-deprecation-rules for detecting usage of deprecated classes, methods, properties, constants and traits.

Related Pull Requests

Manual testing scenarios (*)

  1. ...
  2. ...

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)

Resolved issues:

  1. resolves [Issue] add phpstan-deprecation-rules #36157: add phpstan-deprecation-rules

@m2-assistant
Copy link

m2-assistant bot commented Sep 15, 2022

Hi @rogerdz. Thank you for your contribution
Here are some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names. Allowed build names are:

  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE,
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests
  13. Semantic Version Checker

You can find more information about the builds here

ℹ️ Run only required test builds during development. Run all test builds before sending your pull request for review.

For more details, review the Magento Contributor Guide documentation.

⚠️ According to the Magento Contribution requirements, all Pull Requests must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@rogerdz
Copy link
Contributor Author

rogerdz commented Sep 15, 2022

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@edenduong
Copy link
Contributor

@magento create issue

Copy link
Contributor

@edenduong edenduong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @rogerdz ,
Thank you for your contribution !
I think it is good to add this rule to static test.

@edenduong edenduong added Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests Progress: pending review and removed Progress: ready for testing labels Sep 19, 2022
@engcom-Hotel engcom-Hotel added the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label Sep 20, 2022
@engcom-Lima
Copy link
Contributor

@magento run Functional Tests EE

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@engcom-Echo
Copy link
Contributor

Hi @rogerdz,

We have verify the package is installed correctly.
image

But while verifying changes no warning is shown if deprecated function/class is being used.
please refer to below screen shot and suggest if we are missing any steps here.

Before PR

we have checked using php vendor/bin/phpcs --standard=Magento2 to see if file contains any deprecated function/class.
when we are using vendor/bin/phpstan analyse on same file no warning is shown.
image

After PR

No changes are seen when we are using vendor/bin/phpstan analyse on same file
image

Please let us know if we are missing any steps here or any other way to verify changes.

@rogerdz
Copy link
Contributor Author

rogerdz commented Dec 4, 2022

Hi @engcom-Echo , right command is : vendor/bin/phpstan analyse --configuration dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/phpstan.neon --level 1 --memory-limit=4G --error-format=filtered app/code/Magento/BundleSampleData/Model/Product.php
2022-12-04_22-39

@engcom-Lima
Copy link
Contributor

✔️ QA Passed

Preconditions:

  • Install fresh Magento 2.4-develop and PHP 8.1

Manual testing scenario:

  • Run vendor/bin/phpstan analyse --configuration dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/phpstan.neon --level 1 --memory-limit=4G --error-format=filtered app/code/Magento/Dhl/Model/Carrier.php
  • Run vendor/bin/phpstan analyse --configuration dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/phpstan.neon --level 1 --memory-limit=4G --error-format=filtered /opt/homebrew/var/www/magento2/app/code/Magento/Bundle/Model/Selection.php
  • Verify the error in the terminal about the deprecated function/method.

Before: ✖️ Command was running successfully.
Screenshot 2023-09-12 at 12 23 07 PM

After: ✔️

Screenshot 2023-09-12 at 12 32 33 PM Screenshot 2023-09-12 at 12 41 18 PM

Builds are failed. Hence, moving this PR to Extended Testing.

@engcom-Echo
Copy link
Contributor

@magento run Functional Tests EE,Functional Tests CE

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

@engcom-Echo
Copy link
Contributor

Integration Tests are known failure.
Functional Tests CE failure are different on last two run on same commit other than known failure AdminCreatePartialShipmentForOrderWithConfigurableProductFromCustomSourceTest

Run1
Screenshot 2023-09-13 at 1 05 59 PM

Run2
Screenshot 2023-09-13 at 1 06 10 PM

Hence moving it to merge in progress

@engcom-November
Copy link
Contributor

@magento run all tests

@engcom-November
Copy link
Contributor

Merge conflicts has been resolved and 2.4-dev has been merged into the fix branch in this commit : e23f9d8

phpstan-deprecation-rules has been updated to 1.2.1 in this commit : 9e36666

@engcom-November engcom-November self-assigned this Sep 27, 2024
@engcom-November
Copy link
Contributor

@magento run all tests

@engcom-November
Copy link
Contributor

@magento run Functional Tests B2B, Functional Tests EE, Unit Tests

@engcom-November
Copy link
Contributor

There are no repeating failures in Functional Tests B2B.

Functional Tests B2B:
Run 1:
image

Run 2:
image

Hence moving this to Merge in progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: accept Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it
Projects
Status: Merge in Progress
Development

Successfully merging this pull request may close these issues.

[Issue] add phpstan-deprecation-rules
10 participants