Skip to content

Latest commit

 

History

History
45 lines (33 loc) · 983 Bytes

phpdoc_to_param_type.rst

File metadata and controls

45 lines (33 loc) · 983 Bytes

Rule phpdoc_to_param_type

EXPERIMENTAL: Takes @param annotations of non-mixed types and adjusts accordingly the function signature. Requires PHP >= 7.0.

Warning

Using this rule is risky.

This rule is EXPERIMENTAL and [1] is not covered with backward compatibility promise. [2] @param annotation is mandatory for the fixer to make changes, signatures of methods without it (no docblock, inheritdocs) will not be fixed. [3] Manual actions are required if inherited signatures are not properly documented.

Examples

Example #1

--- Original
+++ New
 <?php

 /** @param string $bar */
-function my_foo($bar)
+function my_foo(string $bar)
 {}

Example #2

--- Original
+++ New
 <?php

 /** @param string|null $bar */
-function my_foo($bar)
+function my_foo(?string $bar)
 {}