All Projects → Haehnchen → Idea Php Annotation Plugin

Haehnchen / Idea Php Annotation Plugin

Licence: mit
Add PHP annotation support for PhpStorm and IntelliJ

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Idea Php Annotation Plugin

Idea Php Symfony2 Plugin
IntelliJ IDEA / PhpStorm Symfony Plugin
Stars: ✭ 797 (+268.98%)
Mutual labels:  doctrine, symfony, intellij, intellij-plugin, phpstorm, annotation
Idea Php Drupal Symfony2 Bridge
PhpStorm plugin to support Symfony components inside Drupal 8
Stars: ✭ 34 (-84.26%)
Mutual labels:  symfony, intellij, intellij-plugin, phpstorm, annotation
idea-php-shopware-plugin
Shopware Plugin for PhpStorm which extends Symfony Plugin
Stars: ✭ 50 (-76.85%)
Mutual labels:  doctrine, intellij, phpstorm, intellij-plugin
Idea Php Laravel Plugin
Laravel Framework Plugin for PhpStorm / IntelliJ IDEA
Stars: ✭ 537 (+148.61%)
Mutual labels:  symfony, intellij, intellij-plugin, phpstorm
Idea Php Toolbox
Collections of tools and improvements to make PhpStorm a little bit better
Stars: ✭ 147 (-31.94%)
Mutual labels:  intellij, intellij-plugin, phpstorm, annotation
idea-php-typo3-plugin
TYPO3 CMS Plugins for IntelliJ IDEA / PhpStorm
Stars: ✭ 93 (-56.94%)
Mutual labels:  intellij, phpstorm, intellij-plugin
referencer-plugin
"Referencer" plugin for Jetbrains IDEs
Stars: ✭ 20 (-90.74%)
Mutual labels:  intellij, phpstorm, intellij-plugin
Idea Php Generics Plugin
Support generics types in PhpStorm via psalm / phpstan docblock
Stars: ✭ 146 (-32.41%)
Mutual labels:  intellij, intellij-plugin, phpstorm
Yii2support
Yii2 Support for PhpStorm / IntelliJ IDEA
Stars: ✭ 280 (+29.63%)
Mutual labels:  intellij, intellij-plugin, phpstorm
idea-php-advanced-autocomplete
Plugin for PhpStorm IDE. Adds auto-completion support for various built-in PHP functions, where parameter is a string literal.
Stars: ✭ 57 (-73.61%)
Mutual labels:  intellij, phpstorm, intellij-plugin
Magento2 Phpstorm Plugin
PHPStorm Plugin for Magento 2
Stars: ✭ 294 (+36.11%)
Mutual labels:  intellij, intellij-plugin, phpstorm
Runconfigurationasaction
Provides a way to use IntelliJ run configurations as buttons
Stars: ✭ 17 (-92.13%)
Mutual labels:  intellij, intellij-plugin, phpstorm
dummytext-plugin
"Dummy Text Generator" plugin for Jetbrains IDEs
Stars: ✭ 31 (-85.65%)
Mutual labels:  intellij, phpstorm, intellij-plugin
interstellar
Dark editor theme for JetBrains IDEs
Stars: ✭ 26 (-87.96%)
Mutual labels:  intellij, phpstorm, intellij-plugin
intellij-neos
Support for the Neos CMS in Intellij IDEA / PhpStorm
Stars: ✭ 37 (-82.87%)
Mutual labels:  intellij, phpstorm, intellij-plugin
Svelte Intellij
Svelte components in WebStorm and friends
Stars: ✭ 345 (+59.72%)
Mutual labels:  intellij, intellij-plugin, phpstorm
Phpinspectionsea
A Static Code Analyzer for PHP (a PhpStorm/Idea Plugin)
Stars: ✭ 1,211 (+460.65%)
Mutual labels:  intellij, intellij-plugin, phpstorm
Collector Intellij
A PhpStorm plugin for refactoring to collections
Stars: ✭ 114 (-47.22%)
Mutual labels:  intellij, intellij-plugin, phpstorm
Mavenhelper
IntelliJ plugin - https://plugins.jetbrains.com/plugin/7179
Stars: ✭ 138 (-36.11%)
Mutual labels:  intellij, intellij-plugin
Elm Plugin
Elm language support plugin for IntelliJ IDEA.
Stars: ✭ 137 (-36.57%)
Mutual labels:  intellij, intellij-plugin

IntelliJ IDEA / PhpStorm PHP Annotations

Build Status Version Downloads Downloads last month Donate to this project using Paypal

Provides PHP annotation support for PhpStorm / IntelliJ IDEA and references for "Code > Optimize Imports" action. Code extraction of Symfony Plugin

Key Value
Plugin url https://plugins.jetbrains.com/plugin/7320
Id de.espend.idea.php.annotation
Changelog CHANGELOG

Install

  • Download plugin or install directly out of PhpStorm
  • Force file reindex if necessary with: File -> Invalidate Cache

Settings

Languages & Framework > PHP > Annotations

Round brackets

/**
 * @Foo<caret>()
 * @Foo<caret>
 */
class NotBlank extends Constraint {}

Use / Import alias

Languages & Framework > PHP > Annotations -> Use Alias

use Doctrine\ORM\Mapping as ORM;

/**
 * @Id() -> @ORM\Id()
 */
class Foo {}

Class LineMarker

LineMarker which provide navigation to annotation class usages

namespace Doctrine\ORM\Mapping;

/**
 * @Annotation
 */
final class Entity implements Annotation
{
}

Targeting

/**
 * @ORM\Entity()
 */

Annotation Class Detection

  • Every class with @Annotation inside class doc block is detected on file indexing
  • Annotation Properties on property names
  • Property value types
  • @ENUM Tags
/**
 * @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 non provided its added to "ALL list"

/**
 * @Annotation
 * @Target("PROPERTY", "METHOD", "CLASS", "ALL")
 */
class NotBlank extends Constraint {
    public $message = 'This value should not be blank.';
}

Extension Points

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>

PHP Attributes Bridge

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") */

Completion confidence

Annoying pressing completion shortcut? Plugin provides a nice completion confidence to open completion popover on several conditions

/**
 * @<caret>
 * <caret>
 */

Static values

    /**
     * @DI\Observe(SomethingEvents::PRE_UPDATE)
     */

Doctrine

ORM: Property generator

class Foo {
    public $id<caret>;

    /**
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     * @ORM\Column(type="integer")
     */
    public $id<caret>;
}

ORM: class entity generator

/**
 * @ORM\Entity(repositoryClass="Foo")
 * @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>")
 */

PHP Toolbox

Provides integration for PHP Toolbox

Default and property values

use 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"
    }
  ],
}

Property array values

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"
        }
      ]
    }
  ]
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].