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

Adding Symfony 4.0 and 4.1 Rector rule sets to CI #11479

Merged
merged 5 commits into from Sep 23, 2022

Conversation

escopecz
Copy link
Sponsor Member

@escopecz escopecz commented Sep 16, 2022

Q A
Bug fix? (use the a.b branch) [y]
New feature/enhancement? (use the a.x branch) [y]
Deprecations? [n]
BC breaks? (use the c.x branch) [n]
Automated tests included? [automated rule set]
Related user documentation PR URL /
Related developer documentation PR URL /
Issue(s) addressed Fixes Symfony 4.0 and 4.1 deprecations

Description:

The idea is that we'll have Rector rules that we need to get to Symfony 5 support (refactor the deprecated code) in CI so that all PRs (currently 260 open, kinda old PRs) will not add some deprecated code.

This PR starts with Symfony 4.0 and 4.1 rule set. Symfony 4.2 will follow but we need to merge #11447 first as it focuses on TranslatorInterface and change a lot of files.

I had to refactor app/bundles/IntegrationsBundle/Controller/ConfigController.php a little as using property of $this->form over just variable $form was breaking a Rector rule. It was an anti-pattern anyway as we can simply pass the form as input params to the private methods instead which is much cleaner.

The Symfony rule set also needs the cache built so I added bin/console cache:warmup before we run Rector.

Steps to test this PR:

  1. Open this PR on Gitpod or pull down for testing locally (see docs on testing PRs here)
  2. There is very little chance that this PR broke something but if we want to be thorough then test:
  3. Any API request saving a contact.
  4. Export a theme.
  5. Save a point trigger.

@cla-bot cla-bot bot added the cla-signed The PR contributors have signed the contributors agreement label Sep 16, 2022
@codecov
Copy link

codecov bot commented Sep 16, 2022

Codecov Report

Merging #11479 (741c55c) into 5.x (071484d) will not change coverage.
The diff coverage is 5.88%.

Impacted file tree graph

@@            Coverage Diff            @@
##                5.x   #11479   +/-   ##
=========================================
  Coverage     49.91%   49.91%           
- Complexity    35511    35515    +4     
=========================================
  Files          2153     2153           
  Lines        106392   106392           
=========================================
  Hits          53102    53102           
  Misses        53290    53290           
Impacted Files Coverage Δ
app/bundles/CoreBundle/Helper/ThemeHelper.php 62.99% <ø> (ø)
...IntegrationsBundle/Controller/ConfigController.php 0.00% <0.00%> (ø)
...es/LeadBundle/Controller/Api/LeadApiController.php 29.91% <0.00%> (ø)
...ointBundle/Controller/Api/TriggerApiController.php 0.00% <0.00%> (ø)
...ndles/ApiBundle/Controller/CommonApiController.php 79.86% <100.00%> (ø)

Error message:

Could not process "app/bundles/IntegrationsBundle/Controller/ConfigController.php" file, due to:
         "System error: "Rector\Symfony\Rector\MethodCall\FormIsValidRector::isIsSubmittedByAlreadyCalledOnVariable():
         Argument #1 ($variable) must be of type PhpParser\Node\Expr\Variable, PhpParser\Node\Expr\PropertyFetch given,
         called in vendor/rector/rector/vendor/rector/rector-symfony/src/Rector/MethodCall/FormIsValidRector.php:59"
         Run Rector with "--debug" option and post the report here: https://github.com/rectorphp/rector/issues/new". On
         line: 86
@escopecz escopecz marked this pull request as ready for review September 16, 2022 14:29
@escopecz escopecz changed the title Adding Symfony 4.0 Rector rule Adding Symfony 4.0 and 4.1 Rector rule sets to CI Sep 16, 2022
@escopecz escopecz added bug Issues or PR's relating to bugs enhancement Any improvement to an existing feature or functionality automated-tests Anything related to unit, functional or e2e tests labels Sep 16, 2022
@escopecz escopecz added this to the 5.0-alpha milestone Sep 21, 2022
mollux
mollux previously approved these changes Sep 23, 2022
Copy link
Contributor

@mollux mollux left a comment

Choose a reason for hiding this comment

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

small nitpick for a typo, for the rest it's good to go!

rector.php Outdated Show resolved Hide resolved
kuzmany
kuzmany previously approved these changes Sep 23, 2022
Copy link
Member

@kuzmany kuzmany left a comment

Choose a reason for hiding this comment

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

Let's go

Co-authored-by: mollux <mattias.michaux@gmail.com>
@escopecz escopecz dismissed stale reviews from kuzmany and mollux via a4087c7 September 23, 2022 09:17
@escopecz escopecz added the ready-to-commit PR's with 2 successful tests, 1 approval, automated tests and docs and is ready to be merged label Sep 23, 2022
@escopecz escopecz merged commit 5626b8d into mautic:5.x Sep 23, 2022
@escopecz escopecz deleted the rector-symfony branch September 23, 2022 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automated-tests Anything related to unit, functional or e2e tests bug Issues or PR's relating to bugs cla-signed The PR contributors have signed the contributors agreement enhancement Any improvement to an existing feature or functionality ready-to-commit PR's with 2 successful tests, 1 approval, automated tests and docs and is ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants