@@ -150,6 +150,8 @@ Structure
150
150
* Use ``return null; `` when a function explicitly returns ``null `` values and
151
151
use ``return; `` when the function returns ``void `` values;
152
152
153
+ * Do not add the ``void `` return type to methods in tests;
154
+
153
155
* Use braces to indicate control structure body regardless of the number of
154
156
statements it contains;
155
157
@@ -253,19 +255,28 @@ Service Naming Conventions
253
255
Documentation
254
256
~~~~~~~~~~~~~
255
257
256
- * Add PHPDoc blocks for all classes, methods, and functions (though you may
257
- be asked to remove PHPDoc that do not add value);
258
+ * Add PHPDoc blocks for classes, methods, and functions only when they add
259
+ relevant information that does not duplicate the name, native type
260
+ declaration or context (e.g. ``instanceof `` checks);
261
+
262
+ * Only use annotations and types defined in `the PHPDoc reference `_. In
263
+ order to improve types for static analysis, the following annotations are
264
+ also allowed:
265
+
266
+ * `Generics `_, with the exception of ``@template-covariant ``.
267
+ * `Conditional return types `_ using the vendor-prefixed ``@psalm-return ``;
268
+ * `Class constants `_;
269
+ * `Callable types `_;
258
270
259
271
* Group annotations together so that annotations of the same type immediately
260
272
follow each other, and annotations of a different type are separated by a
261
273
single blank line;
262
274
263
- * Omit the ``@return `` tag if the method does not return anything;
264
-
265
- * The ``@package `` and ``@subpackage `` annotations are not used;
275
+ * Omit the ``@return `` annotation if the method does not return anything;
266
276
267
- * Don't inline PHPDoc blocks, even when they contain just one tag (e.g. don't
268
- put ``/** {@inheritdoc} */ `` in a single line);
277
+ * Don't use one-line PHPDoc blocks on classes, methods and functions, even
278
+ when they contain just one annotation (e.g. don't put ``/** {@inheritdoc} */ ``
279
+ in a single line);
269
280
270
281
* When adding a new class or when making significant changes to an existing class,
271
282
an ``@author `` tag with personal contact information may be added, or expanded.
@@ -291,3 +302,8 @@ License
291
302
.. _`snake_case` : https://en.wikipedia.org/wiki/Snake_case
292
303
.. _`constructor property promotion` : https://www.php.net/manual/en/language.oop5.decon.php#language.oop5.decon.constructor.promotion
293
304
.. _`trailing comma` : https://wiki.php.net/rfc/trailing_comma_in_parameter_list
305
+ .. _`the PHPDoc reference` : https://docs.phpdoc.org/3.0/guide/references/phpdoc/index.html
306
+ .. _`Conditional return types` : https://psalm.dev/docs/annotating_code/type_syntax/conditional_types/
307
+ .. _`Class constants` : https://psalm.dev/docs/annotating_code/type_syntax/value_types/#regular-class-constants
308
+ .. _`Callable types` : https://psalm.dev/docs/annotating_code/type_syntax/callable_types/
309
+ .. _`Generics` : https://psalm.dev/docs/annotating_code/templated_annotations/
0 commit comments