Add failing test case for use of $this in the same class.

This commit is contained in:
Aerendir 2020-03-06 17:58:37 +01:00
parent 5a5d5dc340
commit 08b681999e
2 changed files with 52 additions and 2 deletions

View File

@ -15,7 +15,7 @@ class ThisA
}
}
class UseOfThis extends ThisA
class UseOfThisInherited extends ThisA
{
public function thisMethodUsesAThisThatThrowsAnException()
{
@ -42,7 +42,7 @@ class ThisA
}
}
class UseOfThis extends ThisA
class UseOfThisInherited extends ThisA
{
/**
* @throws \Rector\CodingStyle\Tests\Rector\Throw_\AnnotateThrowablesRector\Source\Exceptions\TheException

View File

@ -0,0 +1,50 @@
<?php
namespace Rector\CodingStyle\Tests\Rector\Throw_\AnnotateThrowablesRector\Fixture;
use Rector\CodingStyle\Tests\Rector\Throw_\AnnotateThrowablesRector\Source\Exceptions\TheException;
class UseOfThisSameClass
{
/**
* @throws TheException
*/
public function thisMethodThrowsAnException():string
{
throw new TheException('');
}
public function thisMethodUsesAThisThatThrowsAnException()
{
$this->thisMethodThrowsAnException();
}
}
?>
-----
<?php
namespace Rector\CodingStyle\Tests\Rector\Throw_\AnnotateThrowablesRector\Fixture;
use Rector\CodingStyle\Tests\Rector\Throw_\AnnotateThrowablesRector\Source\Exceptions\TheException;
class UseOfThisSameClass
{
/**
* @throws TheException
*/
public function thisMethodThrowsAnException():string
{
throw new TheException('');
}
/**
* @throws \Rector\CodingStyle\Tests\Rector\Throw_\AnnotateThrowablesRector\Source\Exceptions\TheException
*/
public function thisMethodUsesAThisThatThrowsAnException()
{
$this->thisMethodThrowsAnException();
}
}
?>