A colleague is cloning a repo and getting the following error when running bake commands through our own plugin:
PHP Fatal error: Declaration of OurPlugin\Command\ModelCommand::findBelongsTo(Cake\ORM\Table $model, array $associations): array must be compatible with Bake\Command\ModelCommand::findBelongsTo(Cake\ORM\Table $model, array $associations, ?Cake\Console\Arguments $args = null): array in C:\Users\colleague_name_here\Downloads\xampp_php81\htdocs\OurApp\plugins\OurPlugin\src\Command\ModelCommand.php on line 334
I don't get that issue with my existing local copy. I was able to replicate cloning and duplicating to another folder. Where is that vendor change coming from?
In composer.json
:
"cakephp/bake": "^2.3",
vendor file, where the function definition seems to have changed
public function findBelongsTo(Table $model, array $associations, ?Arguments $args = null): array
Current plugin:
public function findBelongsTo(Table $model, array $associations): array
In GitHub, https://github.com/cakephp/bake/blob/2.3.0/src/Command/ModelCommand.php
public function findBelongsTo(Table $model, array $associations): array