Skip to content

Commit

Permalink
migration guide for Nette 4.0 [WIP]
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Apr 18, 2023
1 parent 98bc5ea commit 0867508
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 0 deletions.
1 change: 1 addition & 0 deletions migrations/cs/@home.texy
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Přechod na novější verze
************************

- [z Nette 3.1 na 4.0 |to-4-0]
- [z Nette 3.0 na 3.1 |to-3-1]
- [z Nette 2.4 na 3.0 |to-3-0]
- [z Nette 2.3 na 2.4 |to-2-4]
Expand Down
1 change: 1 addition & 0 deletions migrations/cs/@left-menu.texy
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Přechod na novější verze
************************
- [Úvod |@home]
- [Z verze 3.1 na 4.0 |to-4-0]
- [Z verze 3.0 na 3.1 |to-3-1]
- [Z verze 2.4 na 3.0 |to-3-0]
- [Z verze 2.3 na 2.4 |to-2-4]
Expand Down
61 changes: 61 additions & 0 deletions migrations/cs/to-4-0.texy
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
Přechod na verzi 4.0
********************

.[note]
Tato stránka vzniká postupně s tím, jak se uvolňují jednotlivé balíčky.

Minimální požadovaná verze PHP je 8.0

Všechny změny názvů uvedené v tomto dokumentu znamenají, že původní název samozřejmě nadále existuje a funguje, jen je označený jako deprecated. Můžete se setkat s tím, že vám je bude IDE vizuálně označovat jako deprecated.

/--comment
Verzí Nette 4.0 se rozumí, že máte tyto balíčky nainstalované ve verze 4.0.*. Ostatní balíčky mohou mít vyšší nebo nižší čísla verzí, kompatibilitu hlídá Composer.

```json
"require": {
"nette/application": "4.0.*",
"nette/bootstrap": "3.2.*",
"nette/caching": "3.2.*",
"nette/database": "4.0.*",
"nette/forms": "4.0.*",
"nette/http": "4.0.*",
"nette/security": "4.0.*",
},
```
\--


Utils 4.0
---------

Třída `Nette\Utils\Reflection` poskytovala metody pro práci s typy `getParameterType()`, `getPropertyType()` a `getReturnType()`. Metody vznikly v době, kdy PHP nemělo union, intersection nebo nejnovější disjunctive normal form typy, se kterými už nefungují a nahradila je [třída Type |utils:type]. Od verze 4.0 jsou tyto metody odstraněné.

Metoda `Nette\Utils\Reflection::getParameterDefaultValue()` je deprecated, protože nativní `ReflectionParameter::getDefaultValue()` už funguje správně.

Zrušená je proměnná `Nette\Utils\Html::$xhtml`.

Pro instalaci Nette Utils 4.0 je potřeba aktualizovat i RobotLoader na verzi 4, pokud jej používáte, a odstranit balíček `nette/finder`:

```shell
composer remove nette/finder
composer require "nette/utils:^4.0" "nette/robot-loader:^4.0"
```


Finder 4.0
----------

Finder se přestěhoval do balíčku `nette/utils`, viz [#Utils 4.0].

Na Linuxu se nově chová v režimu case-sensitive.

V předchozí verzi platilo, že metody `exclude()` a `filter()` fungovaly jinak, když byly zavolány **před** `from()` resp. `in()` a **po** ní. Tohle už neplatí, `exclude()` a `filter()` fungují vždy stejně. Dřívější `filter()` volaný *až po* nahradila nová metoda `descentFilter()`.

Finder již neimplementuje rozhraní Countable.

Řetězec začínající lomítkem ve `Finder::findFiles('/f*')` se nově považuje za absolutní cestu, je potřeba ho nahradit např. za `Finder::findFiles('./f*')`.




{{priority: -5}}
1 change: 1 addition & 0 deletions migrations/en/@home.texy
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Upgrade Guide
*************

- [from Nette 3.1 to 4.0 |to-4-0]
- [from Nette 3.0 to 3.1 |to-3-1]
- [from Nette 2.4 to 3.0 |to-3-0]
- [from Nette 2.3 to 2.4 |to-2-4]
Expand Down
1 change: 1 addition & 0 deletions migrations/en/@left-menu.texy
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Upgrade Guide
*************
- [Overview |@home]
- [From 3.1 to 4.0 |to-4-0]
- [From 3.0 to 3.1 |to-3-1]
- [From 2.4 to 3.0 |to-3-0]
- [From 2.3 to 2.4 |to-2-4]
Expand Down
59 changes: 59 additions & 0 deletions migrations/en/to-4-0.texy
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
Migrating to Version 4.0
************************

.[note]
This page is being built incrementally as packages are released.

Minimum required PHP version is 8.0

All name changes mentioned in this document mean that the original name obviously still exists and works, it is just marked as deprecated. You may encounter the IDE visually marking them as deprecated.

/--comment
Verzí Nette 4.0 se rozumí, že máte tyto balíčky nainstalované ve verze 4.0.*. Ostatní balíčky mohou mít vyšší nebo nižší čísla verzí, kompatibilitu hlídá Composer.

```json
"require": {
"nette/application": "4.0.*",
"nette/bootstrap": "3.2.*",
"nette/caching": "3.2.*",
"nette/database": "4.0.*",
"nette/forms": "4.0.*",
"nette/http": "4.0.*",
"nette/security": "4.0.*",
},
```
\--


Utils 4.0
---------

The `Nette\Utils\Reflection` class provided methods `getParameterType()`, `getPropertyType()` and `getReturnType()` for working with the types. These methods were created when PHP didn't have union, intersection or the newest disjunctive normal form types, which they no longer work with and were replaced by the [Type class |utils:type]. As of version 4.0, these methods have been removed.

The method `Nette\Utils\Reflection::getParameterDefaultValue()` is deprecated because the native `ReflectionParameter::getDefaultValue()` already works correctly.

The `Nette\Utils\Html::$xhtml` variable is removed.

To install Nette Utils 4.0 you need to update RobotLoader to version 4 if you are using it, and remove the `nette/finder` package:

```shell
composer remove nette/finder
composer require "nette/utils:^4.0" "nette/robot-loader:^4.0"
```


Finder 4.0
----------

Finder has moved to the package `nette/utils`, see [Utils 4.0 |#Utils 4.0].

On Linux, it now behaves in case-sensitive mode.

In the previous version, the `exclude()` and `filter()` methods worked differently when called **before** `from()` and `in()` respectively, and **after** it. This is no longer the case, `exclude()` and `filter()` always work the same. The former `filter()` called *before* has been replaced by the new `descentFilter()` method.

The Finder no longer implements the Countable interface.

A string starting with a slash in `Finder::findFiles('/f*')` is now considered an absolute path, it should be replaced with e.g. `Finder::findFiles('./f*')`.


{{priority: -5}}

0 comments on commit 0867508

Please sign in to comment.