Skip to content

Update phpcpd to ~6.0.3 to be PHP8 compatible #32196

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

Merged

Conversation

hws47a
Copy link
Contributor

@hws47a hws47a commented Feb 16, 2021

Description (*)

Update phpcpd to ~6.0.3 with minimal changes to other dependencies including update phpunit/php-timer from ^3.0 to ^5.0 and phpunit from 9.1 to 9.2

Changes included:

  - Updating phpunit/php-timer (3.1.4 => 5.0.3)
  - Installing sebastian/cli-parser (1.0.1)
  - Updating sebastian/phpcpd (5.0.2 => 6.0.3)
  - Updating phpunit/phpunit (9.1.5 => 9.2.6)

Related Pull Requests

https://github.com/magento/partners-magento2ee/pull/501
https://github.com/magento/partners-magento2b2b/pull/563

Fixed Issues (if relevant)

  1. Fixes Update sebastian/phpcpd dependency version to "~6.0.3" #31344

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)
  • All automated tests passed successfully (all builds are green)

@m2-assistant
Copy link

m2-assistant bot commented Feb 16, 2021

Hi @hws47a. 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 php8-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

ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review.

For more details, please, 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, please join the Community Contributions Triage session to discuss the appropriate ticket.

🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

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

@magento-engcom-team magento-engcom-team added Partner: Monsoon partners-contribution Pull Request is created by Magento Partner labels Feb 16, 2021
@hws47a hws47a added the Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests label Feb 16, 2021
@hws47a
Copy link
Contributor Author

hws47a commented Feb 16, 2021

@sivaschenko Static Tests passed 👏
and phpcpd is not used anywhere else.

Also I've run static tests locally and phpcpd worked fine.

@hws47a
Copy link
Contributor Author

hws47a commented Feb 16, 2021

@sivaschenko some integration test has failed for Integration B2B but I cannot find it in partners-b2b repository and php8-develop branch is not available there.

Could you help me with this?

@ihor-sviziev
Copy link
Contributor

@magento run Integration Tests

@hws47a
Copy link
Contributor Author

hws47a commented Feb 17, 2021

@ihor-sviziev it seems that all passed

@ihor-sviziev
Copy link
Contributor

@hws47a, could you explain why we need to update PHPUnit in the scope of this PR?

@hws47a
Copy link
Contributor Author

hws47a commented Feb 17, 2021

@ihor-sviziev

You may see that in composer.json only phpcpd was changed and PHPUnit was allowed to be any ^9 version.
phpcpd was not updating without phpunit as they had different dependencies for phpunit/php-timer.
I found that PHPUnit 9.2 is the first version which allows required phpunit/php-timer and updated to it.

So a bit newer PHPUnit is a requirement for phpcpd 6.0.3

@sivaschenko
Copy link
Member

@hws47a thanks for the update, can you please also update the composer.json and lock in EE repo and link the EE PR as related

@sivaschenko
Copy link
Member

@hws47a btw, the php8-develop should be present for all repositories, i.e here is B2B branch https://github.com/magento/partners-magento2b2b/tree/php8-develop

@hws47a
Copy link
Contributor Author

hws47a commented Feb 17, 2021

@hws47a thanks for the update, can you please also update the composer.json and lock in EE repo and link the EE PR as related

Done

@ihor-sviziev
Copy link
Contributor

@magento run Functional Tests B2B, Static Tests

@ihor-sviziev
Copy link
Contributor

@hws47a, static tests are still failing. Could you check, please?

@ihor-sviziev
Copy link
Contributor

@sivaschenko any thoughts why tests are failing with no build results?

@sivaschenko
Copy link
Member

@hws47a @ihor-sviziev tests have failed due to conflict in the EE PR

@hws47a
Copy link
Contributor Author

hws47a commented Feb 19, 2021

@magento run all tests

1 similar comment
@ihor-sviziev
Copy link
Contributor

@magento run all tests

Copy link
Contributor

@ihor-sviziev ihor-sviziev left a comment

Choose a reason for hiding this comment

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

Could you resolve conflicts in EE repo and run all tests again?

@ihor-sviziev
Copy link
Contributor

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

1 similar comment
@ihor-sviziev
Copy link
Contributor

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

@hws47a
Copy link
Contributor Author

hws47a commented Apr 18, 2021

@magento run Static Tests

@hws47a
Copy link
Contributor Author

hws47a commented Apr 18, 2021

@magento run Static Tests

1 similar comment
@hws47a
Copy link
Contributor Author

hws47a commented Apr 18, 2021

@magento run Static Tests

@hws47a
Copy link
Contributor Author

hws47a commented Apr 18, 2021

@magento run all tests

@hws47a
Copy link
Contributor Author

hws47a commented Apr 18, 2021

Hi @sivaschenko, I've fixed phpcpd locally including ee and b2b, however it still failing in the pipeline. I've added output of the command and you may see in the pipeline that there is no output at all. So it seems like the command doesn't run a all. Could you please check it?

@ihor-sviziev
Copy link
Contributor

Let's try to re-run the tests
@magento run all tests

@sivaschenko
Copy link
Member

@magento run Static Tests

@sivaschenko
Copy link
Member

Executing PHPCPD in the phpunit process for debugging purpose

@magento run Static Tests

@sivaschenko
Copy link
Member

@hws47a looks like phpcpd fails to compare bitmap files also it does find a number of copy-pastes, mostly in Inventory modules

@sivaschenko
Copy link
Member

@magento run Static Tests

2 similar comments
@sivaschenko
Copy link
Member

@magento run Static Tests

@sivaschenko
Copy link
Member

@magento run Static Tests

Copy link
Contributor

@ihor-sviziev ihor-sviziev left a comment

Choose a reason for hiding this comment

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

Please review my comments

$exclude[] = $files;
}

return array_unique(array_merge(...$exclude));
Copy link
Contributor

Choose a reason for hiding this comment

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

Technically, there might be empty array in the $exclude, so it's better to replace it with return array_unique(array_merge([], ...$exclude));

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've tried in interactive shell and it seems that array_merge(...[]) doesn't throw any warnings and just returns an empty array. Do you see some PHP error while testing?

@hws47a hws47a force-pushed the 31344-php8-update-phpcpd branch from 10a5700 to 6cf8a8b Compare May 3, 2021 22:16
@hws47a
Copy link
Contributor Author

hws47a commented May 3, 2021

Changed implementation of canRun which now checks if required packages are installed.
Also squashed all commits into one as requested by @sivaschenko

@hws47a
Copy link
Contributor Author

hws47a commented May 3, 2021

@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.

@sivaschenko
Copy link
Member

@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.

@magento-engcom-team magento-engcom-team merged commit 0aab4aa into magento:2.4-develop May 5, 2021
@m2-assistant
Copy link

m2-assistant bot commented May 5, 2021

Hi @hws47a, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

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 Award: advanced Award: category of expertise Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: review Project: PHP8
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update sebastian/phpcpd dependency version to "~6.0.3"
4 participants