Skip to content

Fix critical method signature mismatches with 5.x source#8179

Merged
josbeir merged 2 commits into5.xfrom
fix-method-signatures
Jan 28, 2026
Merged

Fix critical method signature mismatches with 5.x source#8179
josbeir merged 2 commits into5.xfrom
fix-method-signatures

Conversation

@dereuromark
Copy link
Member

Summary

Fixes critical method signature mismatches between the documentation and the actual CakePHP 5.x source code. Relates to #7744.

These are the signatures that were fundamentally wrong (nonexistent methods, extra/missing parameters, syntax errors) — not just missing types.

  • Entity::dirty()isDirty()dirty() does not exist in 5.x, replaced by isDirty()/setDirty()
  • Table::get($id, $options = [])get(mixed $primaryKey, array|string $finder = 'all', ...) — completely different signature since the $options array was replaced by named parameters
  • Table::find($type, ...)find(string $type = 'all', ...) — added type and default
  • RouteBuilder::extensions()setExtensions()extensions() does not exist, split into setExtensions()/addExtensions()/getExtensions()
  • PaginatorHelper::counter($format, $options)counter(string $format = 'pages')$options parameter does not exist
  • PaginatorHelper::generateUrl(..., $model, ...) → removed $model — parameter does not exist
  • PaginatorHelper::hasNext($model)hasNext() — no parameters in source
  • Controller::addViewClasses()addViewClasses(array $viewClasses) — was missing required parameter
  • Cache::add($key, $value $config)add(string $key, mixed $value, string $config = 'default') — had syntax error (missing comma) and missing types

Fixes method signatures that were wrong, referenced nonexistent
methods, or had extra/missing parameters compared to the actual
CakePHP 5.x source code. Relates to #7744.

Changes:
- Entity::dirty() -> isDirty() (dirty() does not exist in 5.x)
- Table::get() updated to match new named-parameter signature
- Table::find() add type and default for $type parameter
- RouteBuilder::extensions() -> setExtensions() (extensions() does
  not exist)
- PaginatorHelper::counter() remove nonexistent $options parameter
- PaginatorHelper::generateUrl() remove nonexistent $model parameter
- PaginatorHelper::hasNext() remove nonexistent $model parameter
- Controller::addViewClasses() add missing $viewClasses parameter
- Cache::add() fix syntax error (missing comma) and add types
@josbeir josbeir merged commit 2c8f49d into 5.x Jan 28, 2026
5 checks passed
@josbeir josbeir deleted the fix-method-signatures branch January 28, 2026 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants