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

Enhancement: Add support for rector/rector:~0.6.0 #176

Merged
merged 1 commit into from
Jan 8, 2020

Conversation

localheinz
Copy link
Contributor

@localheinz localheinz commented Jan 3, 2020

This PR

  • adds support for rector/rector:~0.6.0

Fixes #167.

generated/misc.php Outdated Show resolved Hide resolved
@Kharhamel
Copy link
Collaborator

conflicts again. please remove the commit where you regenerate the file.

@localheinz
Copy link
Contributor Author

@Kharhamel

Rebased!

zip_entry_open: 'Safe\zip_entry_open'
zip_entry_read: 'Safe\zip_entry_read'
zlib_decode: 'Safe\zlib_decode'
$oldFunctionToNewFunction
Copy link
Collaborator

Choose a reason for hiding this comment

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

isn't it a typo?

Copy link
Collaborator

@Kharhamel Kharhamel Jan 7, 2020

Choose a reason for hiding this comment

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

It looks like this line is making the pipeline fail

@localheinz localheinz changed the title Enhancement: Use rector/rector:^0.6 Enhancement: Add support for rector/rector:~0.6.0 Jan 7, 2020
@localheinz localheinz force-pushed the feature/rector branch 7 times, most recently from f0fe776 to 3d96207 Compare January 7, 2020 15:11
.travis.yml Outdated
@@ -61,7 +61,9 @@ script:
echo "Generated files are different from commited files. Please run './safe.php generate' command and commit the results."
exit 1;
fi
- cd generator/tests/rector/default && composer install && composer rector && composer test && cd ../../../..
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This ensures that using rector-migrate.yml is still possible.

@localheinz
Copy link
Contributor Author

@Kharhamel

This works fine now, do you want to take another look?

@Kharhamel
Copy link
Collaborator

I don't know much about rector. If I understand correctly, we allow rector 0.6 support while still keeping the compatibility with 0.5? If so, i will merge it.

@localheinz
Copy link
Contributor Author

@Kharhamel

Yes, that's it.

Since 1.0.0 has been tagged, the previous change would be breaking.

This way, users of rector/rector:~0.5.0 and rector/rector:~0.6.0 can both use the YAML configuration files.

@Aerendir
Copy link

Aerendir commented Jan 7, 2020

If of any help, this works for me using Rector v0.6.

@localheinz
Copy link
Contributor Author

Perhaps @TomasVotruba can have a quick look and confirm?

@TomasVotruba
Copy link

Better go with 0.6.7. There've been some changes

README.md Outdated
$ composer require --dev rector/rector:~0.5
```

to install `rector/rector:~0.5`.

Choose a reason for hiding this comment

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

This part can be dropped, as very obsolete version. It also conflicts with PHPStan 0.11-, so extra troubles for no gain

Copy link
Member

Choose a reason for hiding this comment

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

👍

My take on this: we can keep support for rector:0.5 (in order to not break compatibility with users using old Rector) but we should definitely stop advertising this possibility in the README (the README should only contain information about the latest minor version)

README.md Outdated

```bash
vendor/bin/rector process src/ --config vendor/thecodingmachine/safe/rector-migrate.yml
$ vendor/bin/rector process src/ --config vendor/thecodingmachine/safe/rector-migrate-0.6.yml

Choose a reason for hiding this comment

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

Better support just one minor Rector version, this is rather confusing even to me

},
"require": {
"php": ">=7.1",
"rector/rector": "^0.6"

Choose a reason for hiding this comment

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

Rector 0.6 require PHP 7.2, so it can be bumped as well to be real

Copy link

Choose a reason for hiding this comment

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

Updating the minimum PHP version is a BC. This requires a new major version of the entire library...

Choose a reason for hiding this comment

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

This a test file.

And bumping PHP version is not a BC break, as it only narrows scope.

@Aerendir
Copy link

Aerendir commented Jan 7, 2020

I'm an happy user of both Rector and Safe.

Reading your comments, one strange idea came to my mind: what if the support for Safe is provided directly by Rector?

This way, Safe remain an independent very useful package that doesn't break each time Rector is updated...

As told, this is a strange idea 😅

@TomasVotruba
Copy link

TomasVotruba commented Jan 7, 2020

Reading your comments, one strange idea came to my mind: what if the support for Safe is provided directly by Rector?

Well you're right, that's what 99 % projects do :D so feel free to send PR there!

EDIT: Think of it as Symfony Flex with just with upgrade recipes

@localheinz localheinz force-pushed the feature/rector branch 3 times, most recently from cb776ed to 0911c2a Compare January 8, 2020 08:46
@localheinz
Copy link
Contributor Author

Thank you for your feedback, @TomasVotruba - I made a few adjustments here!

@Kharhamel Kharhamel merged commit 9acc5ae into thecodingmachine:master Jan 8, 2020
@localheinz localheinz deleted the feature/rector branch January 8, 2020 09:07
@localheinz
Copy link
Contributor Author

Thank you, @Aerendir, @Kharhamel, @moufmoufm and @TomasVotruba!

@Aerendir
Copy link

Aerendir commented Jan 8, 2020

Reading your comments, one strange idea came to my mind: what if the support for Safe is provided directly by Rector?

Well you're right, that's what 99 % projects do :D so feel free to send PR there!

EDIT: Think of it as Symfony Flex with just with upgrade recipes

I don't understand... Where should have I to submit the PR? I'm not the owner nor I'm involved in the Safe library: I have no decision power about it...

What should have I to do?

@TomasVotruba
Copy link

TomasVotruba commented Jan 8, 2020

The example would the best. If something in Symfony 3.3 changes, it should be added here:
https://github.com/rectorphp/rector/blob/master/config/set/symfony/symfony33.yaml

For this package and version, it would be:

https://github.com/rectorphp/rector/blob/master/config/set/thecodingmachine/safe10.yaml

@Aerendir
Copy link

Aerendir commented Jan 9, 2020

@TomasVotruba , ok, now it is clear: so, it sufficient to copy the current file rector-migrate*.yml from Safe to https://github.com/rectorphp/rector/blob/master/config/set/thecodingmachine/safe10.yaml?

@localheinz , WDYT about this? Can I submit the PR to Rector: have I your permission?

@TomasVotruba
Copy link

@TomasVotruba , ok, now it is clear: so, it sufficient to copy the current file rector-migrate*.yml from Safe to https://github.com/rectorphp/rector/blob/master/config/set/thecodingmachine/safe10.yaml?

👍

@Aerendir
Copy link

Ping

@localheinz
Copy link
Contributor Author

@Aerendir

Perhaps we can find a way to automatically open a pull request whenever we have any changes in the corresponding YAML file?

Maybe using https://github.com/gr2m/create-or-update-pull-request-action?

@TomasVotruba
Copy link

There you go: rectorphp/rector#3078

You can update the set path:

-vendor/bin/rector process src --config vendor/thecodingmachine/safe/rector-migrate-0.7.yml
+vendor/bin/rector process src --config vendor/rector/rector/config/set/thecodingmachine/safe07.yaml

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.

5 participants