phpdoc_var_without_name.rst 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. ================================
  2. Rule ``phpdoc_var_without_name``
  3. ================================
  4. ``@var`` and ``@type`` annotations of classy properties should not contain the
  5. name.
  6. Examples
  7. --------
  8. Example #1
  9. ~~~~~~~~~~
  10. .. code-block:: diff
  11. --- Original
  12. +++ New
  13. <?php
  14. final class Foo
  15. {
  16. /**
  17. - * @var int $bar
  18. + * @var int
  19. */
  20. public $bar;
  21. /**
  22. - * @type $baz float
  23. + * @type float
  24. */
  25. public $baz;
  26. }
  27. Rule sets
  28. ---------
  29. The rule is part of the following rule sets:
  30. - `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_
  31. - `@Symfony <./../../ruleSets/Symfony.rst>`_
  32. References
  33. ----------
  34. - Fixer class: `PhpCsFixer\\Fixer\\Phpdoc\\PhpdocVarWithoutNameFixer <./../../../src/Fixer/Phpdoc/PhpdocVarWithoutNameFixer.php>`_
  35. - Test class: `PhpCsFixer\\Tests\\Fixer\\Phpdoc\\PhpdocVarWithoutNameFixerTest <./../../../tests/Fixer/Phpdoc/PhpdocVarWithoutNameFixerTest.php>`_
  36. The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.