hoaproject / Devtools

The Hoa\Devtools library.
https://hoa-project.net/
6 stars 6 forks source link

cs-fixer: remove constructors return tag. #12

Closed Metalaka closed 8 years ago

Metalaka commented 9 years ago

I propose to add a cs-fixer which remove the PHPDoc @return tag of constructors. Since they are optional and current @return void is invalid, it can be a good thing :)

Hywan commented 9 years ago

@return void is not invalid as far as I know, it can just be ommited. And I like explicit stuff, so I would go for :-1: but we can ask other @hoaproject/hoackers!

marmotz commented 9 years ago

A constructor never return anything. It's not an explicit stuff, it's a useless stuff.

Hywan commented 9 years ago

@marmotz It's consistent with other method at least. Since it returns nothing, we can say it returns nothing.

Metalaka commented 9 years ago

@return void is not invalid as far as I know

constructors, the @return tag MAY be omitted here, in which case @return self is implied.

IMO, that mean the only valid value for a constructor is self.

So, solutions are:

Hywan commented 9 years ago

@return self seems better for me.

jubianchi commented 9 years ago

IMHO, return self is useless: we all know the constructor implicitly returns (through new) an instace of the class.

Such metadata is not useful for IDEs (they already handle everything the right way) or for doc generators (developers know what a constructor does). It will just create more work but no value.

Hywan commented 9 years ago

So let's go for a @return removal if set to void?

marmotz commented 9 years ago

+1 @jubianchi

jubianchi commented 9 years ago

@Hywan :+1:

return void makes sense on methods, even if modern IDEs handle this case when they do not find any return statement, I think it might be useful for documentation.

My only concern was about @return on constructors.

marmotz commented 9 years ago

Exactly what i say in my very first comment :)

Hywan commented 8 years ago

ping?

Metalaka commented 8 years ago

@Hywan look at #29

Hywan commented 8 years ago

Commented #29.