Skip to content

Commit c899264

Browse files
committed
minor #5223 Docs: regenerate docs on 2.16 line (keradus)
This PR was merged into the 2.16 branch. Discussion ---------- Docs: regenerate docs on 2.16 line Commits ------- 7614822 Docs: regenerate docs on 2.16 line
2 parents e1db0c3 + 7614822 commit c899264

15 files changed

+623
-24
lines changed

doc/rules/casing/constant_case.rst

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
======================
2+
Rule ``constant_case``
3+
======================
4+
5+
The PHP constants ``true``, ``false``, and ``null`` MUST be written using the
6+
correct casing.
7+
8+
Configuration
9+
-------------
10+
11+
``case``
12+
~~~~~~~~
13+
14+
Whether to use the ``upper`` or ``lower`` case syntax.
15+
16+
Allowed values: ``'lower'``, ``'upper'``
17+
18+
Default value: ``'lower'``
19+
20+
Examples
21+
--------
22+
23+
Example #1
24+
~~~~~~~~~~
25+
26+
*Default* configuration.
27+
28+
.. code-block:: diff
29+
30+
--- Original
31+
+++ New
32+
@@ -1,4 +1,4 @@
33+
<?php
34+
-$a = FALSE;
35+
-$b = True;
36+
-$c = nuLL;
37+
+$a = false;
38+
+$b = true;
39+
+$c = null;
40+
41+
Example #2
42+
~~~~~~~~~~
43+
44+
With configuration: ``['case' => 'upper']``.
45+
46+
.. code-block:: diff
47+
48+
--- Original
49+
+++ New
50+
@@ -1,4 +1,4 @@
51+
<?php
52+
$a = FALSE;
53+
-$b = True;
54+
-$c = nuLL;
55+
+$b = TRUE;
56+
+$c = NULL;
57+
58+
Rule sets
59+
---------
60+
61+
The rule is part of the following rule sets:
62+
63+
@PSR2
64+
Using the ``@PSR2`` rule set will enable the ``constant_case`` rule with the default config.
65+
66+
@Symfony
67+
Using the ``@Symfony`` rule set will enable the ``constant_case`` rule with the default config.
68+
69+
@PhpCsFixer
70+
Using the ``@PhpCsFixer`` rule set will enable the ``constant_case`` rule with the default config.

doc/rules/casing/lowercase_constants.rst

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
Rule ``lowercase_constants``
33
============================
44

5+
.. warning:: This rule is deprecated and will be removed on next major version.
6+
7+
You should use ``constant_case`` instead.
8+
59
The PHP constants ``true``, ``false``, and ``null`` MUST be in lower case.
610

711
Examples
@@ -22,17 +26,3 @@ Example #1
2226
+$a = false;
2327
+$b = true;
2428
+$c = null;
25-
26-
Rule sets
27-
---------
28-
29-
The rule is part of the following rule sets:
30-
31-
@PSR2
32-
Using the ``@PSR2`` rule set will enable the ``lowercase_constants`` rule.
33-
34-
@Symfony
35-
Using the ``@Symfony`` rule set will enable the ``lowercase_constants`` rule.
36-
37-
@PhpCsFixer
38-
Using the ``@PhpCsFixer`` rule set will enable the ``lowercase_constants`` rule.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
===============================================
2+
Rule ``final_public_method_for_abstract_class``
3+
===============================================
4+
5+
All ``public`` methods of ``abstract`` classes should be ``final``.
6+
7+
Description
8+
-----------
9+
10+
Enforce API encapsulation in an inheritance architecture. If you want to
11+
override a method, use the Template method pattern.
12+
13+
.. warning:: Using this rule is risky.
14+
15+
Risky when overriding ``public`` methods of ``abstract`` classes.
16+
17+
Examples
18+
--------
19+
20+
Example #1
21+
~~~~~~~~~~
22+
23+
.. code-block:: diff
24+
25+
--- Original
26+
+++ New
27+
@@ -2,6 +2,6 @@
28+
29+
abstract class AbstractMachine
30+
{
31+
- public function start()
32+
+ final public function start()
33+
{}
34+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
============================
2+
Rule ``final_static_access``
3+
============================
4+
5+
Converts ``static`` access to ``self`` access in ``final`` classes.
6+
7+
Examples
8+
--------
9+
10+
Example #1
11+
~~~~~~~~~~
12+
13+
.. code-block:: diff
14+
15+
--- Original
16+
+++ New
17+
@@ -3,6 +3,6 @@
18+
{
19+
public function getFoo()
20+
{
21+
- return static::class;
22+
+ return self::class;
23+
}
24+
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
=============================
2+
Rule ``self_static_accessor``
3+
=============================
4+
5+
Inside a ``final`` class or anonymous class ``self`` should be preferred to
6+
``static``.
7+
8+
Examples
9+
--------
10+
11+
Example #1
12+
~~~~~~~~~~
13+
14+
.. code-block:: diff
15+
16+
--- Original
17+
+++ New
18+
@@ -5,6 +5,6 @@
19+
20+
public function getBar()
21+
{
22+
- return static::class.static::test().static::$A;
23+
+ return self::class.self::test().self::$A;
24+
}
25+
26+
Example #2
27+
~~~~~~~~~~
28+
29+
.. code-block:: diff
30+
31+
--- Original
32+
+++ New
33+
@@ -3,6 +3,6 @@
34+
{
35+
public function bar()
36+
{
37+
- return new static();
38+
+ return new self();
39+
}
40+
}
41+
42+
Example #3
43+
~~~~~~~~~~
44+
45+
.. code-block:: diff
46+
47+
--- Original
48+
+++ New
49+
@@ -3,6 +3,6 @@
50+
{
51+
public function isBar()
52+
{
53+
- return $foo instanceof static;
54+
+ return $foo instanceof self;
55+
}
56+
}
57+
58+
Example #4
59+
~~~~~~~~~~
60+
61+
.. code-block:: diff
62+
63+
--- Original
64+
+++ New
65+
@@ -2,6 +2,6 @@
66+
$a = new class() {
67+
public function getBar()
68+
{
69+
- return static::class;
70+
+ return self::class;
71+
}
72+
};

doc/rules/comment/comment_to_phpdoc.rst

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,26 @@ Comments with annotation should be docblock when used on structural elements.
99
Risky as new docblocks might mean more, e.g. a Doctrine entity might have a
1010
new column in database.
1111

12+
Configuration
13+
-------------
14+
15+
``ignored_tags``
16+
~~~~~~~~~~~~~~~~
17+
18+
List of ignored tags
19+
20+
Allowed types: ``array``
21+
22+
Default value: ``[]``
23+
1224
Examples
1325
--------
1426

1527
Example #1
1628
~~~~~~~~~~
1729

30+
*Default* configuration.
31+
1832
.. code-block:: diff
1933
2034
--- Original
@@ -23,10 +37,27 @@ Example #1
2337
-<?php /* header */ $x = true; /* @var bool $isFoo */ $isFoo = true;
2438
+<?php /* header */ $x = true; /** @var bool $isFoo */ $isFoo = true;
2539
40+
Example #2
41+
~~~~~~~~~~
42+
43+
With configuration: ``['ignored_tags' => ['todo']]``.
44+
45+
.. code-block:: diff
46+
47+
--- Original
48+
+++ New
49+
@@ -2,5 +2,5 @@
50+
// @todo do something later
51+
$foo = 1;
52+
53+
-// @var int $a
54+
+/** @var int $a */
55+
$a = foo();
56+
2657
Rule sets
2758
---------
2859

2960
The rule is part of the following rule set:
3061

3162
@PhpCsFixer:risky
32-
Using the ``@PhpCsFixer:risky`` rule set will enable the ``comment_to_phpdoc`` rule.
63+
Using the ``@PhpCsFixer:risky`` rule set will enable the ``comment_to_phpdoc`` rule with the default config.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
=========================================================
2+
Rule ``nullable_type_declaration_for_default_null_value``
3+
=========================================================
4+
5+
Adds or removes ``?`` before type declarations for parameters with a default
6+
``null`` value.
7+
8+
Description
9+
-----------
10+
11+
Rule is applied only in a PHP 7.1+ environment.
12+
13+
Configuration
14+
-------------
15+
16+
``use_nullable_type_declaration``
17+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18+
19+
Whether to add or remove ``?`` before type declarations for parameters with a
20+
default ``null`` value.
21+
22+
Allowed types: ``bool``
23+
24+
Default value: ``true``
25+
26+
Examples
27+
--------
28+
29+
Example #1
30+
~~~~~~~~~~
31+
32+
*Default* configuration.
33+
34+
.. code-block:: diff
35+
36+
--- Original
37+
+++ New
38+
@@ -1,3 +1,3 @@
39+
<?php
40+
-function sample(string $str = null)
41+
+function sample(?string $str = null)
42+
{}
43+
44+
Example #2
45+
~~~~~~~~~~
46+
47+
With configuration: ``['use_nullable_type_declaration' => false]``.
48+
49+
.. code-block:: diff
50+
51+
--- Original
52+
+++ New
53+
@@ -1,3 +1,3 @@
54+
<?php
55+
-function sample(?string $str = null)
56+
+function sample(string $str = null)
57+
{}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
=============================
2+
Rule ``phpdoc_to_param_type``
3+
=============================
4+
5+
EXPERIMENTAL: Takes ``@param`` annotations of non-mixed types and adjusts
6+
accordingly the function signature. Requires PHP >= 7.0.
7+
8+
.. warning:: Using this rule is risky.
9+
10+
This rule is EXPERIMENTAL and [1] is not covered with backward compatibility
11+
promise. [2] ``@param`` annotation is mandatory for the fixer to make
12+
changes, signatures of methods without it (no docblock, inheritdocs) will not
13+
be fixed. [3] Manual actions are required if inherited signatures are not
14+
properly documented.
15+
16+
Examples
17+
--------
18+
19+
Example #1
20+
~~~~~~~~~~
21+
22+
.. code-block:: diff
23+
24+
--- Original
25+
+++ New
26+
@@ -1,5 +1,5 @@
27+
<?php
28+
29+
/** @param string $bar */
30+
-function my_foo($bar)
31+
+function my_foo(string $bar)
32+
{}
33+
34+
Example #2
35+
~~~~~~~~~~
36+
37+
.. code-block:: diff
38+
39+
--- Original
40+
+++ New
41+
@@ -1,5 +1,5 @@
42+
<?php
43+
44+
/** @param string|null $bar */
45+
-function my_foo($bar)
46+
+function my_foo(?string $bar)
47+
{}

0 commit comments

Comments
 (0)