mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-28 13:43:31 +00:00
dea8c30c8e
63425bae22
[Transform] Make ParentClassToTraitsRector match only exact parent, no its child (#1774)
39 lines
775 B
PHP
39 lines
775 B
PHP
<?php
|
|
|
|
declare (strict_types=1);
|
|
namespace Rector\Transform\ValueObject;
|
|
|
|
final class ParentClassToTraits
|
|
{
|
|
/**
|
|
* @readonly
|
|
* @var string
|
|
*/
|
|
private $parentType;
|
|
/**
|
|
* @var string[]
|
|
* @readonly
|
|
*/
|
|
private $traitNames;
|
|
/**
|
|
* @param string[] $traitNames
|
|
*/
|
|
public function __construct(string $parentType, array $traitNames)
|
|
{
|
|
$this->parentType = $parentType;
|
|
$this->traitNames = $traitNames;
|
|
}
|
|
public function getParentType() : string
|
|
{
|
|
return $this->parentType;
|
|
}
|
|
/**
|
|
* @return string[]
|
|
*/
|
|
public function getTraitNames() : array
|
|
{
|
|
// keep the Trait order the way it is in config
|
|
return \array_reverse($this->traitNames);
|
|
}
|
|
}
|