2020-08-30 14:45:03 +02:00
|
|
|
<?php
|
|
|
|
|
2021-05-09 20:15:43 +00:00
|
|
|
declare (strict_types=1);
|
2020-08-30 14:45:03 +02:00
|
|
|
namespace Rector\Order\ValueObject;
|
|
|
|
|
|
|
|
use PhpParser\Node\Stmt\Property;
|
|
|
|
use Rector\Order\Contract\RankeableInterface;
|
2021-05-10 22:23:08 +00:00
|
|
|
final class PropertyRankeable implements \Rector\Order\Contract\RankeableInterface
|
2020-08-30 14:45:03 +02:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
private $name;
|
|
|
|
/**
|
|
|
|
* @var int
|
|
|
|
*/
|
|
|
|
private $visibility;
|
|
|
|
/**
|
2021-05-10 23:39:21 +00:00
|
|
|
* @var \PhpParser\Node\Stmt\Property
|
2020-08-30 14:45:03 +02:00
|
|
|
*/
|
2021-05-10 23:39:21 +00:00
|
|
|
private $property;
|
2020-08-30 14:45:03 +02:00
|
|
|
/**
|
2021-05-10 23:39:21 +00:00
|
|
|
* @var int
|
2020-08-30 14:45:03 +02:00
|
|
|
*/
|
2021-05-10 23:39:21 +00:00
|
|
|
private $position;
|
2021-05-10 22:23:08 +00:00
|
|
|
public function __construct(string $name, int $visibility, \PhpParser\Node\Stmt\Property $property, int $position)
|
2020-08-30 14:45:03 +02:00
|
|
|
{
|
|
|
|
$this->name = $name;
|
|
|
|
$this->visibility = $visibility;
|
|
|
|
$this->property = $property;
|
|
|
|
$this->position = $position;
|
|
|
|
}
|
2021-05-09 20:15:43 +00:00
|
|
|
public function getName() : string
|
2020-08-30 14:45:03 +02:00
|
|
|
{
|
|
|
|
return $this->name;
|
|
|
|
}
|
2020-09-01 19:56:30 +02:00
|
|
|
/**
|
|
|
|
* @return bool[]|int[]
|
|
|
|
*/
|
2021-05-09 20:15:43 +00:00
|
|
|
public function getRanks() : array
|
2020-08-30 14:45:03 +02:00
|
|
|
{
|
|
|
|
return [$this->visibility, $this->property->isStatic(), $this->position];
|
|
|
|
}
|
|
|
|
}
|