"Missing @property annotations" inspection improvements
brandonkelly opened this issue · comments
Before I get into the actual FR, some definitions:
-
Getter: A
getX()
method on a class that extendsyii\base\BaseObject
, without any required arguments, whichyii\base\BaseObject::__get()
will call when$obj->x
is accessed.// valid: public function getAuthor() public function getAuthor($arg = 'default') // invalid: public function getauthor() // lowercase 'a' public function getAuthor($arg) // $arg is required
-
Setter: A
setX()
method on a class that extendsyii\base\BaseObject
, with one required argument (the first one), whichyii\base\BaseObject::__set()
will call when$obj->x
is set to something.// valid: public function setAuthor($arg) public function setAuthor($arg1, $arg2 = 'default') // invalid: public function setauthor() // lowercase 'a' public function setAuthor() // no required argument public function setAuthor($arg1, $arg2) // $arg2 is required
If a getter exists but no corresponding setter, the "Missing @Property annotations" inspection should create a @property-read
tag instead of @property
.
If a setter exists but no corresponding getter, then a @property-write
tag should be created instead of @property
.
If both exist, then continue to create a @property
tag.