mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-17 21:38:22 +01:00
import names
This commit is contained in:
parent
ef982e3df3
commit
1b6f616cf9
1
.github/workflows/code_checks.yml
vendored
1
.github/workflows/code_checks.yml
vendored
@ -101,6 +101,7 @@ jobs:
|
||||
- run: |
|
||||
php ci/check_services_in_yaml_configs.php
|
||||
php ci/run_all_sets.php
|
||||
bin/rector sync-types
|
||||
|
||||
fatal_scan:
|
||||
runs-on: ubuntu-latest
|
||||
|
@ -8252,8 +8252,7 @@ Change $this->getParam() calls to action method arguments + Sdd symfony @Route
|
||||
+public function someAction($id)
|
||||
{
|
||||
- $id = $this->getParam('id');
|
||||
-}
|
||||
+}
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
@ -4,7 +4,11 @@ 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 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 \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
|
||||
use AttributeTrait;
|
||||
}
|
||||
|
@ -4,7 +4,11 @@ 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 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 \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
|
||||
use AttributeTrait;
|
||||
}
|
||||
|
@ -4,7 +4,11 @@ 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 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 \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
|
||||
use AttributeTrait;
|
||||
}
|
||||
|
@ -4,7 +4,11 @@ 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 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 \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
|
||||
use AttributeTrait;
|
||||
}
|
||||
|
@ -4,7 +4,11 @@ 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 PHPStan\PhpDocParser\Ast\PhpDoc\MethodTagValueParameterNode;
|
||||
use Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
|
||||
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
|
||||
|
||||
final class AttributeAwareMethodTagValueParameterNode extends MethodTagValueParameterNode implements AttributeAwareNodeInterface
|
||||
{
|
||||
use \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
|
||||
use AttributeTrait;
|
||||
}
|
||||
|
@ -4,11 +4,14 @@ 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 \PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode implements \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface
|
||||
final class AttributeAwareParamTagValueNode extends ParamTagValueNode implements AttributeAwareNodeInterface
|
||||
{
|
||||
use \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
|
||||
use AttributeTrait;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
|
@ -5,11 +5,13 @@ 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 \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode implements \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface
|
||||
final class AttributeAwarePhpDocNode extends PhpDocNode implements AttributeAwareNodeInterface
|
||||
{
|
||||
use \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
|
||||
use AttributeTrait;
|
||||
|
||||
/**
|
||||
* @var PhpDocChildNode[]|AttributeAwareNodeInterface[]
|
||||
|
@ -4,7 +4,11 @@ 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 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 \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
|
||||
use AttributeTrait;
|
||||
}
|
||||
|
@ -4,7 +4,11 @@ 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 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 \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
|
||||
use AttributeTrait;
|
||||
}
|
||||
|
@ -4,7 +4,11 @@ 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 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 \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
|
||||
use AttributeTrait;
|
||||
}
|
||||
|
@ -4,7 +4,11 @@ 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 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 \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
|
||||
use AttributeTrait;
|
||||
}
|
||||
|
@ -4,7 +4,11 @@ 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 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 \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
|
||||
use AttributeTrait;
|
||||
}
|
||||
|
@ -4,7 +4,11 @@ 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 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 \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
|
||||
use AttributeTrait;
|
||||
}
|
||||
|
@ -4,7 +4,11 @@ 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 PHPStan\PhpDocParser\Ast\PhpDoc\UsesTagValueNode;
|
||||
use Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
|
||||
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
|
||||
|
||||
final class AttributeAwareUsesTagValueNode extends UsesTagValueNode implements AttributeAwareNodeInterface
|
||||
{
|
||||
use \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
|
||||
use AttributeTrait;
|
||||
}
|
||||
|
@ -4,7 +4,11 @@ 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 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 \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
|
||||
use AttributeTrait;
|
||||
}
|
||||
|
@ -4,7 +4,11 @@ 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 PHPStan\PhpDocParser\Ast\Type\ArrayShapeItemNode;
|
||||
use Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
|
||||
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
|
||||
|
||||
final class AttributeAwareArrayShapeItemNode extends ArrayShapeItemNode implements AttributeAwareNodeInterface
|
||||
{
|
||||
use \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
|
||||
use AttributeTrait;
|
||||
}
|
||||
|
@ -4,7 +4,11 @@ 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 PHPStan\PhpDocParser\Ast\Type\ArrayShapeNode;
|
||||
use Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
|
||||
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
|
||||
|
||||
final class AttributeAwareArrayShapeNode extends ArrayShapeNode implements AttributeAwareNodeInterface
|
||||
{
|
||||
use \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
|
||||
use AttributeTrait;
|
||||
}
|
||||
|
@ -4,7 +4,11 @@ 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 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 \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
|
||||
use AttributeTrait;
|
||||
}
|
||||
|
@ -4,9 +4,13 @@ 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 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 \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
|
||||
use AttributeTrait;
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
|
@ -4,7 +4,11 @@ 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 PHPStan\PhpDocParser\Ast\Type\CallableTypeParameterNode;
|
||||
use Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
|
||||
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
|
||||
|
||||
final class AttributeAwareCallableTypeParameterNode extends CallableTypeParameterNode implements AttributeAwareNodeInterface
|
||||
{
|
||||
use \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
|
||||
use AttributeTrait;
|
||||
}
|
||||
|
@ -4,7 +4,11 @@ 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 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 \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
|
||||
use AttributeTrait;
|
||||
}
|
||||
|
@ -4,7 +4,11 @@ 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 PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
|
||||
use Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
|
||||
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
|
||||
|
||||
final class AttributeAwareIdentifierTypeNode extends IdentifierTypeNode implements AttributeAwareNodeInterface
|
||||
{
|
||||
use \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
|
||||
use AttributeTrait;
|
||||
}
|
||||
|
@ -4,9 +4,13 @@ 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 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 \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
|
||||
use AttributeTrait;
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
|
@ -4,9 +4,13 @@ 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 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 \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
|
||||
use AttributeTrait;
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
|
@ -4,7 +4,11 @@ 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 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 \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
|
||||
use AttributeTrait;
|
||||
}
|
||||
|
@ -4,9 +4,13 @@ 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 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 \Rector\BetterPhpDocParser\Attributes\Attribute\AttributeTrait;
|
||||
use AttributeTrait;
|
||||
|
||||
/**
|
||||
* Preserve common format
|
||||
|
@ -4,24 +4,29 @@ declare(strict_types=1);
|
||||
|
||||
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\PhpDoc;
|
||||
|
||||
final class AttributeAwareDeprecatedTagValueNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\DeprecatedTagValueNode;
|
||||
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareDeprecatedTagValueNode;
|
||||
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface;
|
||||
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
|
||||
|
||||
final class AttributeAwareDeprecatedTagValueNodeFactory implements AttributeNodeAwareFactoryInterface
|
||||
{
|
||||
public function getOriginalNodeClass(): string
|
||||
{
|
||||
return \PHPStan\PhpDocParser\Ast\PhpDoc\DeprecatedTagValueNode::class;
|
||||
return DeprecatedTagValueNode::class;
|
||||
}
|
||||
|
||||
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
|
||||
public function isMatch(Node $node): bool
|
||||
{
|
||||
return is_a($node, \PHPStan\PhpDocParser\Ast\PhpDoc\DeprecatedTagValueNode::class, true);
|
||||
return is_a($node, DeprecatedTagValueNode::class, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \PHPStan\PhpDocParser\Ast\PhpDoc\DeprecatedTagValueNode $node
|
||||
* @param DeprecatedTagValueNode $node
|
||||
*/
|
||||
public function create(
|
||||
\PHPStan\PhpDocParser\Ast\Node $node
|
||||
): \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface {
|
||||
return new \Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareDeprecatedTagValueNode($node->description);
|
||||
public function create(Node $node): AttributeAwareNodeInterface
|
||||
{
|
||||
return new AttributeAwareDeprecatedTagValueNode($node->description);
|
||||
}
|
||||
}
|
||||
|
@ -4,27 +4,43 @@ declare(strict_types=1);
|
||||
|
||||
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\PhpDoc;
|
||||
|
||||
final class AttributeAwareExtendsTagValueNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\ExtendsTagValueNode;
|
||||
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareExtendsTagValueNode;
|
||||
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeAwareNodeFactoryAwareInterface;
|
||||
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface;
|
||||
use Rector\BetterPhpDocParser\Attributes\Ast\AttributeAwareNodeFactory;
|
||||
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
|
||||
|
||||
final class AttributeAwareExtendsTagValueNodeFactory implements AttributeNodeAwareFactoryInterface, AttributeAwareNodeFactoryAwareInterface
|
||||
{
|
||||
/**
|
||||
* @var AttributeAwareNodeFactory
|
||||
*/
|
||||
private $attributeAwareNodeFactory;
|
||||
|
||||
public function getOriginalNodeClass(): string
|
||||
{
|
||||
return \PHPStan\PhpDocParser\Ast\PhpDoc\ExtendsTagValueNode::class;
|
||||
return ExtendsTagValueNode::class;
|
||||
}
|
||||
|
||||
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
|
||||
public function isMatch(Node $node): bool
|
||||
{
|
||||
return is_a($node, \PHPStan\PhpDocParser\Ast\PhpDoc\ExtendsTagValueNode::class, true);
|
||||
return is_a($node, ExtendsTagValueNode::class, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \PHPStan\PhpDocParser\Ast\PhpDoc\ExtendsTagValueNode $node
|
||||
* @param 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
|
||||
);
|
||||
public function create(Node $node): AttributeAwareNodeInterface
|
||||
{
|
||||
$node->type = $this->attributeAwareNodeFactory->createFromNode($node->type);
|
||||
|
||||
return new AttributeAwareExtendsTagValueNode($node->type, $node->description);
|
||||
}
|
||||
|
||||
public function setAttributeAwareNodeFactory(AttributeAwareNodeFactory $attributeAwareNodeFactory): void
|
||||
{
|
||||
$this->attributeAwareNodeFactory = $attributeAwareNodeFactory;
|
||||
}
|
||||
}
|
||||
|
@ -4,24 +4,29 @@ declare(strict_types=1);
|
||||
|
||||
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\PhpDoc;
|
||||
|
||||
final class AttributeAwareGenericTagValueNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode;
|
||||
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareGenericTagValueNode;
|
||||
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface;
|
||||
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
|
||||
|
||||
final class AttributeAwareGenericTagValueNodeFactory implements AttributeNodeAwareFactoryInterface
|
||||
{
|
||||
public function getOriginalNodeClass(): string
|
||||
{
|
||||
return \PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode::class;
|
||||
return GenericTagValueNode::class;
|
||||
}
|
||||
|
||||
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
|
||||
public function isMatch(Node $node): bool
|
||||
{
|
||||
return is_a($node, \PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode::class, true);
|
||||
return is_a($node, GenericTagValueNode::class, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \PHPStan\PhpDocParser\Ast\PhpDoc\GenericTagValueNode $node
|
||||
* @param GenericTagValueNode $node
|
||||
*/
|
||||
public function create(
|
||||
\PHPStan\PhpDocParser\Ast\Node $node
|
||||
): \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface {
|
||||
return new \Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareGenericTagValueNode($node->value);
|
||||
public function create(Node $node): AttributeAwareNodeInterface
|
||||
{
|
||||
return new AttributeAwareGenericTagValueNode($node->value);
|
||||
}
|
||||
}
|
||||
|
@ -4,27 +4,43 @@ declare(strict_types=1);
|
||||
|
||||
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\PhpDoc;
|
||||
|
||||
final class AttributeAwareImplementsTagValueNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\ImplementsTagValueNode;
|
||||
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareImplementsTagValueNode;
|
||||
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeAwareNodeFactoryAwareInterface;
|
||||
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface;
|
||||
use Rector\BetterPhpDocParser\Attributes\Ast\AttributeAwareNodeFactory;
|
||||
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
|
||||
|
||||
final class AttributeAwareImplementsTagValueNodeFactory implements AttributeNodeAwareFactoryInterface, AttributeAwareNodeFactoryAwareInterface
|
||||
{
|
||||
/**
|
||||
* @var AttributeAwareNodeFactory
|
||||
*/
|
||||
private $attributeAwareNodeFactory;
|
||||
|
||||
public function getOriginalNodeClass(): string
|
||||
{
|
||||
return \PHPStan\PhpDocParser\Ast\PhpDoc\ImplementsTagValueNode::class;
|
||||
return ImplementsTagValueNode::class;
|
||||
}
|
||||
|
||||
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
|
||||
public function isMatch(Node $node): bool
|
||||
{
|
||||
return is_a($node, \PHPStan\PhpDocParser\Ast\PhpDoc\ImplementsTagValueNode::class, true);
|
||||
return is_a($node, ImplementsTagValueNode::class, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \PHPStan\PhpDocParser\Ast\PhpDoc\ImplementsTagValueNode $node
|
||||
* @param 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
|
||||
);
|
||||
public function create(Node $node): AttributeAwareNodeInterface
|
||||
{
|
||||
$node->type = $this->attributeAwareNodeFactory->createFromNode($node->type);
|
||||
|
||||
return new AttributeAwareImplementsTagValueNode($node->type, $node->description);
|
||||
}
|
||||
|
||||
public function setAttributeAwareNodeFactory(AttributeAwareNodeFactory $attributeAwareNodeFactory): void
|
||||
{
|
||||
$this->attributeAwareNodeFactory = $attributeAwareNodeFactory;
|
||||
}
|
||||
}
|
||||
|
@ -4,27 +4,29 @@ declare(strict_types=1);
|
||||
|
||||
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\PhpDoc;
|
||||
|
||||
final class AttributeAwareInvalidTagValueNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\InvalidTagValueNode;
|
||||
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareInvalidTagValueNode;
|
||||
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface;
|
||||
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
|
||||
|
||||
final class AttributeAwareInvalidTagValueNodeFactory implements AttributeNodeAwareFactoryInterface
|
||||
{
|
||||
public function getOriginalNodeClass(): string
|
||||
{
|
||||
return \PHPStan\PhpDocParser\Ast\PhpDoc\InvalidTagValueNode::class;
|
||||
return InvalidTagValueNode::class;
|
||||
}
|
||||
|
||||
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
|
||||
public function isMatch(Node $node): bool
|
||||
{
|
||||
return is_a($node, \PHPStan\PhpDocParser\Ast\PhpDoc\InvalidTagValueNode::class, true);
|
||||
return is_a($node, InvalidTagValueNode::class, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \PHPStan\PhpDocParser\Ast\PhpDoc\InvalidTagValueNode $node
|
||||
* @param 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
|
||||
);
|
||||
public function create(Node $node): AttributeAwareNodeInterface
|
||||
{
|
||||
return new AttributeAwareInvalidTagValueNode($node->value, $node->exception);
|
||||
}
|
||||
}
|
||||
|
@ -4,25 +4,41 @@ declare(strict_types=1);
|
||||
|
||||
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\PhpDoc;
|
||||
|
||||
final class AttributeAwareMethodTagValueParameterNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\MethodTagValueParameterNode;
|
||||
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareMethodTagValueParameterNode;
|
||||
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeAwareNodeFactoryAwareInterface;
|
||||
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface;
|
||||
use Rector\BetterPhpDocParser\Attributes\Ast\AttributeAwareNodeFactory;
|
||||
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
|
||||
|
||||
final class AttributeAwareMethodTagValueParameterNodeFactory implements AttributeNodeAwareFactoryInterface, AttributeAwareNodeFactoryAwareInterface
|
||||
{
|
||||
/**
|
||||
* @var AttributeAwareNodeFactory
|
||||
*/
|
||||
private $attributeAwareNodeFactory;
|
||||
|
||||
public function getOriginalNodeClass(): string
|
||||
{
|
||||
return \PHPStan\PhpDocParser\Ast\PhpDoc\MethodTagValueParameterNode::class;
|
||||
return MethodTagValueParameterNode::class;
|
||||
}
|
||||
|
||||
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
|
||||
public function isMatch(Node $node): bool
|
||||
{
|
||||
return is_a($node, \PHPStan\PhpDocParser\Ast\PhpDoc\MethodTagValueParameterNode::class, true);
|
||||
return is_a($node, MethodTagValueParameterNode::class, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \PHPStan\PhpDocParser\Ast\PhpDoc\MethodTagValueParameterNode $node
|
||||
* @param MethodTagValueParameterNode $node
|
||||
*/
|
||||
public function create(
|
||||
\PHPStan\PhpDocParser\Ast\Node $node
|
||||
): \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface {
|
||||
return new \Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareMethodTagValueParameterNode(
|
||||
public function create(Node $node): AttributeAwareNodeInterface
|
||||
{
|
||||
if ($node->type !== null) {
|
||||
$node->type = $this->attributeAwareNodeFactory->createFromNode($node->type);
|
||||
}
|
||||
|
||||
return new AttributeAwareMethodTagValueParameterNode(
|
||||
$node->type,
|
||||
$node->isReference,
|
||||
$node->isVariadic,
|
||||
@ -30,4 +46,9 @@ final class AttributeAwareMethodTagValueParameterNodeFactory implements \Rector\
|
||||
$node->defaultValue
|
||||
);
|
||||
}
|
||||
|
||||
public function setAttributeAwareNodeFactory(AttributeAwareNodeFactory $attributeAwareNodeFactory): void
|
||||
{
|
||||
$this->attributeAwareNodeFactory = $attributeAwareNodeFactory;
|
||||
}
|
||||
}
|
||||
|
@ -4,29 +4,49 @@ declare(strict_types=1);
|
||||
|
||||
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\PhpDoc;
|
||||
|
||||
final class AttributeAwareParamTagValueNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode;
|
||||
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareParamTagValueNode;
|
||||
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeAwareNodeFactoryAwareInterface;
|
||||
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface;
|
||||
use Rector\BetterPhpDocParser\Attributes\Ast\AttributeAwareNodeFactory;
|
||||
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
|
||||
|
||||
final class AttributeAwareParamTagValueNodeFactory implements AttributeNodeAwareFactoryInterface, AttributeAwareNodeFactoryAwareInterface
|
||||
{
|
||||
/**
|
||||
* @var AttributeAwareNodeFactory
|
||||
*/
|
||||
private $attributeAwareNodeFactory;
|
||||
|
||||
public function getOriginalNodeClass(): string
|
||||
{
|
||||
return \PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode::class;
|
||||
return ParamTagValueNode::class;
|
||||
}
|
||||
|
||||
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
|
||||
public function isMatch(Node $node): bool
|
||||
{
|
||||
return is_a($node, \PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode::class, true);
|
||||
return is_a($node, ParamTagValueNode::class, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode $node
|
||||
* @param ParamTagValueNode $node
|
||||
*/
|
||||
public function create(
|
||||
\PHPStan\PhpDocParser\Ast\Node $node
|
||||
): \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface {
|
||||
return new \Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareParamTagValueNode(
|
||||
public function create(Node $node): AttributeAwareNodeInterface
|
||||
{
|
||||
$node->type = $this->attributeAwareNodeFactory->createFromNode($node->type);
|
||||
|
||||
return new AttributeAwareParamTagValueNode(
|
||||
$node->type,
|
||||
$node->isVariadic,
|
||||
$node->parameterName,
|
||||
$node->description
|
||||
$node->description,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
public function setAttributeAwareNodeFactory(AttributeAwareNodeFactory $attributeAwareNodeFactory): void
|
||||
{
|
||||
$this->attributeAwareNodeFactory = $attributeAwareNodeFactory;
|
||||
}
|
||||
}
|
||||
|
@ -4,24 +4,60 @@ declare(strict_types=1);
|
||||
|
||||
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\PhpDoc;
|
||||
|
||||
final class AttributeAwarePhpDocNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode;
|
||||
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwarePhpDocNode;
|
||||
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeAwareNodeFactoryAwareInterface;
|
||||
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface;
|
||||
use Rector\BetterPhpDocParser\Ast\PhpDocNodeTraverser;
|
||||
use Rector\BetterPhpDocParser\Attributes\Ast\AttributeAwareNodeFactory;
|
||||
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
|
||||
|
||||
final class AttributeAwarePhpDocNodeFactory implements AttributeNodeAwareFactoryInterface, AttributeAwareNodeFactoryAwareInterface
|
||||
{
|
||||
public function getOriginalNodeClass(): string
|
||||
/**
|
||||
* @var AttributeAwareNodeFactory
|
||||
*/
|
||||
private $attributeAwareNodeFactory;
|
||||
|
||||
/**
|
||||
* @var PhpDocNodeTraverser
|
||||
*/
|
||||
private $phpDocNodeTraverser;
|
||||
|
||||
public function __construct(PhpDocNodeTraverser $phpDocNodeTraverser)
|
||||
{
|
||||
return \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode::class;
|
||||
$this->phpDocNodeTraverser = $phpDocNodeTraverser;
|
||||
}
|
||||
|
||||
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
|
||||
public function getOriginalNodeClass(): string
|
||||
{
|
||||
return is_a($node, \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode::class, true);
|
||||
return PhpDocNode::class;
|
||||
}
|
||||
|
||||
public function isMatch(Node $node): bool
|
||||
{
|
||||
return is_a($node, PhpDocNode::class, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode $node
|
||||
* @param PhpDocNode $node
|
||||
*/
|
||||
public function create(
|
||||
\PHPStan\PhpDocParser\Ast\Node $node
|
||||
): \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface {
|
||||
return new \Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwarePhpDocNode($node->children);
|
||||
public function create(Node $node): AttributeAwareNodeInterface
|
||||
{
|
||||
$this->phpDocNodeTraverser->traverseWithCallable($node, function (Node $node): AttributeAwareNodeInterface {
|
||||
if ($node instanceof AttributeAwareNodeInterface) {
|
||||
return $node;
|
||||
}
|
||||
|
||||
return $this->attributeAwareNodeFactory->createFromNode($node);
|
||||
});
|
||||
|
||||
return new AttributeAwarePhpDocNode($node->children);
|
||||
}
|
||||
|
||||
public function setAttributeAwareNodeFactory(AttributeAwareNodeFactory $attributeAwareNodeFactory): void
|
||||
{
|
||||
$this->attributeAwareNodeFactory = $attributeAwareNodeFactory;
|
||||
}
|
||||
}
|
||||
|
@ -4,24 +4,29 @@ declare(strict_types=1);
|
||||
|
||||
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\PhpDoc;
|
||||
|
||||
final class AttributeAwarePhpDocTagNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
|
||||
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwarePhpDocTagNode;
|
||||
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface;
|
||||
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
|
||||
|
||||
final class AttributeAwarePhpDocTagNodeFactory implements AttributeNodeAwareFactoryInterface
|
||||
{
|
||||
public function getOriginalNodeClass(): string
|
||||
{
|
||||
return \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode::class;
|
||||
return PhpDocTagNode::class;
|
||||
}
|
||||
|
||||
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
|
||||
public function isMatch(Node $node): bool
|
||||
{
|
||||
return is_a($node, \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode::class, true);
|
||||
return is_a($node, PhpDocTagNode::class, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode $node
|
||||
* @param 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);
|
||||
public function create(Node $node): AttributeAwareNodeInterface
|
||||
{
|
||||
return new AttributeAwarePhpDocTagNode($node->name, $node->value);
|
||||
}
|
||||
}
|
||||
|
@ -4,24 +4,29 @@ declare(strict_types=1);
|
||||
|
||||
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\PhpDoc;
|
||||
|
||||
final class AttributeAwarePhpDocTextNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTextNode;
|
||||
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwarePhpDocTextNode;
|
||||
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface;
|
||||
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
|
||||
|
||||
final class AttributeAwarePhpDocTextNodeFactory implements AttributeNodeAwareFactoryInterface
|
||||
{
|
||||
public function getOriginalNodeClass(): string
|
||||
{
|
||||
return \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTextNode::class;
|
||||
return PhpDocTextNode::class;
|
||||
}
|
||||
|
||||
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
|
||||
public function isMatch(Node $node): bool
|
||||
{
|
||||
return is_a($node, \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTextNode::class, true);
|
||||
return is_a($node, PhpDocTextNode::class, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTextNode $node
|
||||
* @param PhpDocTextNode $node
|
||||
*/
|
||||
public function create(
|
||||
\PHPStan\PhpDocParser\Ast\Node $node
|
||||
): \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface {
|
||||
return new \Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwarePhpDocTextNode($node->text);
|
||||
public function create(Node $node): AttributeAwareNodeInterface
|
||||
{
|
||||
return new AttributeAwarePhpDocTextNode($node->text);
|
||||
}
|
||||
}
|
||||
|
@ -4,28 +4,43 @@ declare(strict_types=1);
|
||||
|
||||
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\PhpDoc;
|
||||
|
||||
final class AttributeAwarePropertyTagValueNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PropertyTagValueNode;
|
||||
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwarePropertyTagValueNode;
|
||||
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeAwareNodeFactoryAwareInterface;
|
||||
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface;
|
||||
use Rector\BetterPhpDocParser\Attributes\Ast\AttributeAwareNodeFactory;
|
||||
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
|
||||
|
||||
final class AttributeAwarePropertyTagValueNodeFactory implements AttributeNodeAwareFactoryInterface, AttributeAwareNodeFactoryAwareInterface
|
||||
{
|
||||
/**
|
||||
* @var AttributeAwareNodeFactory
|
||||
*/
|
||||
private $attributeAwareNodeFactory;
|
||||
|
||||
public function getOriginalNodeClass(): string
|
||||
{
|
||||
return \PHPStan\PhpDocParser\Ast\PhpDoc\PropertyTagValueNode::class;
|
||||
return PropertyTagValueNode::class;
|
||||
}
|
||||
|
||||
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
|
||||
public function isMatch(Node $node): bool
|
||||
{
|
||||
return is_a($node, \PHPStan\PhpDocParser\Ast\PhpDoc\PropertyTagValueNode::class, true);
|
||||
return is_a($node, PropertyTagValueNode::class, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \PHPStan\PhpDocParser\Ast\PhpDoc\PropertyTagValueNode $node
|
||||
* @param 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
|
||||
);
|
||||
public function create(Node $node): AttributeAwareNodeInterface
|
||||
{
|
||||
$node->type = $this->attributeAwareNodeFactory->createFromNode($node->type);
|
||||
|
||||
return new AttributeAwarePropertyTagValueNode($node->type, $node->propertyName, $node->description);
|
||||
}
|
||||
|
||||
public function setAttributeAwareNodeFactory(AttributeAwareNodeFactory $attributeAwareNodeFactory): void
|
||||
{
|
||||
$this->attributeAwareNodeFactory = $attributeAwareNodeFactory;
|
||||
}
|
||||
}
|
||||
|
@ -4,27 +4,43 @@ declare(strict_types=1);
|
||||
|
||||
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\PhpDoc;
|
||||
|
||||
final class AttributeAwareReturnTagValueNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode;
|
||||
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareReturnTagValueNode;
|
||||
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeAwareNodeFactoryAwareInterface;
|
||||
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface;
|
||||
use Rector\BetterPhpDocParser\Attributes\Ast\AttributeAwareNodeFactory;
|
||||
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
|
||||
|
||||
final class AttributeAwareReturnTagValueNodeFactory implements AttributeNodeAwareFactoryInterface, AttributeAwareNodeFactoryAwareInterface
|
||||
{
|
||||
/**
|
||||
* @var AttributeAwareNodeFactory
|
||||
*/
|
||||
private $attributeAwareNodeFactory;
|
||||
|
||||
public function getOriginalNodeClass(): string
|
||||
{
|
||||
return \PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode::class;
|
||||
return ReturnTagValueNode::class;
|
||||
}
|
||||
|
||||
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
|
||||
public function isMatch(Node $node): bool
|
||||
{
|
||||
return is_a($node, \PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode::class, true);
|
||||
return is_a($node, ReturnTagValueNode::class, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode $node
|
||||
* @param 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
|
||||
);
|
||||
public function create(Node $node): AttributeAwareNodeInterface
|
||||
{
|
||||
$node->type = $this->attributeAwareNodeFactory->createFromNode($node->type);
|
||||
|
||||
return new AttributeAwareReturnTagValueNode($node->type, $node->description);
|
||||
}
|
||||
|
||||
public function setAttributeAwareNodeFactory(AttributeAwareNodeFactory $attributeAwareNodeFactory): void
|
||||
{
|
||||
$this->attributeAwareNodeFactory = $attributeAwareNodeFactory;
|
||||
}
|
||||
}
|
||||
|
@ -4,28 +4,29 @@ declare(strict_types=1);
|
||||
|
||||
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\PhpDoc;
|
||||
|
||||
final class AttributeAwareTemplateTagValueNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\TemplateTagValueNode;
|
||||
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareTemplateTagValueNode;
|
||||
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface;
|
||||
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
|
||||
|
||||
final class AttributeAwareTemplateTagValueNodeFactory implements AttributeNodeAwareFactoryInterface
|
||||
{
|
||||
public function getOriginalNodeClass(): string
|
||||
{
|
||||
return \PHPStan\PhpDocParser\Ast\PhpDoc\TemplateTagValueNode::class;
|
||||
return TemplateTagValueNode::class;
|
||||
}
|
||||
|
||||
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
|
||||
public function isMatch(Node $node): bool
|
||||
{
|
||||
return is_a($node, \PHPStan\PhpDocParser\Ast\PhpDoc\TemplateTagValueNode::class, true);
|
||||
return is_a($node, TemplateTagValueNode::class, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \PHPStan\PhpDocParser\Ast\PhpDoc\TemplateTagValueNode $node
|
||||
* @param 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
|
||||
);
|
||||
public function create(Node $node): AttributeAwareNodeInterface
|
||||
{
|
||||
return new AttributeAwareTemplateTagValueNode($node->name, $node->bound, $node->description);
|
||||
}
|
||||
}
|
||||
|
@ -4,27 +4,43 @@ declare(strict_types=1);
|
||||
|
||||
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\PhpDoc;
|
||||
|
||||
final class AttributeAwareThrowsTagValueNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\ThrowsTagValueNode;
|
||||
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareThrowsTagValueNode;
|
||||
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeAwareNodeFactoryAwareInterface;
|
||||
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface;
|
||||
use Rector\BetterPhpDocParser\Attributes\Ast\AttributeAwareNodeFactory;
|
||||
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
|
||||
|
||||
final class AttributeAwareThrowsTagValueNodeFactory implements AttributeNodeAwareFactoryInterface, AttributeAwareNodeFactoryAwareInterface
|
||||
{
|
||||
/**
|
||||
* @var AttributeAwareNodeFactory
|
||||
*/
|
||||
private $attributeAwareNodeFactory;
|
||||
|
||||
public function getOriginalNodeClass(): string
|
||||
{
|
||||
return \PHPStan\PhpDocParser\Ast\PhpDoc\ThrowsTagValueNode::class;
|
||||
return ThrowsTagValueNode::class;
|
||||
}
|
||||
|
||||
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
|
||||
public function isMatch(Node $node): bool
|
||||
{
|
||||
return is_a($node, \PHPStan\PhpDocParser\Ast\PhpDoc\ThrowsTagValueNode::class, true);
|
||||
return is_a($node, ThrowsTagValueNode::class, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \PHPStan\PhpDocParser\Ast\PhpDoc\ThrowsTagValueNode $node
|
||||
* @param 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
|
||||
);
|
||||
public function create(Node $node): AttributeAwareNodeInterface
|
||||
{
|
||||
$node->type = $this->attributeAwareNodeFactory->createFromNode($node->type);
|
||||
|
||||
return new AttributeAwareThrowsTagValueNode($node->type, $node->description);
|
||||
}
|
||||
|
||||
public function setAttributeAwareNodeFactory(AttributeAwareNodeFactory $attributeAwareNodeFactory): void
|
||||
{
|
||||
$this->attributeAwareNodeFactory = $attributeAwareNodeFactory;
|
||||
}
|
||||
}
|
||||
|
@ -4,27 +4,29 @@ declare(strict_types=1);
|
||||
|
||||
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\PhpDoc;
|
||||
|
||||
final class AttributeAwareUsesTagValueNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\UsesTagValueNode;
|
||||
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareUsesTagValueNode;
|
||||
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface;
|
||||
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
|
||||
|
||||
final class AttributeAwareUsesTagValueNodeFactory implements AttributeNodeAwareFactoryInterface
|
||||
{
|
||||
public function getOriginalNodeClass(): string
|
||||
{
|
||||
return \PHPStan\PhpDocParser\Ast\PhpDoc\UsesTagValueNode::class;
|
||||
return UsesTagValueNode::class;
|
||||
}
|
||||
|
||||
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
|
||||
public function isMatch(Node $node): bool
|
||||
{
|
||||
return is_a($node, \PHPStan\PhpDocParser\Ast\PhpDoc\UsesTagValueNode::class, true);
|
||||
return is_a($node, UsesTagValueNode::class, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \PHPStan\PhpDocParser\Ast\PhpDoc\UsesTagValueNode $node
|
||||
* @param 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
|
||||
);
|
||||
public function create(Node $node): AttributeAwareNodeInterface
|
||||
{
|
||||
return new AttributeAwareUsesTagValueNode($node->type, $node->description);
|
||||
}
|
||||
}
|
||||
|
@ -7,11 +7,18 @@ 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\AttributeAwareNodeFactoryAwareInterface;
|
||||
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface;
|
||||
use Rector\BetterPhpDocParser\Attributes\Ast\AttributeAwareNodeFactory;
|
||||
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
|
||||
|
||||
final class AttributeAwareVarTagValueNodeFactory implements AttributeNodeAwareFactoryInterface
|
||||
final class AttributeAwareVarTagValueNodeFactory implements AttributeNodeAwareFactoryInterface, AttributeAwareNodeFactoryAwareInterface
|
||||
{
|
||||
/**
|
||||
* @var AttributeAwareNodeFactory
|
||||
*/
|
||||
private $attributeAwareNodeFactory;
|
||||
|
||||
public function getOriginalNodeClass(): string
|
||||
{
|
||||
return VarTagValueNode::class;
|
||||
@ -27,6 +34,13 @@ final class AttributeAwareVarTagValueNodeFactory implements AttributeNodeAwareFa
|
||||
*/
|
||||
public function create(Node $node): AttributeAwareNodeInterface
|
||||
{
|
||||
$node->type = $this->attributeAwareNodeFactory->createFromNode($node->type);
|
||||
|
||||
return new AttributeAwareVarTagValueNode($node->type, $node->variableName, $node->description);
|
||||
}
|
||||
|
||||
public function setAttributeAwareNodeFactory(AttributeAwareNodeFactory $attributeAwareNodeFactory): void
|
||||
{
|
||||
$this->attributeAwareNodeFactory = $attributeAwareNodeFactory;
|
||||
}
|
||||
}
|
||||
|
@ -7,11 +7,18 @@ 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\AttributeAwareNodeFactoryAwareInterface;
|
||||
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface;
|
||||
use Rector\BetterPhpDocParser\Attributes\Ast\AttributeAwareNodeFactory;
|
||||
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
|
||||
|
||||
final class AttributeAwareArrayTypeNodeFactory implements AttributeNodeAwareFactoryInterface
|
||||
final class AttributeAwareArrayTypeNodeFactory implements AttributeNodeAwareFactoryInterface, AttributeAwareNodeFactoryAwareInterface
|
||||
{
|
||||
/**
|
||||
* @var AttributeAwareNodeFactory
|
||||
*/
|
||||
private $attributeAwareNodeFactory;
|
||||
|
||||
public function getOriginalNodeClass(): string
|
||||
{
|
||||
return ArrayTypeNode::class;
|
||||
@ -27,6 +34,13 @@ final class AttributeAwareArrayTypeNodeFactory implements AttributeNodeAwareFact
|
||||
*/
|
||||
public function create(Node $node): AttributeAwareNodeInterface
|
||||
{
|
||||
$node->type = $this->attributeAwareNodeFactory->createFromNode($node->type);
|
||||
|
||||
return new AttributeAwareArrayTypeNode($node->type);
|
||||
}
|
||||
|
||||
public function setAttributeAwareNodeFactory(AttributeAwareNodeFactory $attributeAwareNodeFactory): void
|
||||
{
|
||||
$this->attributeAwareNodeFactory = $attributeAwareNodeFactory;
|
||||
}
|
||||
}
|
||||
|
@ -4,28 +4,29 @@ declare(strict_types=1);
|
||||
|
||||
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\Type;
|
||||
|
||||
final class AttributeAwareCallableTypeNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPStan\PhpDocParser\Ast\Type\CallableTypeNode;
|
||||
use Rector\AttributeAwarePhpDoc\Ast\Type\AttributeAwareCallableTypeNode;
|
||||
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface;
|
||||
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
|
||||
|
||||
final class AttributeAwareCallableTypeNodeFactory implements AttributeNodeAwareFactoryInterface
|
||||
{
|
||||
public function getOriginalNodeClass(): string
|
||||
{
|
||||
return \PHPStan\PhpDocParser\Ast\Type\CallableTypeNode::class;
|
||||
return CallableTypeNode::class;
|
||||
}
|
||||
|
||||
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
|
||||
public function isMatch(Node $node): bool
|
||||
{
|
||||
return is_a($node, \PHPStan\PhpDocParser\Ast\Type\CallableTypeNode::class, true);
|
||||
return is_a($node, CallableTypeNode::class, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \PHPStan\PhpDocParser\Ast\Type\CallableTypeNode $node
|
||||
* @param 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
|
||||
);
|
||||
public function create(Node $node): AttributeAwareNodeInterface
|
||||
{
|
||||
return new AttributeAwareCallableTypeNode($node->identifier, $node->parameters, $node->returnType);
|
||||
}
|
||||
}
|
||||
|
@ -4,27 +4,47 @@ declare(strict_types=1);
|
||||
|
||||
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\Type;
|
||||
|
||||
final class AttributeAwareGenericTypeNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPStan\PhpDocParser\Ast\Type\GenericTypeNode;
|
||||
use Rector\AttributeAwarePhpDoc\Ast\Type\AttributeAwareGenericTypeNode;
|
||||
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeAwareNodeFactoryAwareInterface;
|
||||
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface;
|
||||
use Rector\BetterPhpDocParser\Attributes\Ast\AttributeAwareNodeFactory;
|
||||
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
|
||||
|
||||
final class AttributeAwareGenericTypeNodeFactory implements AttributeNodeAwareFactoryInterface, AttributeAwareNodeFactoryAwareInterface
|
||||
{
|
||||
/**
|
||||
* @var AttributeAwareNodeFactory
|
||||
*/
|
||||
private $attributeAwareNodeFactory;
|
||||
|
||||
public function getOriginalNodeClass(): string
|
||||
{
|
||||
return \PHPStan\PhpDocParser\Ast\Type\GenericTypeNode::class;
|
||||
return GenericTypeNode::class;
|
||||
}
|
||||
|
||||
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
|
||||
public function isMatch(Node $node): bool
|
||||
{
|
||||
return is_a($node, \PHPStan\PhpDocParser\Ast\Type\GenericTypeNode::class, true);
|
||||
return is_a($node, GenericTypeNode::class, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \PHPStan\PhpDocParser\Ast\Type\GenericTypeNode $node
|
||||
* @param 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
|
||||
);
|
||||
public function create(Node $node): AttributeAwareNodeInterface
|
||||
{
|
||||
$node->type = $this->attributeAwareNodeFactory->createFromNode($node->type);
|
||||
|
||||
foreach ($node->genericTypes as $key => $genericType) {
|
||||
$node->genericTypes[$key] = $this->attributeAwareNodeFactory->createFromNode($genericType);
|
||||
}
|
||||
|
||||
return new AttributeAwareGenericTypeNode($node->type, $node->genericTypes);
|
||||
}
|
||||
|
||||
public function setAttributeAwareNodeFactory(AttributeAwareNodeFactory $attributeAwareNodeFactory): void
|
||||
{
|
||||
$this->attributeAwareNodeFactory = $attributeAwareNodeFactory;
|
||||
}
|
||||
}
|
||||
|
@ -4,24 +4,29 @@ declare(strict_types=1);
|
||||
|
||||
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\Type;
|
||||
|
||||
final class AttributeAwareIdentifierTypeNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
|
||||
use Rector\AttributeAwarePhpDoc\Ast\Type\AttributeAwareIdentifierTypeNode;
|
||||
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface;
|
||||
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
|
||||
|
||||
final class AttributeAwareIdentifierTypeNodeFactory implements AttributeNodeAwareFactoryInterface
|
||||
{
|
||||
public function getOriginalNodeClass(): string
|
||||
{
|
||||
return \PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode::class;
|
||||
return IdentifierTypeNode::class;
|
||||
}
|
||||
|
||||
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
|
||||
public function isMatch(Node $node): bool
|
||||
{
|
||||
return is_a($node, \PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode::class, true);
|
||||
return is_a($node, IdentifierTypeNode::class, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode $node
|
||||
* @param IdentifierTypeNode $node
|
||||
*/
|
||||
public function create(
|
||||
\PHPStan\PhpDocParser\Ast\Node $node
|
||||
): \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface {
|
||||
return new \Rector\AttributeAwarePhpDoc\Ast\Type\AttributeAwareIdentifierTypeNode($node->name);
|
||||
public function create(Node $node): AttributeAwareNodeInterface
|
||||
{
|
||||
return new AttributeAwareIdentifierTypeNode($node->name);
|
||||
}
|
||||
}
|
||||
|
@ -4,24 +4,45 @@ declare(strict_types=1);
|
||||
|
||||
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\Type;
|
||||
|
||||
final class AttributeAwareIntersectionTypeNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPStan\PhpDocParser\Ast\Type\IntersectionTypeNode;
|
||||
use Rector\AttributeAwarePhpDoc\Ast\Type\AttributeAwareIntersectionTypeNode;
|
||||
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeAwareNodeFactoryAwareInterface;
|
||||
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface;
|
||||
use Rector\BetterPhpDocParser\Attributes\Ast\AttributeAwareNodeFactory;
|
||||
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
|
||||
|
||||
final class AttributeAwareIntersectionTypeNodeFactory implements AttributeNodeAwareFactoryInterface, AttributeAwareNodeFactoryAwareInterface
|
||||
{
|
||||
/**
|
||||
* @var AttributeAwareNodeFactory
|
||||
*/
|
||||
private $attributeAwareNodeFactory;
|
||||
|
||||
public function getOriginalNodeClass(): string
|
||||
{
|
||||
return \PHPStan\PhpDocParser\Ast\Type\IntersectionTypeNode::class;
|
||||
return IntersectionTypeNode::class;
|
||||
}
|
||||
|
||||
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
|
||||
public function isMatch(Node $node): bool
|
||||
{
|
||||
return is_a($node, \PHPStan\PhpDocParser\Ast\Type\IntersectionTypeNode::class, true);
|
||||
return is_a($node, IntersectionTypeNode::class, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \PHPStan\PhpDocParser\Ast\Type\IntersectionTypeNode $node
|
||||
* @param IntersectionTypeNode $node
|
||||
*/
|
||||
public function create(
|
||||
\PHPStan\PhpDocParser\Ast\Node $node
|
||||
): \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface {
|
||||
return new \Rector\AttributeAwarePhpDoc\Ast\Type\AttributeAwareIntersectionTypeNode($node->types);
|
||||
public function create(Node $node): AttributeAwareNodeInterface
|
||||
{
|
||||
foreach ($node->types as $key => $intersectionedType) {
|
||||
$node->types[$key] = $this->attributeAwareNodeFactory->createFromNode($intersectionedType);
|
||||
}
|
||||
|
||||
return new AttributeAwareIntersectionTypeNode($node->types);
|
||||
}
|
||||
|
||||
public function setAttributeAwareNodeFactory(AttributeAwareNodeFactory $attributeAwareNodeFactory): void
|
||||
{
|
||||
$this->attributeAwareNodeFactory = $attributeAwareNodeFactory;
|
||||
}
|
||||
}
|
||||
|
@ -4,24 +4,43 @@ declare(strict_types=1);
|
||||
|
||||
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\Type;
|
||||
|
||||
final class AttributeAwareNullableTypeNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPStan\PhpDocParser\Ast\Type\NullableTypeNode;
|
||||
use Rector\AttributeAwarePhpDoc\Ast\Type\AttributeAwareNullableTypeNode;
|
||||
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeAwareNodeFactoryAwareInterface;
|
||||
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface;
|
||||
use Rector\BetterPhpDocParser\Attributes\Ast\AttributeAwareNodeFactory;
|
||||
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
|
||||
|
||||
final class AttributeAwareNullableTypeNodeFactory implements AttributeNodeAwareFactoryInterface, AttributeAwareNodeFactoryAwareInterface
|
||||
{
|
||||
/**
|
||||
* @var AttributeAwareNodeFactory
|
||||
*/
|
||||
private $attributeAwareNodeFactory;
|
||||
|
||||
public function getOriginalNodeClass(): string
|
||||
{
|
||||
return \PHPStan\PhpDocParser\Ast\Type\NullableTypeNode::class;
|
||||
return NullableTypeNode::class;
|
||||
}
|
||||
|
||||
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
|
||||
public function isMatch(Node $node): bool
|
||||
{
|
||||
return is_a($node, \PHPStan\PhpDocParser\Ast\Type\NullableTypeNode::class, true);
|
||||
return is_a($node, NullableTypeNode::class, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \PHPStan\PhpDocParser\Ast\Type\NullableTypeNode $node
|
||||
* @param NullableTypeNode $node
|
||||
*/
|
||||
public function create(
|
||||
\PHPStan\PhpDocParser\Ast\Node $node
|
||||
): \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface {
|
||||
return new \Rector\AttributeAwarePhpDoc\Ast\Type\AttributeAwareNullableTypeNode($node->type);
|
||||
public function create(Node $node): AttributeAwareNodeInterface
|
||||
{
|
||||
$node->type = $this->attributeAwareNodeFactory->createFromNode($node->type);
|
||||
|
||||
return new AttributeAwareNullableTypeNode($node->type);
|
||||
}
|
||||
|
||||
public function setAttributeAwareNodeFactory(AttributeAwareNodeFactory $attributeAwareNodeFactory): void
|
||||
{
|
||||
$this->attributeAwareNodeFactory = $attributeAwareNodeFactory;
|
||||
}
|
||||
}
|
||||
|
@ -4,24 +4,29 @@ declare(strict_types=1);
|
||||
|
||||
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\Type;
|
||||
|
||||
final class AttributeAwareThisTypeNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPStan\PhpDocParser\Ast\Type\ThisTypeNode;
|
||||
use Rector\AttributeAwarePhpDoc\Ast\Type\AttributeAwareThisTypeNode;
|
||||
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface;
|
||||
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
|
||||
|
||||
final class AttributeAwareThisTypeNodeFactory implements AttributeNodeAwareFactoryInterface
|
||||
{
|
||||
public function getOriginalNodeClass(): string
|
||||
{
|
||||
return \PHPStan\PhpDocParser\Ast\Type\ThisTypeNode::class;
|
||||
return ThisTypeNode::class;
|
||||
}
|
||||
|
||||
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
|
||||
public function isMatch(Node $node): bool
|
||||
{
|
||||
return is_a($node, \PHPStan\PhpDocParser\Ast\Type\ThisTypeNode::class, true);
|
||||
return is_a($node, ThisTypeNode::class, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \PHPStan\PhpDocParser\Ast\Type\ThisTypeNode $node
|
||||
* @param ThisTypeNode $node
|
||||
*/
|
||||
public function create(
|
||||
\PHPStan\PhpDocParser\Ast\Node $node
|
||||
): \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface {
|
||||
return new \Rector\AttributeAwarePhpDoc\Ast\Type\AttributeAwareThisTypeNode();
|
||||
public function create(Node $node): AttributeAwareNodeInterface
|
||||
{
|
||||
return new AttributeAwareThisTypeNode();
|
||||
}
|
||||
}
|
||||
|
@ -4,24 +4,45 @@ declare(strict_types=1);
|
||||
|
||||
namespace Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactory\Type;
|
||||
|
||||
final class AttributeAwareUnionTypeNodeFactory implements \Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPStan\PhpDocParser\Ast\Type\UnionTypeNode;
|
||||
use Rector\AttributeAwarePhpDoc\Ast\Type\AttributeAwareUnionTypeNode;
|
||||
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeAwareNodeFactoryAwareInterface;
|
||||
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface;
|
||||
use Rector\BetterPhpDocParser\Attributes\Ast\AttributeAwareNodeFactory;
|
||||
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
|
||||
|
||||
final class AttributeAwareUnionTypeNodeFactory implements AttributeNodeAwareFactoryInterface, AttributeAwareNodeFactoryAwareInterface
|
||||
{
|
||||
/**
|
||||
* @var AttributeAwareNodeFactory
|
||||
*/
|
||||
private $attributeAwareNodeFactory;
|
||||
|
||||
public function getOriginalNodeClass(): string
|
||||
{
|
||||
return \PHPStan\PhpDocParser\Ast\Type\UnionTypeNode::class;
|
||||
return UnionTypeNode::class;
|
||||
}
|
||||
|
||||
public function isMatch(\PHPStan\PhpDocParser\Ast\Node $node): bool
|
||||
public function isMatch(Node $node): bool
|
||||
{
|
||||
return is_a($node, \PHPStan\PhpDocParser\Ast\Type\UnionTypeNode::class, true);
|
||||
return is_a($node, UnionTypeNode::class, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \PHPStan\PhpDocParser\Ast\Type\UnionTypeNode $node
|
||||
* @param UnionTypeNode $node
|
||||
*/
|
||||
public function create(
|
||||
\PHPStan\PhpDocParser\Ast\Node $node
|
||||
): \Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface {
|
||||
return new \Rector\AttributeAwarePhpDoc\Ast\Type\AttributeAwareUnionTypeNode($node->types);
|
||||
public function create(Node $node): AttributeAwareNodeInterface
|
||||
{
|
||||
foreach ($node->types as $key => $unionedType) {
|
||||
$node->types[$key] = $this->attributeAwareNodeFactory->createFromNode($unionedType);
|
||||
}
|
||||
|
||||
return new AttributeAwareUnionTypeNode($node->types);
|
||||
}
|
||||
|
||||
public function setAttributeAwareNodeFactory(AttributeAwareNodeFactory $attributeAwareNodeFactory): void
|
||||
{
|
||||
$this->attributeAwareNodeFactory = $attributeAwareNodeFactory;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory;
|
||||
|
||||
use Rector\BetterPhpDocParser\Attributes\Ast\AttributeAwareNodeFactory;
|
||||
|
||||
interface AttributeAwareNodeFactoryAwareInterface
|
||||
{
|
||||
public function setAttributeAwareNodeFactory(AttributeAwareNodeFactory $attributeAwareNodeFactory): void;
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory;
|
||||
|
||||
use Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactoryCollector;
|
||||
|
||||
interface AttributeAwareNodeFactoryCollectorAwareInterface
|
||||
{
|
||||
public function setAttributeAwareNodeFactoryCollector(
|
||||
AttributeAwareNodeFactoryCollector $attributeAwareNodeFactoryCollector
|
||||
): void;
|
||||
}
|
@ -5,43 +5,12 @@ declare(strict_types=1);
|
||||
namespace Rector\BetterPhpDocParser\Attributes\Ast;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\Node;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\ExtendsTagValueNode;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\ImplementsTagValueNode;
|
||||
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\PhpDocTagValueNode;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PropertyTagValueNode;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\ThrowsTagValueNode;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode;
|
||||
use PHPStan\PhpDocParser\Ast\Type\ArrayTypeNode;
|
||||
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\TypeNode;
|
||||
use PHPStan\PhpDocParser\Ast\Type\UnionTypeNode;
|
||||
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareExtendsTagValueNode;
|
||||
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareImplementsTagValueNode;
|
||||
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareMethodTagValueNode;
|
||||
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareParamTagValueNode;
|
||||
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwarePhpDocNode;
|
||||
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwarePropertyTagValueNode;
|
||||
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareReturnTagValueNode;
|
||||
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareThrowsTagValueNode;
|
||||
use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwareVarTagValueNode;
|
||||
use Rector\AttributeAwarePhpDoc\Ast\Type\AttributeAwareArrayTypeNode;
|
||||
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\AttributeAwareUnionTypeNode;
|
||||
use Rector\AttributeAwarePhpDoc\AttributeAwareNodeFactoryCollector;
|
||||
use Rector\BetterPhpDocParser\Ast\PhpDocNodeTraverser;
|
||||
use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeAwareNodeFactoryAwareInterface;
|
||||
use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface;
|
||||
use Rector\Exception\NotImplementedYetException;
|
||||
use Rector\Exception\ShouldNotHappenException;
|
||||
|
||||
/**
|
||||
@ -49,21 +18,13 @@ use Rector\Exception\ShouldNotHappenException;
|
||||
*/
|
||||
final class AttributeAwareNodeFactory
|
||||
{
|
||||
/**
|
||||
* @var PhpDocNodeTraverser
|
||||
*/
|
||||
private $phpDocNodeTraverser;
|
||||
|
||||
/**
|
||||
* @var AttributeAwareNodeFactoryCollector
|
||||
*/
|
||||
private $attributeAwareNodeFactoryCollector;
|
||||
|
||||
public function __construct(
|
||||
PhpDocNodeTraverser $phpDocNodeTraverser,
|
||||
AttributeAwareNodeFactoryCollector $attributeAwareNodeFactoryCollector
|
||||
) {
|
||||
$this->phpDocNodeTraverser = $phpDocNodeTraverser;
|
||||
public function __construct(AttributeAwareNodeFactoryCollector $attributeAwareNodeFactoryCollector)
|
||||
{
|
||||
$this->attributeAwareNodeFactoryCollector = $attributeAwareNodeFactoryCollector;
|
||||
}
|
||||
|
||||
@ -76,145 +37,23 @@ final class AttributeAwareNodeFactory
|
||||
return $node;
|
||||
}
|
||||
|
||||
if ($node instanceof PhpDocNode) {
|
||||
$this->phpDocNodeTraverser->traverseWithCallable($node, function (Node $node): AttributeAwareNodeInterface {
|
||||
if ($node instanceof AttributeAwareNodeInterface) {
|
||||
return $node;
|
||||
}
|
||||
|
||||
return $this->createFromNode($node);
|
||||
});
|
||||
|
||||
return new AttributeAwarePhpDocNode($node->children);
|
||||
}
|
||||
|
||||
foreach ($this->attributeAwareNodeFactoryCollector->provide() as $attributeNodeAwareFactory) {
|
||||
if (! $attributeNodeAwareFactory->isMatch($node)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// prevents cyclic dependency
|
||||
if ($attributeNodeAwareFactory instanceof AttributeAwareNodeFactoryAwareInterface) {
|
||||
$attributeNodeAwareFactory->setAttributeAwareNodeFactory($this);
|
||||
}
|
||||
|
||||
return $attributeNodeAwareFactory->create($node);
|
||||
}
|
||||
|
||||
if ($node instanceof PhpDocTagValueNode) {
|
||||
return $this->createFromPhpDocValueNode($node);
|
||||
}
|
||||
|
||||
if ($node instanceof TypeNode) {
|
||||
return $this->createFromTypeNode($node);
|
||||
}
|
||||
|
||||
throw new ShouldNotHappenException(sprintf('Node "%s" was missed in "%s".', get_class($node), __METHOD__));
|
||||
}
|
||||
|
||||
private function createFromPhpDocValueNode(PhpDocTagValueNode $phpDocTagValueNode): PhpDocTagValueNode
|
||||
{
|
||||
if ($phpDocTagValueNode instanceof VarTagValueNode) {
|
||||
$typeNode = $this->createFromTypeNode($phpDocTagValueNode->type);
|
||||
return new AttributeAwareVarTagValueNode(
|
||||
$typeNode,
|
||||
$phpDocTagValueNode->variableName,
|
||||
$phpDocTagValueNode->description
|
||||
);
|
||||
}
|
||||
|
||||
if ($phpDocTagValueNode instanceof ReturnTagValueNode) {
|
||||
$typeNode = $this->createFromTypeNode($phpDocTagValueNode->type);
|
||||
return new AttributeAwareReturnTagValueNode($typeNode, $phpDocTagValueNode->description);
|
||||
}
|
||||
|
||||
if ($phpDocTagValueNode instanceof ParamTagValueNode) {
|
||||
$typeNode = $this->createFromTypeNode($phpDocTagValueNode->type);
|
||||
return new AttributeAwareParamTagValueNode(
|
||||
$typeNode,
|
||||
$phpDocTagValueNode->isVariadic,
|
||||
$phpDocTagValueNode->parameterName,
|
||||
$phpDocTagValueNode->description,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
if ($phpDocTagValueNode instanceof MethodTagValueNode) {
|
||||
$typeNode = $phpDocTagValueNode->returnType !== null ? $this->createFromTypeNode(
|
||||
$phpDocTagValueNode->returnType
|
||||
) : null;
|
||||
return new AttributeAwareMethodTagValueNode(
|
||||
$phpDocTagValueNode->isStatic,
|
||||
$typeNode,
|
||||
$phpDocTagValueNode->methodName,
|
||||
$phpDocTagValueNode->parameters,
|
||||
$phpDocTagValueNode->description
|
||||
);
|
||||
}
|
||||
|
||||
if ($phpDocTagValueNode instanceof PropertyTagValueNode) {
|
||||
$typeNode = $this->createFromTypeNode($phpDocTagValueNode->type);
|
||||
return new AttributeAwarePropertyTagValueNode(
|
||||
$typeNode,
|
||||
$phpDocTagValueNode->propertyName,
|
||||
$phpDocTagValueNode->description
|
||||
);
|
||||
}
|
||||
|
||||
if ($phpDocTagValueNode instanceof ExtendsTagValueNode) {
|
||||
$typeNode = $this->createFromTypeNode($phpDocTagValueNode->type);
|
||||
return new AttributeAwareExtendsTagValueNode($typeNode, $phpDocTagValueNode->description);
|
||||
}
|
||||
|
||||
if ($phpDocTagValueNode instanceof ImplementsTagValueNode) {
|
||||
$typeNode = $this->createFromTypeNode($phpDocTagValueNode->type);
|
||||
return new AttributeAwareImplementsTagValueNode($typeNode, $phpDocTagValueNode->description);
|
||||
}
|
||||
|
||||
if ($phpDocTagValueNode instanceof ThrowsTagValueNode) {
|
||||
$typeNode = $this->createFromTypeNode($phpDocTagValueNode->type);
|
||||
return new AttributeAwareThrowsTagValueNode($typeNode, $phpDocTagValueNode->description);
|
||||
}
|
||||
|
||||
throw new NotImplementedYetException(sprintf(
|
||||
'Implement "%s" to "%s"',
|
||||
get_class($phpDocTagValueNode),
|
||||
throw new ShouldNotHappenException(sprintf(
|
||||
'Node "%s" was missed in "%s". Generate it with: bin/rector sync-types',
|
||||
get_class($node),
|
||||
__METHOD__
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return AttributeAwareNodeInterface|TypeNode
|
||||
*/
|
||||
private function createFromTypeNode(TypeNode $typeNode): AttributeAwareNodeInterface
|
||||
{
|
||||
if ($typeNode instanceof NullableTypeNode) {
|
||||
$typeNode->type = $this->createFromTypeNode($typeNode->type);
|
||||
return new AttributeAwareNullableTypeNode($typeNode->type);
|
||||
}
|
||||
|
||||
if ($typeNode instanceof UnionTypeNode || $typeNode instanceof IntersectionTypeNode) {
|
||||
foreach ($typeNode->types as $i => $subTypeNode) {
|
||||
$typeNode->types[$i] = $this->createFromTypeNode($subTypeNode);
|
||||
}
|
||||
|
||||
if ($typeNode instanceof UnionTypeNode) {
|
||||
return new AttributeAwareUnionTypeNode($typeNode->types);
|
||||
}
|
||||
|
||||
return new AttributeAwareIntersectionTypeNode($typeNode->types);
|
||||
}
|
||||
|
||||
if ($typeNode instanceof ArrayTypeNode) {
|
||||
$typeNode->type = $this->createFromTypeNode($typeNode->type);
|
||||
return new AttributeAwareArrayTypeNode($typeNode->type);
|
||||
}
|
||||
|
||||
if ($typeNode instanceof GenericTypeNode) {
|
||||
/** @var AttributeAwareIdentifierTypeNode $identifierTypeNode */
|
||||
$identifierTypeNode = $this->createFromTypeNode($typeNode->type);
|
||||
foreach ($typeNode->genericTypes as $key => $genericType) {
|
||||
$typeNode->genericTypes[$key] = $this->createFromTypeNode($genericType);
|
||||
}
|
||||
|
||||
return new AttributeAwareGenericTypeNode($identifierTypeNode, $typeNode->genericTypes);
|
||||
}
|
||||
|
||||
throw new NotImplementedYetException(sprintf('Implement "%s" to "%s"', get_class($typeNode), __METHOD__));
|
||||
}
|
||||
}
|
||||
|
@ -65,8 +65,6 @@ final class AttributeAwareNodeFactoryTest extends AbstractKernelTestCase
|
||||
/** @var PropertyTagValueNode $propertyTagValueNode */
|
||||
$nullableTypeNode = $propertyTagValueNode->type;
|
||||
|
||||
dump($nullableTypeNode);
|
||||
|
||||
$this->assertInstanceOf(NullableTypeNode::class, $nullableTypeNode);
|
||||
$this->assertInstanceOf(AttributeAwareNullableTypeNode::class, $nullableTypeNode);
|
||||
|
||||
|
@ -7,6 +7,7 @@ namespace Rector\SOLID\Rector\If_;
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\BinaryOp;
|
||||
use PhpParser\Node\Expr\BinaryOp\BooleanAnd;
|
||||
use PhpParser\Node\Expr\BooleanNot;
|
||||
use PhpParser\Node\Stmt\If_;
|
||||
use PhpParser\Node\Stmt\Return_;
|
||||
@ -152,7 +153,7 @@ PHP
|
||||
|
||||
// special case
|
||||
if ($invertedCondition instanceof BooleanNot) {
|
||||
if ($invertedCondition->expr instanceof BinaryOp\BooleanAnd) {
|
||||
if ($invertedCondition->expr instanceof BooleanAnd) {
|
||||
$booleanNotPartIf = new If_(new BooleanNot($invertedCondition->expr->left));
|
||||
$booleanNotPartIf->stmts = [clone $return];
|
||||
$this->addNodeAfterNode($booleanNotPartIf, $if);
|
||||
|
@ -1,11 +1,17 @@
|
||||
services:
|
||||
Rector\SOLID\Rector\If_\ChangeNestedIfsToEarlyReturnRector: null
|
||||
Rector\CodingStyle\Rector\Namespace_\ImportFullyQualifiedNamesRector: null
|
||||
# Rector\SOLID\Rector\If_\ChangeNestedIfsToEarlyReturnRector: null
|
||||
# Rector\SOLID\Rector\If_\ChangeIfElseValueAssignToEarlyReturnRector: null
|
||||
|
||||
imports:
|
||||
- { resource: "create-rector.yaml", ignore_errors: true }
|
||||
|
||||
parameters:
|
||||
paths:
|
||||
- src
|
||||
- tests
|
||||
- packages
|
||||
|
||||
exclude_paths:
|
||||
- "/Source/"
|
||||
- "/*Source/"
|
||||
|
Loading…
x
Reference in New Issue
Block a user