# PHP Annotations Plugin Inspections

**Inspections** report missing annotation imports, deprecated annotation classes, unresolved or deprecated class constants in DocBlocks, deprecated Doctrine column types, and missing Doctrine repository classes.

---

## Missing annotation import

**Feature ID:** `AnnotationMissingUseInspection`  
**Feature Page:** [Missing annotation import](https://espend.de/phpstorm/plugin/php-annotations#annotation-missing-use-inspection)  

Reports DocBlock annotations that look like project annotation classes but are not imported or resolvable from the current namespace.

The quick fix imports the selected annotation class and preserves aliases when several candidates are possible.

### Code Examples

```php
# Before quick fix:
/**
 * @NotBlank()
 */
private string $name;
```

```php
# After quick fix:
use Symfony\Component\Validator\Constraints\NotBlank;

/**
 * @NotBlank()
 */
private string $name;
```

---

## Deprecated annotation classes

**Feature ID:** `AnnotationDeprecatedInspection`  
**Feature Page:** [Deprecated annotation classes](https://espend.de/phpstorm/plugin/php-annotations#annotation-deprecated-inspection)  

Highlights annotation usages whose underlying annotation class is deprecated.

Deprecated annotations are also deprioritized in completion, so active annotation classes appear before deprecated alternatives.

### Code Examples

```php
# Deprecated annotation usage:
/**
 * @OldRoute("/legacy")
 */
public function legacy(): Response
{
}
```

```php
# Annotation class:
/**
 * @Annotation
 * @deprecated Use NewRoute instead.
 */
final class OldRoute {}
```

---

## Class constant validation in DocBlocks

**Feature ID:** `AnnotationDocBlockClassConstantInspections`  
**Feature Page:** [Class constant validation in DocBlocks](https://espend.de/phpstorm/plugin/php-annotations#annotation-doc-block-class-constant-inspections)  

Checks class constant expressions inside DocBlock annotation values.

The plugin reports unresolved classes behind `::class` and highlights deprecated class or constant usage inside annotation arguments.

### Code Examples

```php
# Unresolved class constant:
/**
 * @Route(defaults={MissingController::class})
 */
public function index(): Response
{
}
```

```php
# Deprecated constant:
/**
 * @SomeAnnotation(mode=LegacyMode::OLD_VALUE)
 */
final class Example {}
```

---

## Deprecated Doctrine column types

**Feature ID:** `DoctrineTypeDeprecatedInspection`  
**Feature Page:** [Deprecated Doctrine column types](https://espend.de/phpstorm/plugin/php-annotations#doctrine-type-deprecated-inspection)  

Reports deprecated Doctrine DBAL column type usages in ORM column annotations and attributes.

The inspection resolves custom DBAL type classes, Doctrine 3 `Doctrine\DBAL\Types\Types` constants, and built-in fallback types before checking deprecation metadata.

### Code Examples

```php
# DocBlock mapping:
/**
 * @ORM\Column(type="json_array")
 */
private array $payload = [];
```

```php
# Attribute mapping:
#[ORM\Column(type: 'json_array')]
private array $payload = [];
```

---

## Missing Doctrine repository class

**Feature ID:** `RepositoryClassInspection`  
**Feature Page:** [Missing Doctrine repository class](https://espend.de/phpstorm/plugin/php-annotations#repository-class-inspection)  

Reports Doctrine entity mappings whose `repositoryClass` value cannot be resolved.

The quick fix uses the same repository generation logic as the editor action, creating or wiring the repository class when possible.

### Code Examples

```php
# Problematic mapping:
/**
 * @ORM\Entity(repositoryClass="ProductRepository")
 */
final class Product {}
```

```php
# Generated target:
namespace App\Repository;

use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;

final class ProductRepository extends ServiceEntityRepository
{
}
```

---

