Backport of features from 3.* for cakephp 4
Im i need of this extension TableAssociationTypeNodeResolverExtension, but i saw that it was added in version 3.1.
Any possiblity you will backport it?
Im little bit lost in this repo, but with little guidance i can backport it myself :)
The require phpdoc is only available in the CakePHP 5 @template and @mixin https://github.com/cakephp/cakephp/blob/5.x/src/ORM/Association/BelongsToMany.php#L41
This is the source for TableAssociationTypeNodeResolverExtension https://github.com/CakeDC/cakephp-phpstan/blob/3.next-cake5/src/PhpDoc/TableAssociationTypeNodeResolverExtension.php
The extension is loaded at https://github.com/CakeDC/cakephp-phpstan/blob/3.next-cake5/extension.neon#L62
If you have the time you could try to add the required phpdoc for CakePHP 4 at your localhost and try TableAssociationTypeNodeResolverExtension.php
If that work then sent a pull request to CakePHP and here
I will try it tomorrow, thanks :)
When it is added it throws this error + the old one Call to an undefined method Cake\ORM\Association\BelongsTo<App\Model\Table\AccountsTable>::getAccountTier().
HAve you added phpdoc to your localhost cakephp install https://github.com/cakephp/cakephp/blob/5.x/src/ORM/Association/BelongsToMany.php#L41
That may be the problem, i dont have time to test it today, but i will test is asap
Yes that did the job! Thanks a lot, i will open PR for cakephp 4 :)
Edit: This helped me fix 200+ phpstan errors, thanks a lot for your time :)
When the PR will be merged into cakephp 4 i will make PR for this repo
I will make the PR next week
Released version 2.1.0 . Thank You.
Getting a lot of new errors since updated to 2.1.0:
Call to an undefined method
Cake\ORM\Association\HasMany<App\Model\Table\MyTable>::createInitial().
568 Access to an undefined property
Cake\ORM\Association\HasMany<App\Model\Table\MyTable>::$SomeRelationShip.
💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property
Does SomeRelationShip property exists on MyTable? Can you provide code snippet?
Does SomeRelationShip property exists on MyTable? Can you provide code snippet?
Both, the method and also the property exists. The problem is that after the update phpstan instead of HasMany&MyTable now sees HasMany as a generic and MyTable as the type used by the generic. So of course the property and method do not exist on HasMany. Reverting the version back to 2.0.1 resolves the issue.
I have version 2.1.0 on my enterprise app with phpstan 9 and extra strictness and this version fixed me 577 errors. Can you provide the code snippet?
It sounds like you are using an older version of CakePHP
It sounds like you are using an older version of CakePHP
Could be it, I am on 4.4, latest would be 4.5.
Will let you know if updating to 4.5 helped.