8000 Added HeredocToNowdocFixer by gharlan · Pull Request #1580 · PHP-CS-Fixer/PHP-CS-Fixer · GitHub
[go: up one dir, main page]

Skip to content

Added HeredocToNowdocFixer #1580

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

Merged
merged 1 commit into from
Jan 12, 2016

Conversation

gharlan
Copy link
Contributor
@gharlan gharlan commented Dec 7, 2015

No description provided.

return array(
array(<<<'EOF'
<?php $a = <<<'TEST'
TEST;
Copy link
Contributor

Choose a reason for hiding this comment

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

this test is useless. It is already covered by the later item (as makeTest always ensure that applying the fixer on the expected output triggers no additional change)

@SpacePossum
Copy link
Contributor

Test request

            array(<<<'EOF'
<?php
$a = <<<TEST
'
TEST;

$a = <<<TEST
\$b = '<<<';
\$c = <=;
<<<'"$<<<'"
TEST;
EOF
            ),
1) Symfony\CS\Tests\Fixer\Contrib\HeredocToNowdocFixerTest::testFix with data set #0 ('<?php\n$a = <<<TEST\n'\nTEST;\n\n$...\nTEST;')
RuntimeException: Index invalid or out of range

/home/possum/work/PHP-CS-Fixer/Symfony/CS/Fixer/Contrib/HeredocToNowdocFixer.php:42

maybe I messed up the test?

@gharlan
Copy link
Contributor Author
gharlan commented Dec 7, 2015

maybe I messed up the test?

yes. your code is invalid. it is missing a newline at end of code.
After end of heredoc/nowdoc there must be a newline (it is possible to put the newline after ";").

@SpacePossum
Copy link
Contributor

I see, re-tested, all 👍 thanks!

@gharlan gharlan force-pushed the heredoc-to-nowdoc-fixer branch from 51d12c6 to 130c6b7 Compare December 7, 2015 18:31
@gharlan
Copy link
Contributor Author
gharlan commented Dec 7, 2015

@stof should I move this fixer to symfony level?

@gharlan
Copy link
Contributor Author
gharlan commented Dec 21, 2015

ping, anyone else? :)

@GrahamCampbell
Copy link
Contributor

should I move this fixer to symfony level?

Try running it on Symfony and see how many changes are made. If there are very few, or none, then yes. ;)

@keradus
Copy link
Member
keradus commented Dec 21, 2015

If there are few also send a PR for lowest maintained branch

@GrahamCampbell
Copy link
Contributor

2.3, 2.7, 2.8, 3.0, master are the currently active branches on symfony atm btw. ;)

@keradus
Copy link
Member
keradus commented Dec 21, 2015

yes, and CS fixes go from lowest.

@GrahamCampbell
Copy link
Contributor

Yeh, it does. I do sometimes wonder why they bother with CS on a bug-fix only branch, but meh, they do.

@keradus
Copy link
Member
keradus commented Dec 21, 2015

To have diff between branches as little as possible.
Dont say it is good or not, just it is that way.

@gharlan
Copy link
Contributor Author
gharlan commented Dec 21, 2015

made a pr for symfony.

@stof
Copy link
Contributor
stof commented Dec 21, 2015

@keradus @GrahamCampbell the goal is to avoid having CS differences between branches, which would cause conflicts each time there is a change near such line which need to be merged into newer branches. We are merging maintained branches into each other on a weekly basis during the whole maintenance time (i.e. 3 years for LTS versions), so we don't want to have useless conflicts each time (which may lead to bad conflict resolution and introducing bugs or losing bug fixes in newer branches, as happened in the past already)

@GrahamCampbell
Copy link
Contributor

Sure. ;)

@keradus
Copy link
Member
keradus commented Dec 21, 2015

Cool for me @stof, that is why I asked to send that PR to lowest branch ;)


$this->convertToNowdoc($token);
$content = str_replace('\\\\', '\\', $content);
$content = str_replace('\\$', '$', $content);
Copy link
Member

Choose a reason for hiding this comment

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

one str_replace would be enough?

Copy link
Contributor

Choose a reason for hiding this comment

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

indeed, you can pass arrays to param 1 and 2

@gharlan gharlan force-pushed the heredoc-to-nowdoc-fixer branch from 130c6b7 to 8f8efe6 Compare December 27, 2015 10:19
nicolas-grekas added a commit to symfony/symfony that referenced this pull request Dec 28, 2015
This PR was merged into the 2.3 branch.

Discussion
----------

CS: use nowdoc instead of heredoc

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | —
| License       | MIT
| Doc PR        | —

if this is accepted, we could add the fixer to symfony level of php-cs-fixer: PHP-CS-Fixer/PHP-CS-Fixer#1580

Commits
-------

3dca549 use nowdoc instead of heredoc
nicolas-grekas added a commit to symfony/dependency-injection that referenced this pull request Dec 28, 2015
This PR was merged into the 2.3 branch.

Discussion
----------

CS: use nowdoc instead of heredoc

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | —
| License       | MIT
| Doc PR        | —

if this is accepted, we could add the fixer to symfony level of php-cs-fixer: PHP-CS-Fixer/PHP-CS-Fixer#1580

Commits
-------

3dca549 use nowdoc instead of heredoc
nicolas-grekas added a commit to symfony/validator that referenced this pull request Dec 28, 2015
This PR was merged into the 2.3 branch.

Discussion
----------

CS: use nowdoc instead of heredoc

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | —
| License       | MIT
| Doc PR        | —

if this is accepted, we could add the fixer to symfony level of php-cs-fixer: PHP-CS-Fixer/PHP-CS-Fixer#1580

Commits
-------

3dca549 use nowdoc instead of heredoc
nicolas-grekas added a commit to symfony/web-profiler-bundle that referenced this pull request Dec 28, 2015
This PR was merged into the 2.3 branch.

Discussion
----------

CS: use nowdoc instead of heredoc

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | —
| License       | MIT
| Doc PR        | —

if this is accepted, we could add the fixer to symfony level of php-cs-fixer: PHP-CS-Fixer/PHP-CS-Fixer#1580

Commits
-------

3dca549 use nowdoc instead of heredoc
nicolas-grekas added a commit to symfony/yaml that referenced this pull request Dec 28, 2015
This PR was merged into the 2.3 branch.

Discussion
----------

CS: use nowdoc instead of heredoc

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | —
| License       | MIT
| Doc PR        | —

if this is accepted, we could add the fixer to symfony level of php-cs-fixer: PHP-CS-Fixer/PHP-CS-Fixer#1580

Commits
-------

3dca549 use nowdoc instead of heredoc
nicolas-grekas added a commit to symfony/security-bundle that referenced this pull request Dec 28, 2015
This PR was merged into the 2.3 branch.

Discussion
----------

CS: use nowdoc instead of heredoc

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | —
| License       | MIT
| Doc PR        | —

if this is accepted, we could add the fixer to symfony level of php-cs-fixer: PHP-CS-Fixer/PHP-CS-Fixer#1580

Commits
-------

3dca549 use nowdoc instead of heredoc
nicolas-grekas added a commit to symfony/config that referenced this pull request Dec 28, 2015
This PR was merged into the 2.3 branch.

Discussion
----------

CS: use nowdoc instead of heredoc

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | —
| License       | MIT
| Doc PR        | —

if this is accepted, we could add the fixer to symfony level of php-cs-fixer: PHP-CS-Fixer/PHP-CS-Fixer#1580

Commits
-------

3dca549 use nowdoc instead of heredoc
nicolas-grekas added a commit to symfony/process that referenced this pull request Dec 28, 2015
This PR was merged into the 2.3 branch.

Discussion
----------

CS: use nowdoc instead of heredoc

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | —
| License       | MIT
| Doc PR        | —

if this is accepted, we could add the fixer to symfony level of php-cs-fixer: PHP-CS-Fixer/PHP-CS-Fixer#1580

Commits
-------

3dca549 use nowdoc instead of heredoc
nicolas-grekas added a commit to symfony/security that referenced this pull request Dec 28, 2015
This PR was merged into the 2.3 branch.

Discussion
----------

CS: use nowdoc instead of heredoc

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | —
| License       | MIT
| Doc PR        | —

if this is accepted, we could add the fixer to symfony level of php-cs-fixer: PHP-CS-Fixer/PHP-CS-Fixer#1580

Commits
-------

3dca549 use nowdoc instead of heredoc
nicolas-grekas added a commit to symfony/routing that referenced this pull request Dec 28, 2015
This PR was merged into the 2.3 branch.

Discussion
----------

CS: use nowdoc instead of heredoc

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | —
| License       | MIT
| Doc PR        | —

if this is accepted, we could add the fixer to symfony level of php-cs-fixer: PHP-CS-Fixer/PHP-CS-Fixer#1580

Commits
-------

3dca549 use nowdoc instead of heredoc
nicolas-grekas added a commit to symfony/yaml that referenced this pull request Dec 28, 2015
This PR was merged into the 2.3 branch.

Discussion
----------

CS: use nowdoc instead of heredoc

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | —
| License       | MIT
| Doc PR        | —

if this is accepted, we could add the fixer to symfony level of php-cs-fixer: PHP-CS-Fixer/PHP-CS-Fixer#1580

Commits
-------

3dca549 use nowdoc instead of heredoc
@keradus
Copy link
Member
keradus commented Dec 28, 2015

As one can see in referenced commits - Symfony level

@keradus keradus added this to the v1.12 milestone Dec 28, 2015
@GrahamCampbell
Copy link
Contributor

Lol. Reference spam.

@keradus
Copy link
Member
keradus commented Dec 28, 2015

It was for making sure we won't miss it ;P

@gharlan gharlan force-pushed the heredoc-to-nowdoc-fixer branch from 8f8efe6 to 455f08d Compare December 30, 2015 20:09
@gharlan
Copy link
Contributor Author
gharlan commented Dec 31, 2015

As one can see in referenced commits - Symfony level

done

@GrahamCampbell
Copy link
Contributor

👍

@gharlan gharlan force-pushed the heredoc-to-nowdoc-fixer branch from 455f08d to 1575798 Compare December 31, 2015 11:56
@gharlan gharlan force-pushed the heredoc-to-nowdoc-fixer branch from 1575798 to b0739ee Compare January 4, 2016 17:19
@keradus keradus added the RTM Ready To Merge label Jan 7, 2016
@keradus
Copy link
Member
keradus commented Jan 7, 2016

👍

@keradus keradus removed the RTM Ready To Merge label Jan 12, 2016
@keradus
Copy link
Member
keradus commented Jan 12, 2016

Thank you @gharlan.

@keradus keradus merged commit b0739ee into PHP-CS-Fixer:1.12 Jan 12, 2016
keradus added a commit that referenced this pull request Jan 12, 2016
This PR was merged into the 1.12 branch.

Discussion
----------

Added HeredocToNowdocFixer

Commits
-------

b0739ee Added HeredocToNowdocFixer
@gharlan gharlan deleted the heredoc-to-nowdoc-fixer branch January 12, 2016 23:49
@SpacePossum
Copy link
Contributor

nice! 👍 :)

symfony-splitter pushed a commit to symfony/config that referenced this pull request Feb 23, 2016
This PR was merged into the 2.3 branch.

Discussion
----------

CS: use nowdoc instead of heredoc

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | —
| License       | MIT
| Doc PR        | —

if this is accepted, we could add the fixer to symfony level of php-cs-fixer: PHP-CS-Fixer/PHP-CS-Fixer#1580

Commits
-------

3dca549 use nowdoc instead of heredoc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0