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 first rule for sulu rector #1

Merged
merged 3 commits into from
May 12, 2022

Conversation

alexander-schranz
Copy link
Member

This pull request should contain the first rule which should upgrade the deprecated methods on the https://github.com/sulu/sulu/blob/2.5/src/Sulu/Component/Localization/Localization.php object.

@alexander-schranz alexander-schranz force-pushed the feature/first-rule branch 7 times, most recently from 59eb030 to d46f924 Compare May 12, 2022 14:31
@alexander-schranz
Copy link
Member Author

Seems like I'm currently missing something in the test setup. I run into:

InvalidArgumentException: Could not resolve argument "Rector\Config\RectorConfig $rectorConfig" for
"/home/runner/work/sulu-rector/sulu-rector/vendor/rector/rector-src/src/Kernel/../../confi/config.php".
...
Caused by
LogicException: You cannot use the ConfigBuilders without providing a class implementing ConfigBuilderGeneratorInterface.

/cc @TomasVotruba

Bildschirmfoto 2022-05-12 um 16 20 18

Quick Setup Script if you want try locally
git clone [email protected]:alexander-schranz/sulu-rector.git
cd sulu-rector/
git checkout feature/first-rule
composer update
composer test

@TomasVotruba
Copy link
Contributor

My rought guess would be:

composer install

Why? When you use "rector/rector-src": "dev-main", in composer.json, the patches are not applied yet. So you have to "compile" Rector yourself.

I recommend using "rector/rector" as standard and downgraded to PHP 7.1. The "rector/rector-src" is only for core Rector packages and require PHP 8.1

@TomasVotruba
Copy link
Contributor

TomasVotruba commented May 12, 2022

The best inspiration of 3rd party using Rector for upgrades would be:
https://github.com/craftcms/rector

We help to set the repository up, so all the Rector best practise are applied :) it might help you to grasp the quickly

@alexander-schranz
Copy link
Member Author

@TomasVotruba Thx for the quick response and thx for the reference project. Was using rector-symfony as reference, but seems like there it works differently. The tests are running now :) Now I need to checkout why the ruleset is not yet applied correctly.

@TomasVotruba
Copy link
Contributor

TomasVotruba commented May 12, 2022

👍

I'd like to run it locally myself, but I'm not skilled in git to manage fork and remote PR easily.
Could you merge this one to master or give me contributors access here?

<?php

class SomeClass {
public function someMethod(\Sulu\Component\Localization\Localization $localization)
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this class exist in "require-dev" dependencies of composer.json or local /stubs directory?

Without existing class, PHPStan cannot find it nor analyse it.

@TomasVotruba
Copy link
Contributor

Btw, if you would do fixup commits instead of force push, it would easier for me to review what is new/changed since last commit 👍

.gitignore Outdated Show resolved Hide resolved
@alexander-schranz
Copy link
Member Author

alexander-schranz commented May 12, 2022

@TomasVotruba

The branch can be checkout locally this way:

git clone [email protected]:alexander-schranz/sulu-rector.git
cd sulu-rector/
git checkout feature/first-rule
composer update
composer test

Or if you already cloned this repository you can add an additional remote and checkout then the branch from that one:

git remote add alex [email protected]:alexander-schranz/sulu-rector.git
git fetch alex
git checkout -b feature/first-rule alex/feature/first-rule
composer update
composer test

I still did gave you permisson to both this and the fork repository.

@alexander-schranz alexander-schranz marked this pull request as ready for review May 12, 2022 15:24
@alexander-schranz alexander-schranz merged commit 4467347 into sulu:main May 12, 2022
@alexander-schranz alexander-schranz deleted the feature/first-rule branch May 12, 2022 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants