Upgrading
Upgrading to Version 4.0
The minimum required PHP version is 8.0.
The Nette\Utils\Reflection class provided the methods getParameterType(),
getPropertyType(), and getReturnType() for working with types. These methods were created when PHP
didn't have union, intersection, or the newest disjunctive normal form types, with which they no longer work correctly. They have
been replaced by the Type class. As of version 4.0, these methods have been
removed.
The variable Nette\Utils\Html::$xhtml has been removed.
Flags in some methods have been replaced by named arguments. The original notation still works, but is no longer preferred:
Json::PRETTY → pretty:, Json::ESCAPE_UNICODE → asciiSafe:,
Json::FORCE_ARRAY → forceArrays:, PREG_GREP_INVERT in Arrays::grep() →
invert:, Image::SHRINK_ONLY in Image::resize() → shrinkOnly:, and the
PREG_* flags in Strings::split(), match() and matchAll().
The method Nette\Utils\Reflection::getParameterDefaultValue() is deprecated, because the native
ReflectionParameter::getDefaultValue() already works correctly.
If you use RobotLoader, update it to version 4 as well.
Finder
Finder has moved to the nette/utils package. Remove the original nette/finder package:
composer remove nette/finder
On Linux, Finder now operates in case-sensitive mode by default.
In the previous version, the exclude() and filter() methods behaved differently depending on whether
they were called before or after from() or in(). This is no longer the case;
exclude() and filter() always function the same way. The behavior of filter() called
after from()/in() is now handled by the new method descentFilter().
Finder no longer implements the Countable interface.
A string starting with a slash in Finder::findFiles('/f*') is now considered an absolute path. If you intended a
relative path from the current directory, replace it with, for example, Finder::findFiles('./f*').
If a directory you are searching in does not exist, Nette\InvalidStateException is thrown (instead of the previous
UnexpectedValueException).
What else the rewritten Finder can do is described in the article Finder 4.0: 10 years of experience under the hood.
Upgrading to Version 3.1
Nette\Utils\Arrays::searchKey()was renamed togetKeyOffset()Nette\Utils\Callback::closure()is deprecated in favor ofClosure::fromCallable()Nette\Utils\Reflection::toString()appends()after the function/method nameNette\Utils\Strings::toAscii()triggers a notice when ext-intl is not present
Upgrading to Version 3.0
The Nette\Localization\ITranslator interface has changed.
Nette\Object is deprecated since Nette 2.4 and was removed in Nette 3.0, but it still exists under the new name
Nette\LegacyObject (the name object cannot be used since PHP 7.1) in the nette/deprecated package.
Upgrading to Version 2.4
Framework classes now use the Nette\SmartObject trait instead of inheriting from Nette\Object, which
differs in several cases:
- it supports “emulated properties” only when the annotation
@property type $nameis present - it does not support “extension methods”
- it does not support “getReflection”
- it does not support obtaining methods such as
$this->formSubmitted; use a classic PHP callback[$this, 'formSubmitted']instead
The Nette\Utils\Html::add() method was replaced by addHtml() and addText().
Upgrading to Version 2.3
Image::from()throwsImageExceptionwhen it is unable to decode the fileImage::getFormatFromString()is deprecatedStrings::chr()andnormalize()now work only with UTF-8 encodingStrings::chr()throwsNette\InvalidArgumentExceptionif the code point is not in the valid range