CakeDC / cakephp-phpstan

CakePHP extension for PHPStan
Other
30 stars 5 forks source link

Backport of features from 3.* for cakephp 4 #35

Open Harfusha opened 1 month ago

Harfusha commented 1 month ago

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 :)

rochamarcelo commented 1 month ago

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

rochamarcelo commented 1 month ago

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

Harfusha commented 1 month ago

I will try it tomorrow, thanks :)

Harfusha commented 1 month ago

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().

rochamarcelo commented 1 month ago

HAve you added phpdoc to your localhost cakephp install https://github.com/cakephp/cakephp/blob/5.x/src/ORM/Association/BelongsToMany.php#L41

Harfusha commented 1 month ago

That may be the problem, i dont have time to test it today, but i will test is asap

Harfusha commented 1 month ago

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 :)

Harfusha commented 1 month ago

When the PR will be merged into cakephp 4 i will make PR for this repo

Harfusha commented 1 week ago

I will make the PR next week