You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Checks for missing property types in phpDoc `@var`.
41
-
* Checks for missing typehints in case they can be declared natively. If the phpDoc contains something that can be written as a native PHP 7.0or 7.1 typehint, this sniff reports that.
41
+
* Checks for missing typehints in case they can be declared natively. If the phpDoc contains something that can be written as a native PHP 7.0, 7.1 or 7.2 typehint, this sniff reports that.
42
42
* Checks for missing `@return` and/or native return typehint in case the method body contains `return` with a value.
43
43
* Checks for useless doc comments. If the native method declaration contains everything and the phpDoc does not add anything useful, it's reported as useless and can optionally be automatically removed with `phpcbf`.
44
44
* Some phpDocs might still be useful even if they do not add any typehint information. They can contain textual descriptions of code elements and also some meaningful annotations like `@expectException` or `@dataProvider`.
45
45
* Forces to specify what's in traversable types like `array`, `iterable` and `\Traversable`.
46
-
* Distinguishes what's possible in PHP 7.0 (scalar typehints) and PHP 7.1 (nullable types and void return typehint).
47
46
48
47
Sniff provides the following settings:
49
48
50
-
*`enableNullableTypeHints`: enforces to transform `Foo|null` in phpDoc into `?Foo` in native typehint. It's on by default if you're on PHP 7.1.
51
-
*`enableVoidTypeHint`: enforces to transform `@return void` into native `void` return typehint. It's on by default if you're on PHP 7.1.
49
+
*`enableNullableTypeHints`: enforces to transform `Foo|null` in phpDoc into `?Foo` in native typehint.
50
+
*`enableVoidTypeHint`: enforces to transform `@return void` into native `void` return typehint.
52
51
*`traversableTypeHints`: enforces which typehints must have specified contained type. E. g. if you set this to `\Doctrine\Common\Collections\Collection`, then `\Doctrine\Common\Collections\Collection` must always be supplied with the contained type: `\Doctrine\Common\Collections\Collection|Foo[]`.
53
52
*`usefulAnnotations`: prevents reporting and removing useless phpDocs if they contain an additional configured annotation like `@dataProvider`.
54
53
*`enableEachParameterAndReturnInspection`: enables inspection and fixing of `@param` and `@return` annotations separately. Useful when you only want to document parameters or return values that could not be expressed natively (i.e. member types of `array` or `Traversable`).
@@ -167,7 +166,7 @@ use LogStandard;
167
166
168
167
Sniff provides the following settings:
169
168
170
-
*`caseSensitive` - compare namespaces case sensitively, which makes this order correct:
169
+
*`caseSensitive`: compare namespaces case sensitively, which makes this order correct:
171
170
172
171
```php
173
172
use LogAware;
@@ -202,16 +201,16 @@ Sniff provides the following settings:
202
201
203
202
*`rootNamespaces` property expects configuration similar to PSR-4 - project directories mapped to certain namespaces.
204
203
*`skipDirs` are not taken into consideration when comparing a path to a namespace. For example, with the above settings, file at path `app/services/Product/Product.php` is expected to contain `Slevomat\Product\Product`, not `Slevomat\services\Product\Product`.
205
-
*`extensions` - allow different file extensions. Default is `php`.
206
-
*`ignoredNamespaces` - sniff is not performed on these namespaces
204
+
*`extensions`: allow different file extensions. Default is `php`.
205
+
*`ignoredNamespaces`: sniff is not performed on these namespaces.
In PHP 7.1 it's possible to declare [visibility of class constants](https://wiki.php.net/rfc/class_const_visibility). In a similar vein to optional declaration of visibility for properties and methods which is actually required in sane coding standards, this sniff also requires declaring visibility for all class constants.
209
+
In PHP 7.1+ it's possible to declare [visibility of class constants](https://wiki.php.net/rfc/class_const_visibility). In a similar vein to optional declaration of visibility for properties and methods which is actually required in sane coding standards, this sniff also requires declaring visibility for all class constants.
211
210
212
211
Sniff provides the following settings:
213
212
214
-
*`fixable`: the sniff is not fixable by default because we think it's better to decide about each constant one by one however you can enable fixability with this option
213
+
*`fixable`: the sniff is not fixable by default because we think it's better to decide about each constant one by one however you can enable fixability with this option.
215
214
216
215
```php
217
216
const FOO = 1; // visibility missing!
@@ -228,7 +227,7 @@ function foo(): ?int
228
227
229
228
Sniff provides the following settings:
230
229
231
-
*`spacesCountBeforeColon` - the number of spaces expected between closing brace and colon
230
+
*`spacesCountBeforeColon`: the number of spaces expected between closing brace and colon.
@@ -383,14 +382,14 @@ Enforces fully qualified names of classes and interfaces in phpDocs - in `@var`,
383
382
384
383
Reports forbidden annotations. No annotations are forbidden by default, the configuration is completely up to the user. It's recommended to forbid obsolete and inappropriate annotations like:
385
384
386
-
*`@author`, `@created`, `@version` - we have version control systems
387
-
*`@package` - we have namespaces
388
-
*`@copyright`, `@license` - it's not necessary to repeat licensing information in each file
389
-
*`@throws` - it's not possible to enforce this annotation and the information can become outdated
385
+
*`@author`, `@created`, `@version`: we have version control systems.
386
+
*`@package`: we have namespaces.
387
+
*`@copyright`, `@license`: it's not necessary to repeat licensing information in each file.
388
+
*`@throws`: it's not possible to enforce this annotation and the information can become outdated.
390
389
391
390
Sniff provides the following settings:
392
391
393
-
*`forbiddenAnnotations`: allows to configure which annotations are forbidden to be used
392
+
*`forbiddenAnnotations`: allows to configure which annotations are forbidden to be used.
0 commit comments