-
-
Notifications
You must be signed in to change notification settings - Fork 77
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
PHPStan complains about return type of instantiateWith in a PersistentProxyObjectFactory factory #721
Comments
which Foundry's (and PHPStan) version are you using? |
Hi @nikophil, thanks for your answer. I'm using PHPStan 1.12.11 (the latest version of v1) and Foundry 2.2.2. I'm sorry I made a mistake in my explanations: the problem is not with the If you need it, I can create a minimal project tomorrow in order to reproduce the problem. |
I've created a repository to reproduce the problem: https://github.com/marien-probesys/foundry-721 You can see the error here: https://github.com/marien-probesys/foundry-721/actions/runs/11915667680/job/33206464561 And the factory: https://github.com/marien-probesys/foundry-721/blob/main/src/Factory/PostFactory.php |
thanks for your reproducer! I'll soon check this |
Hi, I really don't know what to do to make PHPStan happy here 🤔 you code seems OK, but the phpdoc for @kbond any thoughts? |
Hi,
I use PHPStan to verify the typing in my application. I have an issue when using the
instantiateWith()
method in aPersistentProxyObjectFactory
factory.instantiateWith()
is declared in theObjectFactory
and must return an object of the template classT
. However, when inheriting from thePersistentProxyObjectFactory
class,T
becomesT&Proxy<T>
. Meaning that PHPStan expectsinstantiateWith()
to return aT&Proxy<T>
object.The text was updated successfully, but these errors were encountered: