mirror of https://github.com/rectorphp/rector.git
Updated Rector to commit 6477094d5af502e65c75c30af7ce59ef3b8cc2d7
6477094d5a
Update ArrayDimFetchToMethodCall to use ObjectType (#5728)
This commit is contained in:
parent
d5d197b9bf
commit
dd371cdca2
|
@ -32,7 +32,7 @@ CODE_SAMPLE
|
||||||
, <<<'CODE_SAMPLE'
|
, <<<'CODE_SAMPLE'
|
||||||
$app->make('someService');
|
$app->make('someService');
|
||||||
CODE_SAMPLE
|
CODE_SAMPLE
|
||||||
, [new ArrayDimFetchToMethodCall('SomeClass', 'make')])]);
|
, [new ArrayDimFetchToMethodCall(new ObjectType('SomeClass'), 'make')])]);
|
||||||
}
|
}
|
||||||
public function getNodeTypes() : array
|
public function getNodeTypes() : array
|
||||||
{
|
{
|
||||||
|
@ -50,7 +50,7 @@ CODE_SAMPLE
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
foreach ($this->arrayDimFetchToMethodCalls as $arrayDimFetchToMethodCall) {
|
foreach ($this->arrayDimFetchToMethodCalls as $arrayDimFetchToMethodCall) {
|
||||||
if (!$this->isObjectType($node->var, new ObjectType($arrayDimFetchToMethodCall->getClass()))) {
|
if (!$this->isObjectType($node->var, $arrayDimFetchToMethodCall->getObjectType())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
return new MethodCall($node->var, $arrayDimFetchToMethodCall->getMethod(), [new Arg($node->dim)]);
|
return new MethodCall($node->var, $arrayDimFetchToMethodCall->getMethod(), [new Arg($node->dim)]);
|
||||||
|
|
|
@ -3,26 +3,27 @@
|
||||||
declare (strict_types=1);
|
declare (strict_types=1);
|
||||||
namespace Rector\Transform\ValueObject;
|
namespace Rector\Transform\ValueObject;
|
||||||
|
|
||||||
|
use PHPStan\Type\ObjectType;
|
||||||
class ArrayDimFetchToMethodCall
|
class ArrayDimFetchToMethodCall
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @readonly
|
* @readonly
|
||||||
* @var string
|
* @var \PHPStan\Type\ObjectType
|
||||||
*/
|
*/
|
||||||
private $class;
|
private $objectType;
|
||||||
/**
|
/**
|
||||||
* @readonly
|
* @readonly
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $method;
|
private $method;
|
||||||
public function __construct(string $class, string $method)
|
public function __construct(ObjectType $objectType, string $method)
|
||||||
{
|
{
|
||||||
$this->class = $class;
|
$this->objectType = $objectType;
|
||||||
$this->method = $method;
|
$this->method = $method;
|
||||||
}
|
}
|
||||||
public function getClass() : string
|
public function getObjectType() : ObjectType
|
||||||
{
|
{
|
||||||
return $this->class;
|
return $this->objectType;
|
||||||
}
|
}
|
||||||
public function getMethod() : string
|
public function getMethod() : string
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const PACKAGE_VERSION = 'd9b64c78e33ef461605ac08578c8159b01839c98';
|
public const PACKAGE_VERSION = '6477094d5af502e65c75c30af7ce59ef3b8cc2d7';
|
||||||
/**
|
/**
|
||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const RELEASE_DATE = '2024-03-16 16:08:50';
|
public const RELEASE_DATE = '2024-03-16 17:30:11';
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue