-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[Meta] PHP 7.3 support #3697
Comments
Would be nice to get a fixer to pass the new |
Could be nice indeed, but that should be a separate feature request. This issue mostly tracks changes making existing code compatible with PHP 7.3 :) |
and then, clean up manual handling of error, huh? gonna be tricky ;( |
The last one will be a bit of work here I think. |
Thanks @SpacePossum, I edited the list. Note that I think we don't need to care about |
whenever we care about native functions, we need to take care of |
I wonder if we could help people mediate issues like these https://externals.io/message/102147 when going from PHP7.2 to 7.3, tricky part is to identify when the fix needs to be applied and not re-apply it on a second run on PHP7.3..... |
|
Alpha 1 is out, spotted a bug in |
I want to create a fixer for heredoc/nowdoc indentation. Input: function foo() {
return [
'foo',
<<<'EOF'
abcdef
ghijkl
mnopqr
EOF
,
'bar',
'baz',
];
} Which indentation would you prefer? v1: function foo() {
return [
'foo',
<<<'EOF'
abcdef
ghijkl
mnopqr
EOF
,
'bar',
'baz',
];
} v2: function foo() {
return [
'foo',
<<<'EOF'
abcdef
ghijkl
mnopqr
EOF
,
'bar',
'baz',
];
} And should the same fixer replace the comma ( |
I would personally prefer V1, and I think the comma change should be done on fixer |
I'd prefer v2. Indentation should probably be configurable. Handling of the comma should be done by |
(edit by SpacePossum: PR) |
nightly job is green now |
Correct links are: |
Facing this issue: already addressed or reported?
|
@DeepDiver1975 You are using PHP-CS-Fixer 1.x, please update to 2.x by reading the guide here: https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/2.12/UPGRADE.md#upgrade-guide-from-1x-to-20 |
Just FIY, blocking PHP 7.3 makes fail builds that want to use it any way: |
Workaround for all other closed PHP 7.3 |
This. Requirements should be runtime requirements and not state the code that can be fixed. If you write a fixer for Ruby code, you wouldn't write Ruby into the requirements, no? |
@teohhanhui No judgment given, but care to expand on why you vote down several comments which seems to make sense from package consumer perspective? |
Hi! I've just stumbled into this scenario (installing Based on the list in the first message, is the list up-to-date? If so, I'd like to help by checking some of these items 😉 |
Hi! I would say that my last comment is the most up-to-date.
everything else from PHP 7.3 are nice-to-haves we can add later on :) |
This PR was merged into the 2.14-dev branch. Discussion ---------- Add HeredocIndentationFixer #3697 / https://wiki.php.net/rfc/flexible_heredoc_nowdoc_syntaxes Requires PHP 7.3 Input: ```php <?php $a = [ <<<'EOD' abcdef ghi jkl EOD ]; ``` is fixed to: ```php <?php $a = [ <<<'EOD' abcdef ghi jkl EOD ]; ``` Commits ------- 61242ca Add HeredocIndentationFixer
way too late probably, but just to clarify the policy.
No. Warning is not enough. PHP CS Fixer must not break the code unless it was told otherwise. So, running the Fixer when there are high chances to break the codebase of user with just informing him "btw, I don't know what I'm doing, maybe I broke sth" is not acceptable. Especially for that, for two behaviors we have that could change/break the codebase, we have 2 special flags - Saying that, stability of the Tool is top prio. When user is not allowing the risky behaviour, we promise to not break the codebase and we do our best on that. I do know that topic of 7.3 is burning - but please, keep in mind that this tool is driven by community and made in free time of ppl. For that, resources are simply limited, and all the help is appreciated (not only raising the PRs, but also reviewing them, looking for missing edge cases, doing regression tests, ...). |
@SpacePossum I see you marked the following tasks as completed:
I don't remember seeing related PRs for those topics, are you sure they are covered enough by tests? |
We already supported list reference assignment as I thought it was part of PHP7.2... ^_^ The second one for |
I use VSCode extension Maybe this will help others who are patiently waiting for the next release but are OK with the risk and unsupported features 👍 P.S. Don't forget to remove the flag from your |
Once more, just to stress that. |
I have created an integration test for 7.3: #4184 If anyone is willing to help, please visit #4184 and simply pick one of listed fixers, example code that is failing for given Fixer is provided in that PR as well. If anyone is willing to ask why there is no support of PHP 7.3 and s/he wants to have it, please follow 👆 paragraph ;) |
I don't care about PHP 7.3 syntax support (for now, as the current target is lower PHP versions), just about being able to install |
So, you are basically saying that tool shall check env only on runtime. If you say that, why to apply it only for PHP CS Fixer, and not everything you are installing? |
@keradus You're entirely right, IMO all packages should only have a lower bound for PHP versions. That's also why we use only lower bounds for our packages, no upper bounds. PHP is pretty stable and unlike Composer dependencies, it's not installed as a dependency by Composer, but already installed on the system. Besides that, the issue seems to be only PHP 7.3 syntax that's not yet fully supported. Processing of PHP 7.2 and lower syntax seems to work fine, even on PHP 7.3, no? |
There are a lot different ideas that could be considered, like setting upper bound PHP support on fixer/rule level, etc. In the end however, all this takes up time that could be used spend on fixing the issues themselves. Feel free to raise new concerns about what doesn't work when fixing PHP 7.3 code, but lets end the discussion about how to bypass the safety-mechanics preventing installing PHP-CS-Fixer on a PHP7.3 setup with composer (instructions are within the comments above), as no new arguments have been made for a while and no new insights have come from this to change the current ways. Last days a lot of progress has been made towards PHP 7.3 support and I would really like to not loose momentum and focus because of the discussion here. We try to resolve the issues and prepare for a release with PHP 7.3 support so please help out with that :) |
We won't install php-cs-fixer via Composer anymore, see PHP-CS-Fixer/PHP-CS-Fixer#3697 for context.
🚀 |
@SpacePossum I agree, face-it, you can better have small iterations and have progress, instead of standing still too long. Let's have 7.3 support! |
Thanks to all who helped out getting support for PHP7.3 done over the last week or so! (release notes/change log will be available soon) |
… level (gharlan) This PR was merged into the 2.17-dev branch. Discussion ---------- HeredocIndentationFixer - config option for indentation level We discussed the best indentation level for the HeredocIndentationFixer [here](#3697 (comment)) and [here](#3915). But now since I'm actually using it, I changed my mind. I would like to write code like this: ```php public function foo() { return $this->createQuery(<<<'DQL' SELECT foo FROM App\Entity\Foo foo WHERE ... DQL)->getResult(); } ``` and NOT: ```php public function foo() { return $this->createQuery(<<<'DQL' SELECT foo FROM App\Entity\Foo foo WHERE ... DQL)->getResult(); } ``` So I suggest to add a config option `indentation` with possible values `start_plus_one` (default; same as current behavior) and `same_as_start` (new behavior). (Ideas for better names?) The fixer will remain non-risky, so it does not change the actual string result. This input: ```php $dql = <<<'DQL' SELECT foo FROM App\Entity\Foo foo DQL; ``` will be changed with the new behavior (`same_as_start`) to: ```php $dql = <<<'DQL' SELECT foo FROM App\Entity\Foo foo DQL; ``` Adding one more indentation level inside string content is not part of this fixer (as it would be risky). Commits ------- b03554d HeredocIndentationFixer - config option for indentation level
This issue lists PHP 7.3 changes that are relevant to this project and tracks related issues and PR.
Syntax changes that require new tests to make sure the tool is compatible with PHP 7.3:
instanceof
now allows literals as the first operand, in which case the result is alwaysfalse
.Progress tracker: #4184
Relevant changes that could lead to new features (not required to make the tool compatible with PHP 7.3):
hrtime
function has been addedis_countable
function has been added => Implement is_countable fixer for @PHP73Migration ruleset #4236Sources:
The text was updated successfully, but these errors were encountered: