mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-24 03:35:01 +01:00
Merge pull request #2650 from gnutix/CountOnNullRector/should-understand-variables-in-trait-methods
[CountOnNullRector] Should understand array/countable variable in trait method
This commit is contained in:
commit
49eb6ef5f7
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Php71\Tests\Rector\FuncCall\CountOnNullRector\Fixture;
|
||||
|
||||
trait PropertyWithinTraitMethod
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $array = [];
|
||||
|
||||
public function run()
|
||||
{
|
||||
return count($this->array);
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\Php71\Tests\Rector\FuncCall\CountOnNullRector\Fixture;
|
||||
|
||||
use Rector\Php71\Tests\Rector\FuncCall\CountOnNullRector\Source\CountableClass;
|
||||
|
||||
trait VariableWithinTraitMethod
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$array = [];
|
||||
$countable = new CountableClass();
|
||||
|
||||
return
|
||||
count($array)
|
||||
+
|
||||
count($countable)
|
||||
;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user