upgrade icon indicating copy to clipboard operation
upgrade copied to clipboard

More missing rectors

Open dereuromark opened this issue 2 years ago • 9 comments

In test cases

protected $fixtures = [

should be

protected array $fixtures = [

dereuromark avatar Dec 12 '23 11:12 dereuromark

This would require separate ruleset and adjusted docs since it needs to be applied to the tests folder, not the src folder

LordSimal avatar Dec 12 '23 14:12 LordSimal

I dont think so. I always run the upgrade over all folders, src and tests. It will just ignore the ones that dont match.

dereuromark avatar Dec 12 '23 15:12 dereuromark

Cool that you do it but at least in our docs we reference that these rules should only be applied to the src directory. https://book.cakephp.org/5/en/appendices/5-0-upgrade-guide.html

Also parsing unnecessary files in rector only increases the upgrade time so trying to apply rector rules in the tests folder which can never be applied seems like an obvious waste of ressources.

LordSimal avatar Dec 12 '23 17:12 LordSimal

You misread that statement IMO The point is to use a folder inside ROOT, never ROOT Doing ROOT will explode your computer, but using src/, tests/, config/ or any other non root (thus non vendor) folder works out of the box super quick and easy, no problems.

So we can also just clarify the docs here further :)

dereuromark avatar Dec 12 '23 17:12 dereuromark

Then the docs are 100% not clear, agreed

LordSimal avatar Dec 12 '23 17:12 LordSimal

Could also be the fact that I never had something inside tests which would have automatically be fixed via the rector tool.... could also be how I write my tests... 😅

LordSimal avatar Dec 12 '23 18:12 LordSimal

Should we detect that the provided path is a project root and do the right thing for users? If we can find a src/, tests/, config/ directories we could add those to the list instead of the provided directory. Might make using the upgrade tool simpler to operate. I've bumped into this in the past as well.

markstory avatar Jan 01 '24 06:01 markstory

Also:

  • TableRegistry::get() could maybe be fixed up to the non deprecated version

dereuromark avatar Feb 07 '24 08:02 dereuromark

Also tried adding

new ModalToGetSet('Cake\ORM\Entity', 'source'),

into 3.4 set

but it didnt seem to work. The source() method is on the trait.. maybe thats the issue.

dereuromark avatar Feb 07 '24 09:02 dereuromark