Nette 3.0.0 alpha released!

David Grudl
Nette Core | 8228
+
+61
-

Nette 3.0.0 alpha has just been released!

Nette is one of the very first frameworks that uses strict_types, scalar type hints and return type hints. Which is a fundamental step towards more robust applications.

Minimum required PHP version is 7.1 (7.0 for some packages).

This version is highly compatible with 2.4 and is intended for testing new type hints and strict_types features.

TODO: tool for automatic adding of the necessary type hints to your code.

Stages of development of individual packages

  • Security, Robot-Loader, Php-Generator, Neon, Finder, Component-Model, Caching, Bootstrap: finished, just need to be tested
  • Mail: all that remains is better API for SmtpMailer
  • Utils: all that remains is support for immutable DateTime
  • Database: resolve pull requests
  • Application, Http: on roadmap are bigger internal changes to support middlewares (current stage is early alpha)
  • Latte: on roadmap is the new API for macros with AST (current stage is early alpha)
  • Form: on roadmap are improvements including automatic CSRF protection, dynamic forms, etc
  • DI: on roadmap are improvements in Compiler extensions (priorities etc)
  • Tester: all that remains is output handlers refactoring
  • Tracy, Reflection, SafeStream, Tokenizer: new versions of these packages are not planned at the moment

BC breaks

Due to the new return type hints some method returns NULL instead of FALSE on failure:

  • Strings::before(), after(), indexOf() and pos() return NULL instead of FALSE if the needle was not found
  • Arrays::searchKey() returns NULL instead of FALSE when item is not found
  • ContainerBuilder::getServiceName() returns NULL instead of FALSE
  • Database\ResultSet: changed empty result return type of fetch() and fetchField() from FALSE to NULL
  • UI\ComponentReflection::parseAnnotation() returns NULL instead of FALSE
  • Latte\MacroTokens::fetchWord() returns NULL instead of FALSE on error
  • PhpGenerator\Method: empty body is NULL instead of FALSE
  • and Image::save() and send() throws ImageException on failure

Similary in Forms SubmitButton::setValidationScope() accepts ?array, so replace in your code FALSE with empty array []

Some classes & members are marked as final.

Deprecations

  • first parameter $code is deprecated in UI\Component::redirect(), use redirectPermanent().
  • UI\Component::getParam()
  • ComponentModel\Component::__construct() parameter $parent is deprecated
  • ComponentModel\Container::getComponents(): removed (unknown) child-first option
  • Http: IRequest, IResponse, Url: parameters $default are deprecated

Database

  • SqlPreprocessor: all scalars are always passed via binding (may cause BC break in Postgresql)
  • there are changes in ISupplementalDriver (removed unused normalizeRow() and formatBool(), added formatDateInterval() and initialize()), in IStructure (added getPrimaryAutoincrementKey()) and IRowContainer (added fetchField())

DI

  • removed deprecated support for inheritance ‘child < parent’

Http

  • HttpExtension: uses interfaces Http\IRequest & Http\IResponse instead of Http\RequestHttp\Response

PhpGenerator

  • Helpers::formatArgs() checks for insufficient number of placeholders

RobotLoader

  • $autoRebuild replaced with setAutoRefresh() (available since v2.4.2)
  • setCacheStorage() replaced with setTempDirectory() (available since v2.4.2)
  • RobotLoader is case sensitive

Security

  • User::setExpiration() removed second argument $whenBrowserIsClosed and replaced with $flags (possible value IUserStorage::CLEAR_IDENTITY)

Utils

  • Validators::assertField: first argument has type hint array
kravčo
Member | 721
+
+11
-

I have not been here for quite a while and I see nothing has changed :) Still on the edge… of future.

Tomáš Votruba
Moderator | 1114
+
0
-

Thanks for the release! Much love for PHP 7.1!

What is the easiest step to try it out?

Is is possible to try it, when some of my dependencies lock Nette to "nette/nette": "^2.4"?

Last edited by Tomáš Votruba (2017-02-04 14:55)

David Grudl
Nette Core | 8228
+
+1
-

The only way I know is to manually replace content of /vendor/nette with Nette 3.0 and run composer dumpautoload.

I am working on automatic tool that adds needed typehints to your code.

Tomáš Votruba
Moderator | 1114
+
+7
-

How to test Nette 3.0 with ease?

Last edited by Tomáš Votruba (2017-02-05 00:04)

Honza Kuchař
Member | 1662
+
+5
-

I have made new web app on top of Nette 3 and I haven't found any issue during development. Pure PHP 7.1 awesomeness! ♥

Last edited by Honza Kuchař (2017-08-11 22:41)

sk8rdog
Member | 2
+
0
-

It has been awhile, any word on a Beta release of Nette 3? Any updates to documentation, blogs etc on the upcoming changes?

Last edited by sk8rdog (2018-03-03 02:57)

Pavel Kravčík
Member | 1196
+
+3
-

You can check all commits to Nette-family repos: http://nette-commits.cz/

maral
Member | 25
+
+2
-

I am looking forward to 3.0! $row->fetch() returning FALSE gives me headaches when trying to use type hints in our app.

dkorpar
Member | 136
+
+2
-

@DavidGrudl any news regarding 3.0 on English? any roadmap or ETA?

Felix
Nette Core | 1245
+
0
-

Pavel Kravčík wrote:

You can check all commits to Nette-family repos: http://nette-commits.cz/

The correct domain is https://commits.nette.org

Last edited by Felix (2021-12-01 17:39)