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

Raise PHPStan level to 2 #58

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

szepeviktor
Copy link
Contributor

Under level 4 👺 viktor says: broken application/package
(not polite)

@szepeviktor
Copy link
Contributor Author

szepeviktor commented May 7, 2023

Yes, many return types are interfaces, not concrete implementations.
So: many methods are missing.

But there are exceptions 🤯

private ShopOrderRepository $repository;

@szepeviktor
Copy link
Contributor Author

szepeviktor commented May 7, 2023

Let me pull out my secret laser gun 🔫

/** @var TermRepository */
private RepositoryInterface $repository;

@szepeviktor
Copy link
Contributor Author

szepeviktor commented May 7, 2023

Errors on Level 2 reduced from 140 to 51 🎉

Supporting RepositoryClass attribute: phpstan/phpstan#9279

I do not know how to go on as there is no mechanism in PHPStan
getRepository(string $entityClassName): RepositoryInterface to find out the repository class from entity class.

... although one can write a tiny type specifying extension.

@szepeviktor
Copy link
Contributor Author

szepeviktor commented May 10, 2023

The above so called "PHPStan extension" finds out Repository names using str_replace :(
But reduces the number of problems to 38!

@szepeviktor
Copy link
Contributor Author

@williarin Could you help fixing remaining ones?

@szepeviktor szepeviktor marked this pull request as ready for review May 10, 2023 06:14
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

Successfully merging this pull request may close these issues.

1 participant