2020-08-23 11:39:09 +02:00
|
|
|
<?php
|
|
|
|
|
2021-05-09 20:15:43 +00:00
|
|
|
declare (strict_types=1);
|
2020-08-23 11:39:09 +02:00
|
|
|
namespace Rector\Renaming\ValueObject;
|
|
|
|
|
2021-02-27 03:13:22 +01:00
|
|
|
use PHPStan\Type\ObjectType;
|
2020-09-12 23:19:08 +02:00
|
|
|
final class RenameStaticMethod
|
2020-08-23 11:39:09 +02:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
private $oldClass;
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
private $oldMethod;
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
private $newClass;
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
private $newMethod;
|
|
|
|
public function __construct(string $oldClass, string $oldMethod, string $newClass, string $newMethod)
|
|
|
|
{
|
|
|
|
$this->oldClass = $oldClass;
|
|
|
|
$this->oldMethod = $oldMethod;
|
|
|
|
$this->newClass = $newClass;
|
|
|
|
$this->newMethod = $newMethod;
|
|
|
|
}
|
2021-05-10 22:10:16 +00:00
|
|
|
public function getOldObjectType() : ObjectType
|
2020-08-23 11:39:09 +02:00
|
|
|
{
|
2021-05-10 22:10:16 +00:00
|
|
|
return new ObjectType($this->oldClass);
|
2020-08-23 11:39:09 +02:00
|
|
|
}
|
2021-05-09 20:15:43 +00:00
|
|
|
public function getOldMethod() : string
|
2020-08-23 11:39:09 +02:00
|
|
|
{
|
|
|
|
return $this->oldMethod;
|
|
|
|
}
|
2021-05-09 20:15:43 +00:00
|
|
|
public function getNewClass() : string
|
2020-08-23 11:39:09 +02:00
|
|
|
{
|
|
|
|
return $this->newClass;
|
|
|
|
}
|
2021-05-09 20:15:43 +00:00
|
|
|
public function getNewMethod() : string
|
2020-08-23 11:39:09 +02:00
|
|
|
{
|
|
|
|
return $this->newMethod;
|
|
|
|
}
|
2021-05-09 20:15:43 +00:00
|
|
|
public function hasClassChanged() : bool
|
2020-08-23 11:39:09 +02:00
|
|
|
{
|
|
|
|
return $this->oldClass !== $this->newClass;
|
|
|
|
}
|
|
|
|
}
|