Readonly properties cannot be changed after initialization, i.e. after a value is assigned to them.
They are a great way to model value objects and d

PHP: PHP 8.1.0 Release Announcement

submited by
Style Pass
2021-11-25 19:00:12

Readonly properties cannot be changed after initialization, i.e. after a value is assigned to them. They are a great way to model value objects and data-transfer objects.

Objects can now be used as default parameter values, static variables, and global constants, as well as in attribute arguments.

A function or method declared with the never type indicates that it will not return a value and will either throw an exception or end the script’s execution with a call of die(), exit(), trigger_error(), or something similar.

Fibers are primitives for implementing lightweight cooperative concurrency. They are a means of creating code blocks that can be paused and resumed like Generators, but from anywhere in the stack. Fibers themselves don't magically provide concurrency, there still needs to be an event loop. However, they allow blocking and non-blocking implementations to share the same API.

Fibers allow getting rid of the boilerplate code previously seen with Promise::then() or Generator based coroutines. Libraries will generally build further abstractions around Fibers, so there's no need to interact with them directly.

Leave a Comment