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