cakephp / bake

The Bake Command Plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong signature for get() in table classes

BGehrels opened this issue · comments

Description

It is perfectly valid in CakePHP 5 to call:

        $user = $this->Users->get($userId, contain: ['Userroles']);

But if i bake the table class with cake bake, it generates the following comment:

 * @method \App\Model\Entity\User get($primaryKey, $options = [])

This then results - at least in PHPStorm and i guess in other static analyzers, too - in an error message:

Unknown named parameter 'contain'

Bake Version

3.0.2

PHP Version

8.2.10

Indeed, it seems the annotations dont play well with the named parameters
I still use the array syntax because of it, as removing the annotation also would remove the correct return type..

I wonder if there is a way to signal the IDEs that those are both applicable as array or np.

PR open