Nette and support for PHP 8.1

David Grudl
Nette Core | 7540
+
+6
-

All Nette packages should be ready for PHP 8.1, which should be released at the end of November.

At the moment, this mostly applies to development versions (i.e. master or 3.1-dev, etc., not yet tagged). If you're going to experiment with PHP 8.1, you might as well test Nette gradually.

So Nette 3.1 will support PHP 7.2 – 8.1 (and possibly higher), and the upcoming Nette 4 will support PHP 8.0 – 8.1 (and higher). On the other hand, PHP 8.1 will definitely not be supported by Nette 3.0 or 2.4, as it would be very complicated.

PhpGenerator

The current version 3.6.0 (RC) supports all the new PHP 8.1 tweaks such as enum, readonly properties, final constants, intersection types, etc.

DI

You can use enums directly in configuration files:

enum Role {
	case Admin;
	...
}
services:
	- User(Role::Admin)

DI also understands intersection types, which, like union types, it does not autowire.

Tracy

Enum support has been added to Dumper.

RobotLoader

Implemented autoloading for enums.