Nette 3.0.0 alpha released!
- David Grudl
- Nette Core | 8228
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()
andpos()
return NULL instead of FALSE if the needle was not foundArrays::searchKey()
returns NULL instead of FALSE when item is not foundContainerBuilder::getServiceName()
returns NULL instead of FALSEDatabase\ResultSet
: changed empty result return type offetch()
andfetchField()
from FALSE to NULLUI\ComponentReflection::parseAnnotation()
returns NULL instead of FALSELatte\MacroTokens::fetchWord()
returns NULL instead of FALSE on errorPhpGenerator\Method
: empty body is NULL instead of FALSE- and
Image::save()
andsend()
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()
, useredirectPermanent()
. UI\Component::getParam()
ComponentModel\Component::__construct()
parameter$parent
is deprecatedComponentModel\Container::getComponents()
: removed (unknown) child-first optionHttp: 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 unusednormalizeRow()
andformatBool()
, addedformatDateInterval()
andinitialize()
), inIStructure
(addedgetPrimaryAutoincrementKey()
) andIRowContainer
(addedfetchField()
)
DI
- removed deprecated support for inheritance ‘child < parent’
Http
HttpExtension
: uses interfacesHttp\IRequest
&Http\IResponse
instead ofHttp\Request
&Http\Response
PhpGenerator
Helpers::formatArgs()
checks for insufficient number of placeholders
RobotLoader
$autoRebuild
replaced withsetAutoRefresh()
(available since v2.4.2)setCacheStorage()
replaced withsetTempDirectory()
(available since v2.4.2)- RobotLoader is case sensitive
Security
User::setExpiration()
removed second argument$whenBrowserIsClosed
and replaced with$flags
(possible valueIUserStorage::CLEAR_IDENTITY
)
Utils
Validators::assertField:
first argument has type hint array
- Tomáš Votruba
- Moderator | 1114
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
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
How to test Nette 3.0 with ease?
Last edited by Tomáš Votruba (2017-02-05 00:04)
- Honza Kuchař
- Member | 1662
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)
- Pavel Kravčík
- Member | 1196
You can check all commits to Nette-family repos: http://nette-commits.cz/
- Felix
- Nette Core | 1245
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)