Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add @extends ServiceEntityRepository<TEntityClass> #313

Open
stephanvierkant opened this issue May 15, 2024 · 2 comments
Open

Add @extends ServiceEntityRepository<TEntityClass> #313

stephanvierkant opened this issue May 15, 2024 · 2 comments

Comments

@stephanvierkant
Copy link

stephanvierkant commented May 15, 2024

PHPStan doesn't support Repositories as a service: phpstan/phpstan-doctrine#178, phpstan/phpstan-doctrine#67 (comment)

Would be great if we can use Rector to add this annotation:

+ /** @extends ServiceEntityRepository<Document>  */
final class DocumentRepository extends ServiceEntityRepository
{
    public function __construct(ManagerRegistry $registry)
    {
        parent::__construct($registry, Document::class);
    }
}
@TomasVotruba
Copy link
Member

Sounds good 👍

Could you add rule to a code quality set here?

@stephanvierkant
Copy link
Author

With some help of ChatGPT I already have this: https://gist.github.com/stephanvierkant/a341c1c336b01022661e16a7e8a2a2fd

It worked for me, but I'll try to create a PR here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants