andkirby / commithook

CommitHooks code validation and auto-formatting commit message.
GNU General Public License v3.0
7 stars 3 forks source link

Check if @return tag returns $this on returning parent method which returns $this. #20

Closed andkirby closed 8 years ago

andkirby commented 9 years ago

We have class A which use old way in return - it returns class name. Cutting edge PHPStorm support $this.

//in library - DO NOT touch!
class Class_A
{
    /**
     * @return Class_A
     */
    public function method()
    {
        return $this;
    }
}

//your class
class Class_B extends Class_A
{
    /**
     * This "return" will generate PHPStorm.
     *
     * @return \Class_A
     */
    public function method()
    {
        return parent::method();
    }
}

Need to match @return \Class_A and propose to use @return $this.

andkirby commented 9 years ago

Done.

andkirby commented 8 years ago

Done.