I am working on a Symfony project with objects managed by Doctrine. Below is the code from my object:
class User { private $appointments; public function getAppointments() { return $this->appointments; } public function getAppointmentsAtDate(\DateTime $date) { $allAppointments = $this->getAppointments(); $criteria = Criteria::create()->where(); return $allAppointments ->matching($criteria); } }
getAppointments automatically generated by Doctrine. The getAppointmentsAtDate method was implemented by me. The PHPDoc header method was automatically generated by PhpStorm.
What I cannot understand is the static in my return type.
From my understanding of types, PHPDoc static means that this method returns an instance of the class on which it was called, in this case a User .
However, I do not see how this method can ever return a User instance or anything other than a Collection instance.
So what does the static keyword mean here? Is my understanding of the keyword spoiled? Or just the title of a phpStorm auto-generated document is simply wrong?
Chris source share