It would be cool to have fixer like this:
/**
* Constructor.
*
* @param CurrencyDataTransformer $currencyTransformer
*/
public function __construct(CurrencyDataTransformer $currencyTransformer)
{
$this->currencyTransformer = $currencyTransformer;
}
/**
* @param CurrencyDataTransformer $currencyTransformer
*/
public function __construct(CurrencyDataTransformer $currencyTransformer)
{
$this->currencyTransformer = $currencyTransformer;
}
because Constructor. is useless imo, or is this still possible?
Best regards and thank you,
Oskar
I would say your sample PHPDoc is overcomplete as a whole ;)
Anyway removing 'Constructor' (with or without trailing dot) as PHPDoc summary from constructors is fine by me :)
Removing @return annotations from constructors as well would be nice, but might be out-of-scope of the PR, although having a NoUselessStuffInAPHPDocOfConstructorsFixer could contain both ;)
not only constructor is a case.
/**
* Class Foo.
*/
final class Foo
{
/**
* Constructor
*/
public function __construct() {}
/**
* Destructor
*/
public function __destruct() {}
}
@OskarStark , could you send a PR with proposal ?
Is there a fixer which could be used as an example to start working on a PR?
I would go for;
https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/2.0/src/Fixer/Phpdoc/PhpdocAddMissingParamAnnotationFixer.php
that fixer
so I think most parts that you need are in there, however there is also a lot of stuff in there you can ignore as it is unrelated to the what the new fixer needs.
@OskarStark , could you send a PR with proposal ?
I checked the example, but to be honest, I currently don't have enough time to dive into it
not only constructor is a case.
you are right, with the Destructor and the * Class .... stuff, another thing could be:
/**
* Foo <- without the 'Class' prefix
*/
class Foo {
// ...
}
Could be helpful ;-)
Sadly, I don't see how. Please provide more details.
Perhaps, you did that PR with using custom fixer you did already wrote and you want to share it with community ? :)
Sadly, I don't see how. Please provide more details.
it seems to be needed by the community :)
Perhaps, you did that PR with using custom fixer you did already wrote and you want to share it with community ? :)
No, this was just a sed replace and some manual adjustements
Manual work is not helping us in any way. About willingness to follow the rule by some community - we already accepted the idea of this rule and we are willing to have PR for it opened, especially by the community that need it. So... go ahead @OskarStark ! We will help by reviewing ;)
This would be fantastic!
If even comments like this could be removed:
// Do foo
$this->foo();
that would be amazing. I've seen other tools do this but I had no luck finding them again.
Most helpful comment
Manual work is not helping us in any way. About willingness to follow the rule by some community - we already accepted the idea of this rule and we are willing to have PR for it opened, especially by the community that need it. So... go ahead @OskarStark ! We will help by reviewing ;)