Reputation: 4183
In PHP it's common to type annotate variables like this:
/**
* @var boolean
*/
protected $isLoaded;
But what about the return types in functions? Does PHP Type Annotation support the return type of a function?
If so, how can I annotate the return type of the function in class diagram
-getName(): String
?
I would expect something like:
/**
* @return String
*/
private function getName() {}
But it's ignored.
Upvotes: 0
Views: 939
Reputation: 4715
That would just be:
/**
* @return string
*/
private function getName(): string {}
The annotation is optional at this point.
Upvotes: 1