remove old manual nodes

This commit is contained in:
TomasVotruba 2020-01-12 22:24:38 +01:00
parent ded6e13996
commit ef982e3df3
82 changed files with 1138 additions and 356 deletions

View File

@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\PhpDoc;
final class AttributeAwareGenericTagValueNode extends \PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode implements \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface
{
use \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
}

View File

@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\PhpDoc;
final class AttributeAwareImplementsTagValueNode extends \PHPStan\PhpDocParser\Ast\PhpDoc\ImplementsTagValueNode implements \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface
{
use \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
}

View File

@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\PhpDoc;
final class AttributeAwareInvalidTagValueNode extends \PHPStan\PhpDocParser\Ast\PhpDoc\InvalidTagValueNode implements \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface
{
use \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
}

View File

@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\PhpDoc;
final class AttributeAwareMethodTagValueNode extends \PHPStan\PhpDocParser\Ast\PhpDoc\MethodTagValueNode implements \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface
{
use \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
}

View File

@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\PhpDoc;
final class AttributeAwareMethodTagValueParameterNode extends \PHPStan\PhpDocParser\Ast\PhpDoc\MethodTagValueParameterNode implements \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface
{
use \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
}

View File

@ -4,14 +4,11 @@ declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\PhpDoc;
use PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode;
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
use Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
final class AttributeAwareParamTagValueNode extends ParamTagValueNode implements AttributeAwareNodeInterface
final class AttributeAwareParamTagValueNode extends \PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode implements \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface
{
use AttributeTrait;
use \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
/**
* @var bool

View File

@ -5,13 +5,11 @@ declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\PhpDoc;
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocChildNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode;
use Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
final class AttributeAwarePhpDocNode extends PhpDocNode implements AttributeAwareNodeInterface
final class AttributeAwarePhpDocNode extends \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode implements \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface
{
use AttributeTrait;
use \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
/**
* @var PhpDocChildNode[]|AttributeAwareNodeInterface[]

View File

@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\PhpDoc;
final class AttributeAwarePhpDocTagNode extends \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode implements \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface
{
use \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
}

View File

@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\PhpDoc;
final class AttributeAwarePhpDocTextNode extends \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTextNode implements \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface
{
use \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
}

View File

@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\PhpDoc;
final class AttributeAwarePropertyTagValueNode extends \PHPStan\PhpDocParser\Ast\PhpDoc\PropertyTagValueNode implements \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface
{
use \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
}

View File

@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\PhpDoc;
final class AttributeAwareReturnTagValueNode extends \PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode implements \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface
{
use \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
}

View File

@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\PhpDoc;
final class AttributeAwareTemplateTagValueNode extends \PHPStan\PhpDocParser\Ast\PhpDoc\TemplateTagValueNode implements \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface
{
use \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
}

View File

@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\PhpDoc;
final class AttributeAwareThrowsTagValueNode extends \PHPStan\PhpDocParser\Ast\PhpDoc\ThrowsTagValueNode implements \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface
{
use \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
}

View File

@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\PhpDoc;
final class AttributeAwareUsesTagValueNode extends \PHPStan\PhpDocParser\Ast\PhpDoc\UsesTagValueNode implements \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface
{
use \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
}

View File

@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\PhpDoc;
final class AttributeAwareVarTagValueNode extends \PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode implements \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface
{
use \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
}

View File

@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\Type;
final class AttributeAwareArrayShapeItemNode extends \PHPStan\PhpDocParser\Ast\Type\ArrayShapeItemNode implements \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface
{
use \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
}

View File

@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\Type;
final class AttributeAwareArrayShapeNode extends \PHPStan\PhpDocParser\Ast\Type\ArrayShapeNode implements \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface
{
use \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
}

View File

@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\Type;
final class AttributeAwareArrayTypeNode extends \PHPStan\PhpDocParser\Ast\Type\ArrayTypeNode implements \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface
{
use \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
}

View File

@ -0,0 +1,15 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\Type;
final class AttributeAwareCallableTypeNode extends \PHPStan\PhpDocParser\Ast\Type\CallableTypeNode implements \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface
{
use \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
public function __toString(): string
{
return 'callable';
}
}

View File

@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\Type;
final class AttributeAwareCallableTypeParameterNode extends \PHPStan\PhpDocParser\Ast\Type\CallableTypeParameterNode implements \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface
{
use \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
}

View File

@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\Type;
final class AttributeAwareGenericTypeNode extends \PHPStan\PhpDocParser\Ast\Type\GenericTypeNode implements \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface
{
use \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
}

View File

@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\Type;
final class AttributeAwareIdentifierTypeNode extends \PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode implements \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface
{
use \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
}

View File

@ -0,0 +1,15 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\Type;
final class AttributeAwareIntersectionTypeNode extends \PHPStan\PhpDocParser\Ast\Type\IntersectionTypeNode implements \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface
{
use \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
public function __toString(): string
{
return implode('&', $this->types);
}
}

View File

@ -0,0 +1,15 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\Type;
final class AttributeAwareNullableTypeNode extends \PHPStan\PhpDocParser\Ast\Type\NullableTypeNode implements \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface
{
use \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
public function __toString(): string
{
return $this->type . '|null';
}
}

View File

@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\Type;
final class AttributeAwareThisTypeNode extends \PHPStan\PhpDocParser\Ast\Type\ThisTypeNode implements \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface
{
use \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
}

View File

@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\Type;
final class AttributeAwareUnionTypeNode extends \PHPStan\PhpDocParser\Ast\Type\UnionTypeNode implements \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface
{
use \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
/**
* Preserve common format
*/
public function __toString(): string
{
return implode('|', $this->types);
}
}

View File

@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\PhpDoc;
final class AttributeAwareDeprecatedTagValueNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
{
public function getOriginalNodeClass(): string
{
return \PHPStan\PhpDocParser\Ast\PhpDoc\DeprecatedTagValueNode::class;
}
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
{
return is_a($node, \PHPStan\PhpDocParser\Ast\PhpDoc\DeprecatedTagValueNode::class, true);
}
/**
* @param \PHPStan\PhpDocParser\Ast\PhpDoc\DeprecatedTagValueNode $node
*/
public function create(
\PHPStan\PhpDocParser\Ast\Node $node
): \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface {
return new \Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareDeprecatedTagValueNode($node->description);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\PhpDoc;
final class AttributeAwareExtendsTagValueNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
{
public function getOriginalNodeClass(): string
{
return \PHPStan\PhpDocParser\Ast\PhpDoc\ExtendsTagValueNode::class;
}
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
{
return is_a($node, \PHPStan\PhpDocParser\Ast\PhpDoc\ExtendsTagValueNode::class, true);
}
/**
* @param \PHPStan\PhpDocParser\Ast\PhpDoc\ExtendsTagValueNode $node
*/
public function create(
\PHPStan\PhpDocParser\Ast\Node $node
): \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface {
return new \Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareExtendsTagValueNode(
$node->type,
$node->description
);
}
}

View File

@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\PhpDoc;
final class AttributeAwareGenericTagValueNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
{
public function getOriginalNodeClass(): string
{
return \PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode::class;
}
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
{
return is_a($node, \PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode::class, true);
}
/**
* @param \PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode $node
*/
public function create(
\PHPStan\PhpDocParser\Ast\Node $node
): \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface {
return new \Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareGenericTagValueNode($node->value);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\PhpDoc;
final class AttributeAwareImplementsTagValueNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
{
public function getOriginalNodeClass(): string
{
return \PHPStan\PhpDocParser\Ast\PhpDoc\ImplementsTagValueNode::class;
}
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
{
return is_a($node, \PHPStan\PhpDocParser\Ast\PhpDoc\ImplementsTagValueNode::class, true);
}
/**
* @param \PHPStan\PhpDocParser\Ast\PhpDoc\ImplementsTagValueNode $node
*/
public function create(
\PHPStan\PhpDocParser\Ast\Node $node
): \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface {
return new \Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareImplementsTagValueNode(
$node->type,
$node->description
);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\PhpDoc;
final class AttributeAwareInvalidTagValueNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
{
public function getOriginalNodeClass(): string
{
return \PHPStan\PhpDocParser\Ast\PhpDoc\InvalidTagValueNode::class;
}
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
{
return is_a($node, \PHPStan\PhpDocParser\Ast\PhpDoc\InvalidTagValueNode::class, true);
}
/**
* @param \PHPStan\PhpDocParser\Ast\PhpDoc\InvalidTagValueNode $node
*/
public function create(
\PHPStan\PhpDocParser\Ast\Node $node
): \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface {
return new \Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareInvalidTagValueNode(
$node->value,
$node->exception
);
}
}

View File

@ -0,0 +1,38 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\PhpDoc;
use PHPStan\PhpDocParser\Ast\Node;
use PHPStan\PhpDocParser\Ast\PhpDoc\MethodTagValueNode;
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareMethodTagValueNode;
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface;
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
final class AttributeAwareMethodTagValueNodeFactory implements AttributeNodeAwareFactoryInterface
{
public function getOriginalNodeClass(): string
{
return MethodTagValueNode::class;
}
public function isMatch(Node $node): bool
{
return is_a($node, MethodTagValueNode::class, true);
}
/**
* @param MethodTagValueNode $node
*/
public function create(Node $node): AttributeAwareNodeInterface
{
return new AttributeAwareMethodTagValueNode(
$node->isStatic,
$node->returnType,
$node->methodName,
$node->parameters,
$node->description
);
}
}

View File

@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\PhpDoc;
final class AttributeAwareMethodTagValueParameterNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
{
public function getOriginalNodeClass(): string
{
return \PHPStan\PhpDocParser\Ast\PhpDoc\MethodTagValueParameterNode::class;
}
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
{
return is_a($node, \PHPStan\PhpDocParser\Ast\PhpDoc\MethodTagValueParameterNode::class, true);
}
/**
* @param \PHPStan\PhpDocParser\Ast\PhpDoc\MethodTagValueParameterNode $node
*/
public function create(
\PHPStan\PhpDocParser\Ast\Node $node
): \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface {
return new \Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareMethodTagValueParameterNode(
$node->type,
$node->isReference,
$node->isVariadic,
$node->parameterName,
$node->defaultValue
);
}
}

View File

@ -0,0 +1,32 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\PhpDoc;
final class AttributeAwareParamTagValueNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
{
public function getOriginalNodeClass(): string
{
return \PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode::class;
}
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
{
return is_a($node, \PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode::class, true);
}
/**
* @param \PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode $node
*/
public function create(
\PHPStan\PhpDocParser\Ast\Node $node
): \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface {
return new \Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareParamTagValueNode(
$node->type,
$node->isVariadic,
$node->parameterName,
$node->description
);
}
}

View File

@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\PhpDoc;
final class AttributeAwarePhpDocNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
{
public function getOriginalNodeClass(): string
{
return \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode::class;
}
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
{
return is_a($node, \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode::class, true);
}
/**
* @param \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode $node
*/
public function create(
\PHPStan\PhpDocParser\Ast\Node $node
): \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface {
return new \Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwarePhpDocNode($node->children);
}
}

View File

@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\PhpDoc;
final class AttributeAwarePhpDocTagNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
{
public function getOriginalNodeClass(): string
{
return \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode::class;
}
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
{
return is_a($node, \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode::class, true);
}
/**
* @param \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode $node
*/
public function create(
\PHPStan\PhpDocParser\Ast\Node $node
): \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface {
return new \Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwarePhpDocTagNode($node->name, $node->value);
}
}

View File

@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\PhpDoc;
final class AttributeAwarePhpDocTextNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
{
public function getOriginalNodeClass(): string
{
return \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTextNode::class;
}
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
{
return is_a($node, \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTextNode::class, true);
}
/**
* @param \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTextNode $node
*/
public function create(
\PHPStan\PhpDocParser\Ast\Node $node
): \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface {
return new \Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwarePhpDocTextNode($node->text);
}
}

View File

@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\PhpDoc;
final class AttributeAwarePropertyTagValueNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
{
public function getOriginalNodeClass(): string
{
return \PHPStan\PhpDocParser\Ast\PhpDoc\PropertyTagValueNode::class;
}
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
{
return is_a($node, \PHPStan\PhpDocParser\Ast\PhpDoc\PropertyTagValueNode::class, true);
}
/**
* @param \PHPStan\PhpDocParser\Ast\PhpDoc\PropertyTagValueNode $node
*/
public function create(
\PHPStan\PhpDocParser\Ast\Node $node
): \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface {
return new \Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwarePropertyTagValueNode(
$node->type,
$node->propertyName,
$node->description
);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\PhpDoc;
final class AttributeAwareReturnTagValueNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
{
public function getOriginalNodeClass(): string
{
return \PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode::class;
}
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
{
return is_a($node, \PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode::class, true);
}
/**
* @param \PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode $node
*/
public function create(
\PHPStan\PhpDocParser\Ast\Node $node
): \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface {
return new \Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareReturnTagValueNode(
$node->type,
$node->description
);
}
}

View File

@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\PhpDoc;
final class AttributeAwareTemplateTagValueNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
{
public function getOriginalNodeClass(): string
{
return \PHPStan\PhpDocParser\Ast\PhpDoc\TemplateTagValueNode::class;
}
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
{
return is_a($node, \PHPStan\PhpDocParser\Ast\PhpDoc\TemplateTagValueNode::class, true);
}
/**
* @param \PHPStan\PhpDocParser\Ast\PhpDoc\TemplateTagValueNode $node
*/
public function create(
\PHPStan\PhpDocParser\Ast\Node $node
): \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface {
return new \Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareTemplateTagValueNode(
$node->name,
$node->bound,
$node->description
);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\PhpDoc;
final class AttributeAwareThrowsTagValueNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
{
public function getOriginalNodeClass(): string
{
return \PHPStan\PhpDocParser\Ast\PhpDoc\ThrowsTagValueNode::class;
}
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
{
return is_a($node, \PHPStan\PhpDocParser\Ast\PhpDoc\ThrowsTagValueNode::class, true);
}
/**
* @param \PHPStan\PhpDocParser\Ast\PhpDoc\ThrowsTagValueNode $node
*/
public function create(
\PHPStan\PhpDocParser\Ast\Node $node
): \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface {
return new \Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareThrowsTagValueNode(
$node->type,
$node->description
);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\PhpDoc;
final class AttributeAwareUsesTagValueNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
{
public function getOriginalNodeClass(): string
{
return \PHPStan\PhpDocParser\Ast\PhpDoc\UsesTagValueNode::class;
}
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
{
return is_a($node, \PHPStan\PhpDocParser\Ast\PhpDoc\UsesTagValueNode::class, true);
}
/**
* @param \PHPStan\PhpDocParser\Ast\PhpDoc\UsesTagValueNode $node
*/
public function create(
\PHPStan\PhpDocParser\Ast\Node $node
): \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface {
return new \Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareUsesTagValueNode(
$node->type,
$node->description
);
}
}

View File

@ -0,0 +1,32 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\PhpDoc;
use PHPStan\PhpDocParser\Ast\Node;
use PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode;
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareVarTagValueNode;
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface;
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
final class AttributeAwareVarTagValueNodeFactory implements AttributeNodeAwareFactoryInterface
{
public function getOriginalNodeClass(): string
{
return VarTagValueNode::class;
}
public function isMatch(Node $node): bool
{
return is_a($node, VarTagValueNode::class, true);
}
/**
* @param VarTagValueNode $node
*/
public function create(Node $node): AttributeAwareNodeInterface
{
return new AttributeAwareVarTagValueNode($node->type, $node->variableName, $node->description);
}
}

View File

@ -0,0 +1,32 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\Type;
use PHPStan\PhpDocParser\Ast\Node;
use PHPStan\PhpDocParser\Ast\Type\ArrayShapeItemNode;
use Rector\AttributeAwarePhpDoc\Ast\Type\AttributeAwareArrayShapeItemNode;
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface;
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
final class AttributeAwareArrayShapeItemNodeFactory implements AttributeNodeAwareFactoryInterface
{
public function getOriginalNodeClass(): string
{
return ArrayShapeItemNode::class;
}
public function isMatch(Node $node): bool
{
return is_a($node, ArrayShapeItemNode::class, true);
}
/**
* @param ArrayShapeItemNode $node
*/
public function create(Node $node): AttributeAwareNodeInterface
{
return new AttributeAwareArrayShapeItemNode($node->keyName, $node->optional, $node->valueType);
}
}

View File

@ -0,0 +1,32 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\Type;
use PHPStan\PhpDocParser\Ast\Node;
use PHPStan\PhpDocParser\Ast\Type\ArrayShapeNode;
use Rector\AttributeAwarePhpDoc\Ast\Type\AttributeAwareArrayShapeNode;
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface;
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
final class AttributeAwareArrayShapeNodeFactory implements AttributeNodeAwareFactoryInterface
{
public function getOriginalNodeClass(): string
{
return ArrayShapeNode::class;
}
public function isMatch(Node $node): bool
{
return is_a($node, ArrayShapeNode::class, true);
}
/**
* @param ArrayShapeNode $node
*/
public function create(Node $node): AttributeAwareNodeInterface
{
return new AttributeAwareArrayShapeNode($node->items);
}
}

View File

@ -0,0 +1,32 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\Type;
use PHPStan\PhpDocParser\Ast\Node;
use PHPStan\PhpDocParser\Ast\Type\ArrayTypeNode;
use Rector\AttributeAwarePhpDoc\Ast\Type\AttributeAwareArrayTypeNode;
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface;
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
final class AttributeAwareArrayTypeNodeFactory implements AttributeNodeAwareFactoryInterface
{
public function getOriginalNodeClass(): string
{
return ArrayTypeNode::class;
}
public function isMatch(Node $node): bool
{
return is_a($node, ArrayTypeNode::class, true);
}
/**
* @param ArrayTypeNode $node
*/
public function create(Node $node): AttributeAwareNodeInterface
{
return new AttributeAwareArrayTypeNode($node->type);
}
}

View File

@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\Type;
final class AttributeAwareCallableTypeNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
{
public function getOriginalNodeClass(): string
{
return \PHPStan\PhpDocParser\Ast\Type\CallableTypeNode::class;
}
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
{
return is_a($node, \PHPStan\PhpDocParser\Ast\Type\CallableTypeNode::class, true);
}
/**
* @param \PHPStan\PhpDocParser\Ast\Type\CallableTypeNode $node
*/
public function create(
\PHPStan\PhpDocParser\Ast\Node $node
): \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface {
return new \Rector\AttributeAwarePhpDoc\Ast\Type\AttributeAwareCallableTypeNode(
$node->identifier,
$node->parameters,
$node->returnType
);
}
}

View File

@ -0,0 +1,38 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\Type;
use PHPStan\PhpDocParser\Ast\Node;
use PHPStan\PhpDocParser\Ast\Type\CallableTypeParameterNode;
use Rector\AttributeAwarePhpDoc\Ast\Type\AttributeAwareCallableTypeParameterNode;
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface;
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
final class AttributeAwareCallableTypeParameterNodeFactory implements AttributeNodeAwareFactoryInterface
{
public function getOriginalNodeClass(): string
{
return CallableTypeParameterNode::class;
}
public function isMatch(Node $node): bool
{
return is_a($node, CallableTypeParameterNode::class, true);
}
/**
* @param CallableTypeParameterNode $node
*/
public function create(Node $node): AttributeAwareNodeInterface
{
return new AttributeAwareCallableTypeParameterNode(
$node->type,
$node->isReference,
$node->isVariadic,
$node->parameterName,
$node->isOptional
);
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\Type;
final class AttributeAwareGenericTypeNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
{
public function getOriginalNodeClass(): string
{
return \PHPStan\PhpDocParser\Ast\Type\GenericTypeNode::class;
}
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
{
return is_a($node, \PHPStan\PhpDocParser\Ast\Type\GenericTypeNode::class, true);
}
/**
* @param \PHPStan\PhpDocParser\Ast\Type\GenericTypeNode $node
*/
public function create(
\PHPStan\PhpDocParser\Ast\Node $node
): \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface {
return new \Rector\AttributeAwarePhpDoc\Ast\Type\AttributeAwareGenericTypeNode(
$node->type,
$node->genericTypes
);
}
}

View File

@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\Type;
final class AttributeAwareIdentifierTypeNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
{
public function getOriginalNodeClass(): string
{
return \PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode::class;
}
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
{
return is_a($node, \PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode::class, true);
}
/**
* @param \PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode $node
*/
public function create(
\PHPStan\PhpDocParser\Ast\Node $node
): \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface {
return new \Rector\AttributeAwarePhpDoc\Ast\Type\AttributeAwareIdentifierTypeNode($node->name);
}
}

View File

@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\Type;
final class AttributeAwareIntersectionTypeNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
{
public function getOriginalNodeClass(): string
{
return \PHPStan\PhpDocParser\Ast\Type\IntersectionTypeNode::class;
}
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
{
return is_a($node, \PHPStan\PhpDocParser\Ast\Type\IntersectionTypeNode::class, true);
}
/**
* @param \PHPStan\PhpDocParser\Ast\Type\IntersectionTypeNode $node
*/
public function create(
\PHPStan\PhpDocParser\Ast\Node $node
): \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface {
return new \Rector\AttributeAwarePhpDoc\Ast\Type\AttributeAwareIntersectionTypeNode($node->types);
}
}

View File

@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\Type;
final class AttributeAwareNullableTypeNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
{
public function getOriginalNodeClass(): string
{
return \PHPStan\PhpDocParser\Ast\Type\NullableTypeNode::class;
}
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
{
return is_a($node, \PHPStan\PhpDocParser\Ast\Type\NullableTypeNode::class, true);
}
/**
* @param \PHPStan\PhpDocParser\Ast\Type\NullableTypeNode $node
*/
public function create(
\PHPStan\PhpDocParser\Ast\Node $node
): \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface {
return new \Rector\AttributeAwarePhpDoc\Ast\Type\AttributeAwareNullableTypeNode($node->type);
}
}

View File

@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\Type;
final class AttributeAwareThisTypeNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
{
public function getOriginalNodeClass(): string
{
return \PHPStan\PhpDocParser\Ast\Type\ThisTypeNode::class;
}
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
{
return is_a($node, \PHPStan\PhpDocParser\Ast\Type\ThisTypeNode::class, true);
}
/**
* @param \PHPStan\PhpDocParser\Ast\Type\ThisTypeNode $node
*/
public function create(
\PHPStan\PhpDocParser\Ast\Node $node
): \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface {
return new \Rector\AttributeAwarePhpDoc\Ast\Type\AttributeAwareThisTypeNode();
}
}

View File

@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\Type;
final class AttributeAwareUnionTypeNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
{
public function getOriginalNodeClass(): string
{
return \PHPStan\PhpDocParser\Ast\Type\UnionTypeNode::class;
}
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
{
return is_a($node, \PHPStan\PhpDocParser\Ast\Type\UnionTypeNode::class, true);
}
/**
* @param \PHPStan\PhpDocParser\Ast\Type\UnionTypeNode $node
*/
public function create(
\PHPStan\PhpDocParser\Ast\Node $node
): \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface {
return new \Rector\AttributeAwarePhpDoc\Ast\Type\AttributeAwareUnionTypeNode($node->types);
}
}

View File

@ -0,0 +1,14 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory;
use Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactoryCollector;
interface AttributeAwareNodeFactoryCollectorAwareInterface
{
public function setAttributeAwareNodeFactoryCollector(
AttributeAwareNodeFactoryCollector $attributeAwareNodeFactoryCollector
): void;
}

View File

@ -5,54 +5,38 @@ declare(strict_types=1);
namespace Rector\BetterPhpDocParser\Attributes\Ast;
use PHPStan\PhpDocParser\Ast\Node;
use PHPStan\PhpDocParser\Ast\PhpDoc\DeprecatedTagValueNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\ExtendsTagValueNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\ImplementsTagValueNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\InvalidTagValueNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\MethodTagValueNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocChildNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTextNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\PropertyTagValueNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\TemplateTagValueNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\ThrowsTagValueNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode;
use PHPStan\PhpDocParser\Ast\Type\ArrayTypeNode;
use PHPStan\PhpDocParser\Ast\Type\CallableTypeNode;
use PHPStan\PhpDocParser\Ast\Type\GenericTypeNode;
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
use PHPStan\PhpDocParser\Ast\Type\IntersectionTypeNode;
use PHPStan\PhpDocParser\Ast\Type\NullableTypeNode;
use PHPStan\PhpDocParser\Ast\Type\ThisTypeNode;
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
use PHPStan\PhpDocParser\Ast\Type\UnionTypeNode;
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareDeprecatedTagValueNode;
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareExtendsTagValueNode;
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareGenericTagValueNode;
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareImplementsTagValueNode;
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareInvalidTagValueNode;
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareMethodTagValueNode;
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareParamTagValueNode;
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwarePhpDocNode;
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwarePhpDocTagNode;
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwarePhpDocTextNode;
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwarePropertyTagValueNode;
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareReturnTagValueNode;
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareTemplateTagValueNode;
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareThrowsTagValueNode;
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareVarTagValueNode;
use Rector\AttributeAwarePhpDoc\Ast\Type\AttributeAwareArrayTypeNode;
use Rector\AttributeAwarePhpDoc\Ast\Type\AttributeAwareCallableTypeNode;
use Rector\AttributeAwarePhpDoc\Ast\Type\AttributeAwareGenericTypeNode;
use Rector\AttributeAwarePhpDoc\Ast\Type\AttributeAwareIdentifierTypeNode;
use Rector\AttributeAwarePhpDoc\Ast\Type\AttributeAwareIntersectionTypeNode;
use Rector\AttributeAwarePhpDoc\Ast\Type\AttributeAwareNullableTypeNode;
use Rector\AttributeAwarePhpDoc\Ast\Type\AttributeAwareThisTypeNode;
use Rector\AttributeAwarePhpDoc\Ast\Type\AttributeAwareUnionTypeNode;
use Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactoryCollector;
use Rector\BetterPhpDocParser\Ast\PhpDocNodeTraverser;
@ -112,14 +96,6 @@ final class AttributeAwareNodeFactory
return $attributeNodeAwareFactory->create($node);
}
if ($node instanceof PhpDocTagNode) {
return new AttributeAwarePhpDocTagNode($node->name, $node->value);
}
if ($node instanceof PhpDocTextNode) {
return new AttributeAwarePhpDocTextNode($node->text);
}
if ($node instanceof PhpDocTagValueNode) {
return $this->createFromPhpDocValueNode($node);
}
@ -154,7 +130,7 @@ final class AttributeAwareNodeFactory
$phpDocTagValueNode->isVariadic,
$phpDocTagValueNode->parameterName,
$phpDocTagValueNode->description,
false // @todo maybe solve better
false
);
}
@ -180,10 +156,6 @@ final class AttributeAwareNodeFactory
);
}
if ($phpDocTagValueNode instanceof GenericTagValueNode) {
return new AttributeAwareGenericTagValueNode($phpDocTagValueNode->value);
}
if ($phpDocTagValueNode instanceof ExtendsTagValueNode) {
$typeNode = $this->createFromTypeNode($phpDocTagValueNode->type);
return new AttributeAwareExtendsTagValueNode($typeNode, $phpDocTagValueNode->description);
@ -194,27 +166,11 @@ final class AttributeAwareNodeFactory
return new AttributeAwareImplementsTagValueNode($typeNode, $phpDocTagValueNode->description);
}
if ($phpDocTagValueNode instanceof TemplateTagValueNode) {
return new AttributeAwareTemplateTagValueNode(
$phpDocTagValueNode->name,
$phpDocTagValueNode->bound,
$phpDocTagValueNode->description
);
}
if ($phpDocTagValueNode instanceof InvalidTagValueNode) {
return new AttributeAwareInvalidTagValueNode($phpDocTagValueNode->value, $phpDocTagValueNode->exception);
}
if ($phpDocTagValueNode instanceof ThrowsTagValueNode) {
$typeNode = $this->createFromTypeNode($phpDocTagValueNode->type);
return new AttributeAwareThrowsTagValueNode($typeNode, $phpDocTagValueNode->description);
}
if ($phpDocTagValueNode instanceof DeprecatedTagValueNode) {
return new AttributeAwareDeprecatedTagValueNode($phpDocTagValueNode->description);
}
throw new NotImplementedYetException(sprintf(
'Implement "%s" to "%s"',
get_class($phpDocTagValueNode),
@ -227,10 +183,6 @@ final class AttributeAwareNodeFactory
*/
private function createFromTypeNode(TypeNode $typeNode): AttributeAwareNodeInterface
{
if ($typeNode instanceof IdentifierTypeNode) {
return new AttributeAwareIdentifierTypeNode($typeNode->name);
}
if ($typeNode instanceof NullableTypeNode) {
$typeNode->type = $this->createFromTypeNode($typeNode->type);
return new AttributeAwareNullableTypeNode($typeNode->type);
@ -253,18 +205,6 @@ final class AttributeAwareNodeFactory
return new AttributeAwareArrayTypeNode($typeNode->type);
}
if ($typeNode instanceof ThisTypeNode) {
return new AttributeAwareThisTypeNode();
}
if ($typeNode instanceof CallableTypeNode) {
return new AttributeAwareCallableTypeNode(
$typeNode->identifier,
$typeNode->parameters,
$typeNode->returnType
);
}
if ($typeNode instanceof GenericTypeNode) {
/** @var AttributeAwareIdentifierTypeNode $identifierTypeNode */
$identifierTypeNode = $this->createFromTypeNode($typeNode->type);

View File

@ -1,14 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\PhpDoc;
use PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode;
use Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
final class AttributeAwareGenericTagValueNode extends GenericTagValueNode implements AttributeAwareNodeInterface
{
use AttributeTrait;
}

View File

@ -1,14 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\PhpDoc;
use PHPStan\PhpDocParser\Ast\PhpDoc\ImplementsTagValueNode;
use Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
final class AttributeAwareImplementsTagValueNode extends ImplementsTagValueNode implements AttributeAwareNodeInterface
{
use AttributeTrait;
}

View File

@ -1,14 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\PhpDoc;
use PHPStan\PhpDocParser\Ast\PhpDoc\InvalidTagValueNode;
use Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
final class AttributeAwareInvalidTagValueNode extends InvalidTagValueNode implements AttributeAwareNodeInterface
{
use AttributeTrait;
}

View File

@ -1,14 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\PhpDoc;
use PHPStan\PhpDocParser\Ast\PhpDoc\MethodTagValueNode;
use Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
final class AttributeAwareMethodTagValueNode extends MethodTagValueNode implements AttributeAwareNodeInterface
{
use AttributeTrait;
}

View File

@ -1,14 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\PhpDoc;
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
use Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
final class AttributeAwarePhpDocTagNode extends PhpDocTagNode implements AttributeAwareNodeInterface
{
use AttributeTrait;
}

View File

@ -1,14 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\PhpDoc;
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTextNode;
use Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
final class AttributeAwarePhpDocTextNode extends PhpDocTextNode implements AttributeAwareNodeInterface
{
use AttributeTrait;
}

View File

@ -1,14 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\PhpDoc;
use PHPStan\PhpDocParser\Ast\PhpDoc\PropertyTagValueNode;
use Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
final class AttributeAwarePropertyTagValueNode extends PropertyTagValueNode implements AttributeAwareNodeInterface
{
use AttributeTrait;
}

View File

@ -1,14 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\PhpDoc;
use PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode;
use Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
final class AttributeAwareReturnTagValueNode extends ReturnTagValueNode implements AttributeAwareNodeInterface
{
use AttributeTrait;
}

View File

@ -1,14 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\PhpDoc;
use PHPStan\PhpDocParser\Ast\PhpDoc\TemplateTagValueNode;
use Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
final class AttributeAwareTemplateTagValueNode extends TemplateTagValueNode implements AttributeAwareNodeInterface
{
use AttributeTrait;
}

View File

@ -1,14 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\PhpDoc;
use PHPStan\PhpDocParser\Ast\PhpDoc\ThrowsTagValueNode;
use Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
final class AttributeAwareThrowsTagValueNode extends ThrowsTagValueNode implements AttributeAwareNodeInterface
{
use AttributeTrait;
}

View File

@ -1,14 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\PhpDoc;
use PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode;
use Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
final class AttributeAwareVarTagValueNode extends VarTagValueNode implements AttributeAwareNodeInterface
{
use AttributeTrait;
}

View File

@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\PhpDoc;
namespace Rector\BetterPhpDocParser\Attributes\Ast\PhpDoc;
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
use Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;

View File

@ -1,14 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\PhpDoc\Type;
use PHPStan\PhpDocParser\Ast\Type\ArrayTypeNode;
use Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
final class AttributeAwareArrayTypeNode extends ArrayTypeNode implements AttributeAwareNodeInterface
{
use AttributeTrait;
}

View File

@ -1,19 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\PhpDoc\Type;
use PHPStan\PhpDocParser\Ast\Type\CallableTypeNode;
use Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
final class AttributeAwareCallableTypeNode extends CallableTypeNode implements AttributeAwareNodeInterface
{
use AttributeTrait;
public function __toString(): string
{
return 'callable';
}
}

View File

@ -1,14 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\PhpDoc\Type;
use PHPStan\PhpDocParser\Ast\Type\GenericTypeNode;
use Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
final class AttributeAwareGenericTypeNode extends GenericTypeNode implements AttributeAwareNodeInterface
{
use AttributeTrait;
}

View File

@ -1,19 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\PhpDoc\Type;
use PHPStan\PhpDocParser\Ast\Type\IntersectionTypeNode;
use Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
final class AttributeAwareIntersectionTypeNode extends IntersectionTypeNode implements AttributeAwareNodeInterface
{
use AttributeTrait;
public function __toString(): string
{
return implode('&', $this->types);
}
}

View File

@ -1,19 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\PhpDoc\Type;
use PHPStan\PhpDocParser\Ast\Type\NullableTypeNode;
use Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
final class AttributeAwareNullableTypeNode extends NullableTypeNode implements AttributeAwareNodeInterface
{
use AttributeTrait;
public function __toString(): string
{
return $this->type . '|null';
}
}

View File

@ -1,14 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\PhpDoc\Type;
use PHPStan\PhpDocParser\Ast\Type\ThisTypeNode;
use Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
final class AttributeAwareThisTypeNode extends ThisTypeNode implements AttributeAwareNodeInterface
{
use AttributeTrait;
}

View File

@ -1,22 +0,0 @@
<?php
declare(strict_types=1);
namespace Rector\AttributeAwarePhpDoc\Ast\PhpDoc\Type;
use PHPStan\PhpDocParser\Ast\Type\UnionTypeNode;
use Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
final class AttributeAwareUnionTypeNode extends UnionTypeNode implements AttributeAwareNodeInterface
{
use AttributeTrait;
/**
* Preserve common format
*/
public function __toString(): string
{
return implode('|', $this->types);
}
}

View File

@ -64,6 +64,9 @@ final class AttributeAwareNodeFactoryTest extends AbstractKernelTestCase
// test nullable
/** @var PropertyTagValueNode $propertyTagValueNode */
$nullableTypeNode = $propertyTagValueNode->type;
dump($nullableTypeNode);
$this->assertInstanceOf(NullableTypeNode::class, $nullableTypeNode);
$this->assertInstanceOf(AttributeAwareNullableTypeNode::class, $nullableTypeNode);

View File

@ -9,7 +9,7 @@ use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode;
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
use Ramsey\Uuid\UuidInterface;
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\SpacelessPhpDocTagNode;
use Rector\BetterPhpDocParser\Attributes\Ast\PhpDoc\SpacelessPhpDocTagNode;
use Rector\BetterPhpDocParser\PhpDocNode\Doctrine\Class_\EntityTagValueNode;
use Rector\BetterPhpDocParser\PhpDocNode\Doctrine\Property_\ColumnTagValueNode;
use Rector\BetterPhpDocParser\PhpDocNode\Doctrine\Property_\GeneratedValueTagValueNode;

View File

@ -14,7 +14,7 @@ use PhpParser\Node\Expr\StaticCall;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassMethod;
use PHPStan\Type\ObjectType;
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\SpacelessPhpDocTagNode;
use Rector\BetterPhpDocParser\Attributes\Ast\PhpDoc\SpacelessPhpDocTagNode;
use Rector\BetterPhpDocParser\PhpDocNode\Symfony\SymfonyRouteTagValueNode;
use Rector\NetteToSymfony\Route\RouteInfoFactory;
use Rector\NetteToSymfony\ValueObject\RouteInfo;

View File

@ -12,7 +12,7 @@ use PhpParser\Node\Expr\Variable;
use PhpParser\Node\Name\FullyQualified;
use PhpParser\Node\Param;
use PhpParser\Node\Stmt\ClassMethod;
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\SpacelessPhpDocTagNode;
use Rector\BetterPhpDocParser\Attributes\Ast\PhpDoc\SpacelessPhpDocTagNode;
use Rector\BetterPhpDocParser\PhpDocNode\Symfony\SymfonyRouteTagValueNode;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\NodeTypeResolver\PhpDoc\NodeAnalyzer\DocBlockManipulator;

View File

@ -4,6 +4,7 @@ declare(strict_types=1);
namespace Rector\Utils\PHPStanAttributeTypeSyncer\ClassNaming;
use Nette\Utils\Strings;
use Rector\CodingStyle\Naming\ClassNaming;
use Rector\Utils\PHPStanAttributeTypeSyncer\ValueObject\Paths;
@ -35,13 +36,12 @@ final class AttributeClassNaming
public function createAttributeAwareClassName(string $nodeClass): string
{
return Paths::NAMESPACE_PHPDOC_NODE . '\\' . $this->createAttributeAwareShortClassName($nodeClass);
}
if (Strings::contains($nodeClass, '\\Type\\')) {
$namespace = Paths::NAMESPACE_TYPE_NODE;
} else {
$namespace = Paths::NAMESPACE_PHPDOC_NODE;
}
public function createAttributeAwareFactoryClassName(string $nodeClass): string
{
return Paths::NAMESPACE_PHPDOC_NODE_FACTORY . '\\' . $this->createAttributeAwareFactoryShortClassName(
$nodeClass
);
return $namespace . '\\' . $this->createAttributeAwareShortClassName($nodeClass);
}
}