Provides PHP annotation extended Attribute support and for PhpStorm / IntelliJ IDEA and references for "Code > Optimize Imports" action.
File -> Invalidate Cache
PHP > Annotations / Attributes
/** * @Foo<caret>() * @Foo<caret> */ class NotBlank extends Constraint {}
PHP -> Annotations / Attributes -> Use Alias
use Doctrine\ORM\Mapping as ORM; /** * @Id() -> @ORM\Id() * @NotBlank() -> @Assert\NotBlank() */ class Foo {}
use Doctrine\ORM\Mapping as ORM; #[Id] -> #[ORM\Id()] #[NotBlank] -> #[Assert\NotBlank()] class Foo {}
LineMarker which provides navigation to annotation class usages
namespace Doctrine\ORM\Mapping; /** * @Annotation */ final class Entity implements Annotation { }
Targeting
Annotation Class Detection@Annotation
inside class doc block is detected on file indexing/** * @Annotation */ class NotBlank extends Constraint { public $message = 'This value should not be blank.'; public $groups = array(); /** * @var bool|boolean */ public $option = false; /** * * @Enum({"AUTO", "SEQUENCE", "TABLE", "IDENTITY", "NONE", "UUID", "CUSTOM"}) */ public $strategy = 'AUTO'; /** * @var array<string> */ public $cascade; /** * @var mixed|foobar|bool */ public $mixed; }
https://www.doctrine-project.org/projects/doctrine-annotations/en/latest/custom.html#attribute-types
/** * @Annotation * * @Attributes({ * @Attribute("stringProperty", type = "string"), * @Attribute("annotProperty", type = "bool"), * }) */ * * @Attributes( * @Attribute("stringProperty", type = "string"), * @Attribute("annotProperty", type = "bool"), * ) */ class Foobar {}Annotation Target Detection
@Target
is used to attach annotation, if none provided it is added to "ALL list"
/** * @Annotation * @Target("PROPERTY", "METHOD", "CLASS", "ALL") */ class NotBlank extends Constraint { public $message = 'This value should not be blank.'; }
Plugins provides several extension points, which allows external plugins to provide additional. See some examples on Symfony2 Plugin
Example for extension points.
<extensionPoints> <extensionPoint name="PhpAnnotationCompletionProvider" interface="de.espend.idea.php.annotation.extension.PhpAnnotationCompletionProvider"/> <extensionPoint name="PhpAnnotationReferenceProvider" interface="de.espend.idea.php.annotation.extension.PhpAnnotationReferenceProvider"/> <extensionPoint name="PhpAnnotationDocTagGotoHandler" interface="de.espend.idea.php.annotation.extension.PhpAnnotationDocTagGotoHandler"/> <extensionPoint name="PhpAnnotationDocTagAnnotator" interface="de.espend.idea.php.annotation.extension.PhpAnnotationDocTagAnnotator"/> <extensionPoint name="PhpAnnotationGlobalNamespacesLoader" interface="de.espend.idea.php.annotation.extension.PhpAnnotationGlobalNamespacesLoader"/> <extensionPoint name="PhpAnnotationVirtualProperties" interface="de.espend.idea.php.annotation.extension.PhpAnnotationVirtualProperties"/> <!-- Custom class alias mapping: "ORM" => "Doctrine\\ORM\\Mapping" --> <extensionPoint name="PhpAnnotationUseAlias" interface="de.espend.idea.php.annotation.extension.PhpAnnotationUseAlias"/> </extensionPoints>
Usage
<extensions defaultExtensionNs="de.espend.idea.php.annotation"> <PhpAnnotationExtension implementation="de.espend.idea.php.annotation.completion.PhpAnnotationTypeCompletionProvider"/> </extensions>
All extensions points providing support to DocBlock and PHP Attributes at the same time.
use Symfony\Component\Validator\Constraints\NotBlank; #[NotBlank(message: 'An empty file is not allowed.')] /* @NotBlank({message: "An empty file is not allowed."}) */
#[Template('foo.html.twig')] /* @Template("foo.html.twig") */
Annoying pressing completion shortcut? Plugin provides a nice completion confidence to open completion popover on several conditions
/** * @<caret> * <caret> */
/** * @DI\Observe(SomethingEvents::PRE_UPDATE) */
class Foo { /** * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") * @ORM\Column(type="integer") */ public $id<caret>; }
class Foo { #[ORM\Id] #[ORM\GeneratedValue(strategy: 'AUTO')] #[ORM\Column(type: 'integer')] public $id<caret>; }ORM: class entity generator
#[ORM\Entity(repositoryClass: \Foo::class)] #[ORM\Table(name: 'bike')] class Foo { }ORM: repository class generator / intention
/** * @ORM\Entity(repositoryClass="UnknownClass") */ class Foo { }
/** * @ORM\Entity<caret> */ class Foo { }ORM: repository class completion
/** * @ORM\Entity(repositoryClass="<caret>") */
Provides integration for PHP Toolbox
Default and property valuesuse Symfony\Component\Routing\Annotation\Route; /** * @Route("<caret>") * @Route(condition="<caret>") */
{ "registrar":[ { "signatures":[ { "class": "Symfony\\Component\\Routing\\Annotation\\Route", "type": "annotation" }, { "class": "Symfony\\Component\\Routing\\Annotation\\Route", "field": "condition", "type": "annotation" } ], "provider":"foo", "language":"php" } ], }
use Symfony\Component\Routing\Annotation\Route; /** * @Route(methods={"<caret>"}) */
{
"registrar":[
{
"language":"php",
"provider":"methods",
"signatures":[
{
"class": "Symfony\\Component\\Routing\\Annotation\\Route",
"type": "annotation_array",
"field": "methods"
}
]
}
],
"providers": [
{
"name": "methods",
"items":[
{
"lookup_string": "POST"
}
]
}
]
}
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4