Skip to content

6.0 - RFC - Remove argument overloading #18002

@ADmad

Description

@ADmad

Description

We have various methods where argument overloading is used for ease of use. For e.g. for RouteBuilder::scope() if the 2nd argument is a callback it's used as the 3rd argument.

The availability of named arguments and autocompleting features of today's IDEs negate the need of such loading. Removing the overloading would make the API cleaner.

Functions list

  • Entity::set(array|string $field, mixed $value = null, array $options = [])
  • ConsoleInputArgument::__construct(array|string $name, string $help = '', bool $required = false, array $choices = [], ?string $default = null, ?string $separator = null) Remove argument overloading #18868
  • RouteBuilder::scope(string $path, Closure|array $params, ?Closure $callback = null)
  • RouteBuilder::resources(string $name, Closure|array $options = [], ?Closure $callback = null)
  • RouteBuilder::prefix(string $name, Closure|array $params = [], ?Closure $callback = null)
  • RouteBuilder::plugin(string $name, Closure|array $params = [], ?Closure $callback = null)
  • public function on(EventListenerInterface|string $eventKey, callable|array $options = [], ?callable $callable = null)

CakePHP Version

6.0

Sub-issues

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions