Skip to content

4.0 Roadmap

ADmad edited this page Nov 12, 2019 · 61 revisions

CakePHP 4.0 will be a breaking change from 3.x. Unlike 3.0, 4.0 will primarily be a clean-up release. Instead of introducing large backwards incompatible changes, 4.0.0 will focus on removing all the deprecated features we've accumulated throughout the life of 3.x. Any method/feature emitting run-time warnings in 3.6 will be removed from 4.0. 4.0 will not add significant new features as the bulk of the release will be spent on cleanup efforts.

Cleanup Tasks

  • Remove all deprecated methods.
  • Remove non-static methods from Cake\Database\Type and move the common instance methods into a trait.
  • Fix array options for PaginatorHelper::generateUrl() and Url::build().
  • Add methods to all interfaces currently defined with @method. See 12094
  • Add interface for mail transport classes. See 12084. Creating of transport instances has now been offloaded to TransportFactory and TransportRegistry which ensures the transport object is instance of AbstractTransport. So a new interface is not necessary.
  • Clean up Request\Response objects. Both objects will become immutable as per the PSR7 recommendations.
  • Implement batch casting for core database types. See 11754.
  • Remove auto-id addition in form URL calls. See 11794
  • Remove magic file handling from responses 11921
  • Undo revert and re-add proper consistent typehinting.

Require at least PHP 7.1

By the time CakePHP 4.x ships PHP5 will only be receiving security fixes. The same is true for PHP 7.0.x. Because of this, CakePHP 4.x will require at least PHP 7.1, maybe 7.2.

Use stricter typing where possible

With PHP5 support removed, internally we should aim to leverage scalar type hints and strict typing as much as possible. These features reduce the number of tests and code we need to maintain/run for type checking. The addition of type hints should not be added if they will cause significant backwards compatibility breaks. One of the goals of 4.x is be a 'simple' upgrade from 3.x.

Use new features of PHP 7.1+

  • Use Null coalesce
  • Use nullable return types and parameter types.

API improvements

Implement PSR 16

Support for PSR15 middleware

Splitting up combined setter/getter methods

  • Splitting the combined wrappers reduces complexity and risk of errors and at the same time provides a simpler API that is also more PHP7+ compatible. We will try to be as BC as possible here during 4.x and remove them in the next major version only.

ORM improvements

  • Associations use finder for loading data.
  • Association proxy methods deleteAll, updateAll, and exists use finder conditions.
  • Remove the __call() magic method in Cake\ORM\Query. Add concrete implementation in the ORM, so that the source code is easier to reason about, requires less docblock links and is more obvious when being read.

Typehinting with Interfaces

  • Event typehint from Event to EventInterface

Better defaults

Some of these things couldn't be done in 3.x due to BC reasons, but can be applied to 4.x.

  • Use null instead of false for "nullable" return alternative where possible (string|false => string|null).
  • Hash::extract() not transforming values anymore #8053

Upgrading help

Other improvements (possibly BC breaking)

  • FormHelper now generates native HTML5 datetime inputs instead of selects #12934
  • Better timezone handling #11517 / #10877
  • More consistent validate callback #12697
  • Fix IS NULL hidden query issues #11789
  • Add actual methods to interfaces instead of @method tags #12094
  • Order of argument in Validator::notEmpty() #10598
  • Cake\Network\Http\Client outside of a CakePHP context #6763

Documentation updates

  • Remove all the 'prior to' notices.
  • Remove all the versionadded and versionchanged admonitions.
  • Update routing examples to use {var} style placeholders.
  • Update code examples to have updated method signatures on all hook methods.

Core Plugin Updates and tooling

  • Update DebugKit for 4.x
  • Update Bake for 4.x
  • Update Authentication for 4.x
  • Update Authorization for 4.x
  • Update Phinx for 4.x
  • Update Migrations for 4.x
  • Update ElasticSearch for 4.x
  • Add rector tasks for file renames
  • Add rector tasks for method renames
  • Move docs for authentication to plugin-docs tools
  • Move docs for authorization to plugin-docs tools
  • Move docs for debugkit to plugin-docs tools
  • Move docs for bake to plugin-docs tools
  • Move docs for chronos to plugin-docs tools
  • Move docs for migrations to plugin-docs tools
  • Move docs for elasticsearch to plugin-docs tools
  • publish docs for bake 2.x
  • publish docs for debugkit 4.x
  • publish docs for chronos 2.x
  • publish docs for authentication 2.x
  • publish docs for authorization 2.x

Further topics

Many can also go into 4.1+ here if BC.