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

Use PHP 7.1 features : is_iterable, ?? and ?: #3885

Merged
merged 3 commits into from
Oct 20, 2023
Merged

Conversation

GromNaN
Copy link
Contributor

@GromNaN GromNaN commented Oct 8, 2023

Apply the following changes with rector, compatible with PHP 7.1:

return static function (RectorConfig $rectorConfig): void {
    $rectorConfig->paths([
        __DIR__ . '/src',
        __DIR__ . '/doc',
        __DIR__ . '/tests',
        __DIR__ . '/extra',
    ]);
    $rectorConfig->rule(\Rector\Php53\Rector\Ternary\TernaryToElvisRector::class);
    $rectorConfig->rule(\Rector\Php70\Rector\Ternary\TernaryToNullCoalescingRector::class);
    $rectorConfig->rule(\Rector\Php71\Rector\BooleanOr\IsIterableRector::class);
};

@GromNaN
Copy link
Contributor Author

GromNaN commented Oct 8, 2023

You may want to switch to ::class constant for all referenced class names.

    $rectorConfig->rule(\Rector\Php55\Rector\String_\StringClassNameToClassConstantRector::class);

@fabpot
Copy link
Contributor

fabpot commented Oct 8, 2023

We don't update 2.x anymore except for bug fixes. Can you retarget on 3.x?

@GromNaN GromNaN changed the base branch from 2.x to 3.x October 8, 2023 18:17
@GromNaN GromNaN force-pushed the is_iterable branch 2 times, most recently from 9e0ca37 to 0b02755 Compare October 8, 2023 20:25
@GromNaN
Copy link
Contributor Author

GromNaN commented Oct 8, 2023

Also replaced calls to twig_test_iterable with is_iterable. The function twig_test_iterable is deprecated to be removed in 4.0.

@fabpot
Copy link
Contributor

fabpot commented Oct 20, 2023

Thank you @GromNaN.

@fabpot fabpot merged commit 8b55ad4 into twigphp:3.x Oct 20, 2023
3 of 8 checks passed
@GromNaN GromNaN deleted the is_iterable branch October 20, 2023 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants