2
2
3
3
All notable changes to this project will be documented in this file, in reverse chronological order by release.
4
4
5
- ## 2.0.0 - TBD
5
+ ## 2.0.0-alpha.1 - 2018-11-18
6
6
7
7
### Added
8
8
9
- - [ #5 ] ( https://github.com/zendframework/zend-coding-standard/pull/5 ) adds
9
+ - [ #5 ] ( https://github.com/zendframework/zend-coding-standard/pull/5 ) adds
10
10
online documentation: https://docs.zendframework.com/zend-coding-standard/
11
- - [ #5 ] ( https://github.com/zendframework/zend-coding-standard/pull/5 ) adds
11
+ - [ #5 ] ( https://github.com/zendframework/zend-coding-standard/pull/5 ) adds
12
12
PSR-12 rules.
13
-
13
+
14
14
* NOTE:* PSR-12 is not finalized. e.g. The ` ! ` operator and ` : ` placement for
15
- return values are still under discussion. We will change these rules, and,
15
+ return values are still under discussion. We will change these rules, and,
16
16
when PSR-12 is finalized, adapt them.
17
- - [ #5 ] ( https://github.com/zendframework/zend-coding-standard/pull/5 ) extends
17
+ - [ #5 ] ( https://github.com/zendframework/zend-coding-standard/pull/5 ) extends
18
18
PSR-12 with ZendFramework specific rules:
19
-
19
+
20
20
* NOTE:* Most of these rules should look familiar as they are already being
21
- used in components rewritten for PHP 7.1.
22
-
23
- - There should be one space on either side of an equals sign used to assign
24
- a value to a variable. In case of a block of related assignments, more
21
+ used in components rewritten for PHP 7.1.
22
+
23
+ - There should be one space on either side of an equals sign used to assign
24
+ a value to a variable. In case of a block of related assignments, more
25
25
space may be inserted before the equal sign to promote readability.
26
- - Short array syntax must be used to define arrays.
27
- - All values in multiline arrays must be indented with 4 spaces.
28
- - All array values must be followed by a comma, including the last value.
29
- - Whitespace is not allowed around the opening bracket or before the
26
+ - Short array syntax must be used to define arrays.
27
+ - All values in multiline arrays must be indented with 4 spaces.
28
+ - All array values must be followed by a comma, including the last value.
29
+ - Whitespace is not allowed around the opening bracket or before the
30
30
closing bracket when referencing an array.
31
31
- The ` global ` keyword may not be used.
32
- - The ` PHP_SAPI ` constant must be used instead of the ` php_sapi_name() `
32
+ - The ` PHP_SAPI ` constant must be used instead of the ` php_sapi_name() `
33
33
function.
34
34
- PHP function calls must be in lowercase.
35
35
- PHP functions which are an alias may not be used.
@@ -40,22 +40,22 @@ All notable changes to this project will be documented in this file, in reverse
40
40
- The words _ private_ , _ protected_ , _ static_ , _ constructor_ , _ deconstructor_ ,
41
41
_ Created by_ , _ getter_ and _ setter_ , may not be used in comments.
42
42
- The annotations ` @api ` , ` @author ` , ` @category ` , ` @created ` , ` @package ` ,
43
- ` @subpackage ` and ` @version ` may not be used in comments. Git commits
43
+ ` @subpackage ` and ` @version ` may not be used in comments. Git commits
44
44
provide accurate information.
45
- - The asterisks in a doc comment should align, and there should be one space
45
+ - The asterisks in a doc comment should align, and there should be one space
46
46
between the asterisk and tag.
47
- - Comment tags ` @param ` , ` @throws ` and ` @return ` should not be aligned or
47
+ - Comment tags ` @param ` , ` @throws ` and ` @return ` should not be aligned or
48
48
contain multiple spaces between the tag, type and description.
49
- - If a function throws any exceptions, they should be documented in ` @throws `
49
+ - If a function throws any exceptions, they should be documented in ` @throws `
50
50
tags.
51
- - The ` @var ` tag may be used in inline comments to document the _ Type_ of
51
+ - The ` @var ` tag may be used in inline comments to document the _ Type_ of
52
52
properties.
53
53
- Single-line comments with a ` @var ` tag should be written as one-liners.
54
54
- Shorthand scalar typehint variants must be used in docblocks.
55
- - Each PHP file should have a page level docblock with ` @see ` , ` @copyright `
56
- and ` @license ` . The copyright date should only be adjusted if the file has
55
+ - Each PHP file should have a page level docblock with ` @see ` , ` @copyright `
56
+ and ` @license ` . The copyright date should only be adjusted if the file has
57
57
changed.
58
- - Each PHP file should have a strict type declaration at the top after the
58
+ - Each PHP file should have a strict type declaration at the top after the
59
59
page level docblock.
60
60
- Import statements should be alphabetically sorted.
61
61
- Import statements should not be grouped.
@@ -64,57 +64,57 @@ All notable changes to this project will be documented in this file, in reverse
64
64
- Unused import statements are not allowed.
65
65
- Classes and function within the same namespace should not be imported.
66
66
- Imports should not have an alias with the same name.
67
- - A class should not have unused private constants, (or write-only)
67
+ - A class should not have unused private constants, (or write-only)
68
68
properties and methods.
69
- - Class name resolution via ` ::class ` should be used instead of
70
- ` __CLASS__ ` , ` get_class() ` , ` get_class($this) ` , ` get_called_class() ` and
69
+ - Class name resolution via ` ::class ` should be used instead of
70
+ ` __CLASS__ ` , ` get_class() ` , ` get_class($this) ` , ` get_called_class() ` and
71
71
` get_parent_class() ` .
72
72
- Methods may not have the final declaration in classes declared as final.
73
- - The colon used with return type declarations MUST be surrounded with 1
73
+ - The colon used with return type declarations MUST be surrounded with 1
74
74
space.
75
- - Nullable and optional arguments, which are marked as ` = null ` , must have
75
+ - Nullable and optional arguments, which are marked as ` = null ` , must have
76
76
the ` ? ` symbol present.
77
- - Control Structures must have at least one statement inside of the body.
77
+ - Control Structures must have at least one statement inside of the body.
78
78
- Catch blocks may be empty.
79
79
- Catch blocks must be reachable.
80
- - Catch blocks must use ` Throwable ` instead of ` Exception ` .
80
+ - Catch blocks must use ` Throwable ` instead of ` Exception ` .
81
81
- The not (` ! ` ) operator must be followed by exactly one space.
82
82
- The ` && ` and ` || ` operators must be used instead of ` AND ` and ` OR ` .
83
83
- The null coalescing operator ` ?? ` should be used when possible.
84
84
- Assignment operators (eg ` += ` , ` .= ` ) should be used when possible.
85
- - Unused variables should not be passed to closures via ` use ` .
85
+ - Unused variables should not be passed to closures via ` use ` .
86
86
- The code may not contain unreachable code.
87
87
- The backtick operator may not be used for execution of shell commands.
88
- - Class and Interface names should be unique in a project and must have a
88
+ - Class and Interface names should be unique in a project and must have a
89
89
unique fully qualified name.
90
90
- Methods that only call the parent method should not be defined.
91
91
- Files that contain PHP code should only have PHP code and should not have
92
92
any _ "inline HTML"_ .
93
- - There must be exactly one space after a type cast.
93
+ - There must be exactly one space after a type cast.
94
94
- Constructors should be named ` __construct ` , not after the class.
95
- - The opening PHP tag should be the first item in the file.
96
- - Strings should not be concatenated together unless used in multiline for
97
- readability.
98
- - Loose ` == ` and ` != ` comparison operators should not be used. Use ` === `
95
+ - The opening PHP tag should be the first item in the file.
96
+ - Strings should not be concatenated together unless used in multiline for
97
+ readability.
98
+ - Loose ` == ` and ` != ` comparison operators should not be used. Use ` === `
99
99
and ` !== ` instead.
100
100
- Language constructs must be used without parentheses where possible.
101
101
- Short list syntax ` [...] ` should be used instead of ` list(...) ` .
102
- - Short form of type keywords must be used. i.e. ` bool ` instead of
103
- ` boolean ` , ` int ` instead of ` integer ` , etc. The ` binary ` and ` unset ` cast
102
+ - Short form of type keywords must be used. i.e. ` bool ` instead of
103
+ ` boolean ` , ` int ` instead of ` integer ` , etc. The ` binary ` and ` unset ` cast
104
104
operators are not allowed.
105
105
- Parentheses should not be used if they can be omitted.
106
106
- Semicolons ` ; ` should not be used if they can be omitted.
107
- - Variables should be returned directly instead of assigned to a variable
107
+ - Variables should be returned directly instead of assigned to a variable
108
108
which is not used.
109
- - The ` self ` keyword should be used instead of the current class name, and
109
+ - The ` self ` keyword should be used instead of the current class name, and
110
110
should not have spaces around ` :: ` .
111
- - Static methods should not use ` $this ` .
112
- - Double quote strings may only be used if they contain variables.
111
+ - Static methods should not use ` $this ` .
112
+ - Double quote strings may only be used if they contain variables.
113
113
- Strings should not be enclosed in parentheses when being echoed.
114
114
- Type casts should not have whitespace inside the parentheses.
115
- - The opening brace for functions should be on a new line with no blank
115
+ - The opening brace for functions should be on a new line with no blank
116
116
lines surrounding it.
117
- - The PHP constructs ` echo ` , ` print ` , ` return ` , ` include ` , ` include_once ` ,
117
+ - The PHP constructs ` echo ` , ` print ` , ` return ` , ` include ` , ` include_once ` ,
118
118
` require ` , ` require_once ` , and ` new ` , should have one space after them.
119
119
- The object operator ` -> ` should not have any spaces around it.
120
120
- Semicolons should not have spaces before them.
0 commit comments