Skip to content

@ApiFilter(SearchFilter::class) not recognized #3243

@stephanvierkant

Description

@stephanvierkant

Bug Report

Subject Details
Rector version dev-master@112025d
Installed as composer dependency

Minimal PHP Code Causing Issue

use ApiPlatform\Core\Annotation\ApiFilter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;

class Entity
{
    /**
     * @ApiFilter(SearchFilter::class)
     */
    protected $someProperty;
}

When running Rector:

In ApiFilter.php line 61:

[ApiPlatform\Core\Exception\InvalidArgumentException]
The filter class "SearchFilter::class" does not implement "ApiPlatform\Core\Api\FilterInterface". Did you forget a use statement?

However, this works as expected:
/**
* @APIFilter(ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter)
*/

So Rector doesn't recongnize class name resolution via ::class in annotations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions