
phpdoc_return_self_reference
¶The type of @return
annotations of methods returning a reference to itself
must the configured one.
replacements
¶Mapping between replaced return types with new ones.
Allowed types: array
Default value: ['this' => '$this', '@this' => '$this', '$self' => 'self', '@self' => 'self', '$static' => 'static', '@static' => 'static']
Default configuration.
--- Original
+++ New
<?php
class Sample
{
/**
- * @return this
+ * @return $this
*/
public function test1()
{
return $this;
}
/**
- * @return $self
+ * @return self
*/
public function test2()
{
return $this;
}
}
With configuration: ['replacements' => ['this' => 'self']]
.
--- Original
+++ New
<?php
class Sample
{
/**
- * @return this
+ * @return self
*/
public function test1()
{
return $this;
}
/**
* @return $self
*/
public function test2()
{
return $this;
}
}