it would be great if rector could fix invalid php docs.
for code like
/**
* child-classes have to return the correct url-parameters according to their handled objects.
*
* @param
* $object
*/
abstract protected function getUrlParameters($object);
phpstan emits errors like (see https://github.com/phpstan/phpstan/issues/2558)
message: "#^PHPDoc tag @param has invalid value \\(\\)\\: Unexpected token \"\\\\r\\\\n \\*\", expected TOKEN_IDENTIFIER at offset 126$#"
count: 1
path: lib\clxVergleich.php
it would be cool if rector could fix this code to e.g.
/**
* child-classes have to return the correct url-parameters according to their handled objects.
*
* @param $object
*/
abstract protected function getUrlParameters($object);
Php CS Fixer can do this 馃槃
@plumthedev thx for the hint.. can you point me to the fixer which does the job?`
As far as I can see __rector__ don't have friendsofphp/php-cs-fixer dependency. First you must install it.
$ composer global require friendsofphp/php-cs-fixer
Now you should create a config file .php_cs and insert code standards rules for project, exclude vendors/node_modules/etc...
The config options which solves your problem:
align_multiline_comment - Phpdocs comments start with an asteriskphpdoc_align - All items of the given phpdoc tags must be either left-aligned or (by default) aligned vertically.phpdoc_trim_consecutive_blank_line_separation - Removes extra blank lines after summary and after description in PHPDoc.PHP CS Fixer also have default config values which cleanup code and makes it better!
Take a look here.
Thanks for the idea!
This will be supported in the near future, as php-cs-fixer is very limited to string tokens in this.
We use much advanced tool that parses tokens with lexer - https://github.com/phpstan/phpdoc-parser
See similar issues:
@TomasVotruba if it's not a problem, I can deal with it after the new year 馃榾
Closing as better scope for coding standards. Let's stay with PHP code for now
Most helpful comment
Thanks for the idea!
This will be supported in the near future, as php-cs-fixer is very limited to string tokens in this.
We use much advanced tool that parses tokens with lexer - https://github.com/phpstan/phpdoc-parser
See similar issues: