Router::scope() deprecated block cake bake after migration

Hi, i migrate my project to 4.1 in 4.3. But now when i want use cake bake i have this error message:

`Router::scope()` is deprecated, use the non-static method `RouteBuilder::scope()` instead.
/var/www/TALA/back_end/vendor/cakephp/cakephp/src/Routing/Router.php, line: 929
You can disable all deprecation warnings by setting `Error.errorLevel` to `E_ALL & ~E_USER_DEPRECATED`. Adding `vendor/cakephp/cakephp/src/Routing/Router.php` to `Error.ignoredDeprecationPaths` in your `config/app.php` config will mute deprecations from that file only.

i dont know where is used Router::scope and where i can change it. I dont want modify app.php to ignore deprecated so how can i do?

Thanks for help

The main problem is the fact, that PHP 8.0 removed the context parameter which we used to show the original source of the deprecation.
See context parameter of error handler deprecated · Issue #15195 · cakephp/cakephp · GitHub

If you can’t see the deprecation in the frontend via the debug_kit toolbar then I would only recommend you to grep for that code part like

grep -R 'Router::scope(' .

Hi, thanks for your help.
I search

'Router::scope('

but only found in vendor (vendor/cakephp/cakephp/src/Routing/Router.php), so i cant change it…

To move forward, I therefore modified the error_level while waiting

For information my version of php is 7.4.3

It could also be that some plugin uses the Router::plugin() method so you can grep for that as well.

There’s some way to turn off deprecation notices for plugins, as I recall.

Thanks for your answer,

I add this in my config/app.php:

'Error' => [
        'errorLevel' => E_ALL & ~E_USER_DEPRECATED,

and all is ok, i can use cake bake with console.

Otherwise the last resort would be to enable xdebug in your setup and set a breakpoint in that static function which throws the deprecation error.