-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into fix_declare_7634
- Loading branch information
Showing
27 changed files
with
1,674 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
================================== | ||
Rule ``numeric_literal_separator`` | ||
================================== | ||
|
||
Adds separators to numeric literals of any kind. | ||
|
||
Configuration | ||
------------- | ||
|
||
``override_existing`` | ||
~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
Whether literals already containing underscores should be reformatted. | ||
|
||
Allowed types: ``bool`` | ||
|
||
Default value: ``false`` | ||
|
||
``strategy`` | ||
~~~~~~~~~~~~ | ||
|
||
Whether numeric literal should be separated by underscores or not. | ||
|
||
Allowed values: ``'no_separator'`` and ``'use_separator'`` | ||
|
||
Default value: ``'no_separator'`` | ||
|
||
Examples | ||
-------- | ||
|
||
Example #1 | ||
~~~~~~~~~~ | ||
|
||
*Default* configuration. | ||
|
||
.. code-block:: diff | ||
--- Original | ||
+++ New | ||
<?php | ||
-$integer = 1234_5678; | ||
-$octal = 01_234_56; | ||
-$binary = 0b00_10_01_00; | ||
-$hexadecimal = 0x3D45_8F4F; | ||
+$integer = 12345678; | ||
+$octal = 0123456; | ||
+$binary = 0b00100100; | ||
+$hexadecimal = 0x3D458F4F; | ||
Example #2 | ||
~~~~~~~~~~ | ||
|
||
With configuration: ``['strategy' => 'use_separator']``. | ||
|
||
.. code-block:: diff | ||
--- Original | ||
+++ New | ||
<?php | ||
-$integer = 12345678; | ||
-$octal = 0123456; | ||
-$binary = 0b0010010011011010; | ||
-$hexadecimal = 0x3D458F4F; | ||
+$integer = 12_345_678; | ||
+$octal = 0123_456; | ||
+$binary = 0b00100100_11011010; | ||
+$hexadecimal = 0x3D_45_8F_4F; | ||
Example #3 | ||
~~~~~~~~~~ | ||
|
||
With configuration: ``['override_existing' => true]``. | ||
|
||
.. code-block:: diff | ||
--- Original | ||
+++ New | ||
-<?php $var = 24_40_21; | ||
+<?php $var = 244021; | ||
References | ||
---------- | ||
|
||
- Fixer class: `PhpCsFixer\\Fixer\\Basic\\NumericLiteralSeparatorFixer <./../../../src/Fixer/Basic/NumericLiteralSeparatorFixer.php>`_ | ||
- Test class: `PhpCsFixer\\Tests\\Fixer\\Basic\\NumericLiteralSeparatorFixerTest <./../../../tests/Fixer/Basic/NumericLiteralSeparatorFixerTest.php>`_ | ||
|
||
The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
==================================== | ||
Rule ``multiline_string_to_heredoc`` | ||
==================================== | ||
|
||
Convert multiline string to ``heredoc`` or ``nowdoc``. | ||
|
||
Examples | ||
-------- | ||
|
||
Example #1 | ||
~~~~~~~~~~ | ||
|
||
.. code-block:: diff | ||
--- Original | ||
+++ New | ||
<?php | ||
-$a = 'line1 | ||
-line2'; | ||
+$a = <<<'EOD' | ||
+line1 | ||
+line2 | ||
+EOD; | ||
Example #2 | ||
~~~~~~~~~~ | ||
|
||
.. code-block:: diff | ||
--- Original | ||
+++ New | ||
<?php | ||
-$a = "line1 | ||
-{$obj->getName()}"; | ||
+$a = <<<EOD | ||
+line1 | ||
+{$obj->getName()} | ||
+EOD; | ||
References | ||
---------- | ||
|
||
- Fixer class: `PhpCsFixer\\Fixer\\StringNotation\\MultilineStringToHeredocFixer <./../../../src/Fixer/StringNotation/MultilineStringToHeredocFixer.php>`_ | ||
- Test class: `PhpCsFixer\\Tests\\Fixer\\StringNotation\\MultilineStringToHeredocFixerTest <./../../../tests/Fixer/StringNotation/MultilineStringToHeredocFixerTest.php>`_ | ||
|
||
The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.