Closed Metalaka closed 8 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!
A constructor never return anything. It's not an explicit stuff, it's a useless stuff.
@marmotz It's consistent with other method at least. Since it returns nothing, we can say it returns nothing.
@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:
self
@return self
seems better for me.
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.
So let's go for a @return
removal if set to void
?
+1 @jubianchi
@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.
Exactly what i say in my very first comment :)
ping?
@Hywan look at #29
Commented #29.
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 :)