Skip to content

Conversation

@dereuromark
Copy link
Member

Summary

Follow-up to #8215. Fixes remaining signature mismatches verified against the CakePHP 5.x source code:

  • RouteBuilder::prefix/plugin are instance methods, not static
  • CacheEngine: write/read renamed to set/get per PSR-16
  • Session: parameter names $key -> $name to match source
  • ServerRequest::addDetector: parameter $options -> $detector
  • Response: fix nullable types, union types, and parameter names for withStringBody, withCache, withExpires, withEtag, withModified, withVary, withHeader
  • ConsoleIo::ask: correct to 2 params ($prompt, $default), not 3
  • ConsoleIo::createFile: add missing $forceOverwrite param
  • LogTrait::log: add Stringable type, $context param, fix class attribution
  • newClientResponse: class is HttpClientTrait, not Response

- RouteBuilder::prefix/plugin are instance methods, not static
- CacheEngine::write/read renamed to set/get per PSR-16
- Session methods use $name parameter, not $key
- ServerRequest::addDetector parameter is $detector
- Response: fix nullable types, union types, and parameter names
  for withStringBody, withCache, withExpires, withEtag, withModified,
  withVary, withHeader
- ConsoleIo::ask has 2 params (not 3), createFile has $forceOverwrite
- LogTrait::log accepts Stringable|string and $context param
- newClientResponse is on HttpClientTrait, not Response
@dereuromark dereuromark marked this pull request as ready for review February 1, 2026 20:08
### Prefix Routing

`static` Cake\\Routing\\RouteBuilder::**prefix**(string $name, Closure|array $params = [], ?Closure $callback = null): static
`method` Cake\\Routing\\RouteBuilder::**prefix**(string $name, Closure|array $params = [], ?Closure $callback = null): static
Copy link
Member Author

Choose a reason for hiding this comment

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

Is that correct? or do we keep static here?

Copy link
Contributor

Choose a reason for hiding this comment

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

well technically its still static but I do believe we now recommend using the routebuilder instance oriented way of writing this, so adjusting it to method seems fine by me.

@dereuromark dereuromark merged commit 2a9f2d4 into 5.x Feb 2, 2026
5 checks passed
@dereuromark dereuromark deleted the fix/method-signature-types-2 branch February 2, 2026 10:46
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.

4 participants