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

[Dep] Update to php 8.1 requirement (manual) #1374

Merged
merged 11 commits into from
Dec 3, 2021
Merged

Conversation

samsonasik
Copy link
Member

@TomasVotruba this is split of #1364 with manual change only with teskipped:

  • rectify CI
  • commented MyCLabsClassToEnumRector and SpatieEnumClassToEnumRector as it make Enum syntax upgrade needs to be skipped as it change PhpVersion class that extends :
use MyCLabs\Enum\Enum;

- final class PhpVersion extends Enum
+ enum PhpVersion : int

which will need update currently manually of its usage:

-PhpVersion::PHP_52;
+PhpVersion::PHP_52->value;

and it seems cause change

also other Enums, eg ObjectReference and ApplicationPhase manually:

-        if ($node->toString() === ObjectReference::PARENT()->getValue()) {
+        if ($node->toString() === ObjectReference::PARENT()->value) {
-        }, ApplicationPhase::PARSING());
+        }, ApplicationPhase::PARSING->value);

and we may need to create a downgrade rule for it to keep working on scoping.

I commented the rules at 99fa67b

@samsonasik
Copy link
Member Author

@TomasVotruba all green 🎉 it is ready for review.

Note: the pending CI PHP 8.0 are probably cache or need you to disable it?

@TomasVotruba
Copy link
Member

Note: the pending CI PHP 8.0 are probably cache or need you to disable it?

It's because of requried names of jobs that must pass. Unfortunatelly Github sees thems as string, it's based on workflow name.
So changing string from "8.0" to "8.1" required manual change in settings. I'll handle it.

@TomasVotruba
Copy link
Member

TomasVotruba commented Dec 3, 2021

which will need update currently manually of its usage:

-PhpVersion::PHP_52;
+PhpVersion::PHP_52->value;

Instead, the code using these enums should be upgraded from string to the Enum, e.g.:

interface MinPhpVersionInterface
{
-    public function provideMinPhpVersion(): int;
+    public function provideMinPhpVersion(): PhpVersion;
}

It should be handled in separated PR, maybe via a new Rector rule.

@TomasVotruba TomasVotruba self-requested a review December 3, 2021 13:43
Comment on lines 17 to 25
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(ReturnNeverTypeRector::class);
$services->set(MyCLabsClassToEnumRector::class);
//$services->set(MyCLabsClassToEnumRector::class);
$services->set(MyCLabsMethodCallToEnumConstRector::class);
$services->set(FinalizePublicClassConstantRector::class);
$services->set(ReadOnlyPropertyRector::class);
$services->set(SpatieEnumClassToEnumRector::class);
//$services->set(SpatieEnumClassToEnumRector::class);
$services->set(Php81ResourceReturnToObjectRector::class);
Copy link
Member

Choose a reason for hiding this comment

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

These should be included in set so others can use them, but be skipped in our rector.php.

Copy link
Member Author

Choose a reason for hiding this comment

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

updated 0ee361c

@samsonasik
Copy link
Member Author

All checks have passed 🎉 @TomasVotruba I think it is ready.

@TomasVotruba
Copy link
Member

Thank you 👍

@TomasVotruba TomasVotruba merged commit 1ba58dd into main Dec 3, 2021
@TomasVotruba TomasVotruba deleted the php81-manual branch December 3, 2021 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants