Skip to content

Conversation

@LordSimal
Copy link
Contributor

@LordSimal LordSimal commented Oct 12, 2025

Refs: cakephp/cakephp#18002

There is still one problem though which I have not yet tackled:

$routes->scope(path: '/api', callback: function ($routes): void {});

does not work, as params needs to be set as an empty array (which we don't have as a default value only on that method, not the others)

@ADmad ADmad marked this pull request as draft October 12, 2025 19:14
@LordSimal LordSimal force-pushed the 5.x-routebuilder-named-args branch from 826e9cd to 6a4bb79 Compare October 13, 2025 10:46
@LordSimal
Copy link
Contributor Author

To not make the configuration too complicated i just hard coded the scope specific logic in that rule

@LordSimal LordSimal marked this pull request as ready for review October 13, 2025 10:47
@LordSimal LordSimal requested a review from ADmad October 13, 2025 10:47
$routes->scope('/api', function (RouteBuilder $routes): void {});
CODE_SAMPLE,
<<<'CODE_SAMPLE'
$routes->scope(path: '/api', options: [], callback: function (RouteBuilder $routes): void {});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like the reaming of $params to $options, we use the term "route params".

We need to first update the method and make $params argument default to empty array and make $callable not nullable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll leave those changes to the the core to you @ADmad

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems only resources() should be $options.

@dereuromark
Copy link
Member

Do you think #367 is complete?

@LordSimal LordSimal force-pushed the 5.x-routebuilder-named-args branch from 8d60f3c to c3280a4 Compare November 27, 2025 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants