PHP Annotated – September 2019

Posted on by

Greetings everyone,



It’s time for our September edition of PHP Annotated! Get the latest on PHP 7.4.0 RC 1, Laravel 6, Monolog 2, and other releases. There are loads of insights from PHP Internals, including Union Types RFC, plus we’ll share links for Laravel and Symfony, useful tools, videos, podcasts, and a whole lot more!



⚡️ News & Releases

PHP 7.4.0 RC1 – The release-candidates cycle for the 7.4 branch has started now. At least 6 RCs are expected before the GA release.

PHP 7.1.32, PHP 7.2.22, PHP 7.3.9 – Security releases with fixes for critical vulnerabilities. All users are encouraged to update.

Monolog 2.0.0 – It’s been 4 years since it was first announced and now, finally, Monolog 2.0 is released. It requires PHP 7.2, uses type hints where possible and strict_types mode, and has new handlers (e.g. SqsHandler, TelegramBotHandler) and more. Support for Monolog 1.x will continue.

🐘 PHP Internals

Straw poll for P++ feasibility – Just in case you missed it, the P++ idea was rejected unanimously by the PHP community as completely unfeasible.

[PoC] throw_legacy_failure declare statement – An interesting pull request to PHP proof of concept for letting internal/old functions be able to throw an Exception in case of failure, instead of using the legacy behavior of returning null or false . This behavior is controlled using the declare statement: declare(throw_legacy_failure=1) .

or . This behavior is controlled using the declare statement: . [RFC] Reclassifying engine warnings – Nikita Popov proposes taking a look at the existing warnings and notices in the engine, and thinking about whether their current classification is still appropriate: “Undefined variable” should be at least a Warning.

[RFC] Union Types v2 – Another epic proposal from Nikita continues on the work of Bob&Levi. It suggests adding union types in PHP 8. It would mean that any variable can be one of the specified types. You have been able to use union types in PHPDoc for a long time, but now they are will be checked.

The proposed syntax T1|T2|... could be used anywhere you can use type declarations now: class Number { private int|float $number; public function setNumber(int|float $number): void { $this->number = $number; } public function getNumber(): int|float { return $this->number; } }

Noteworthy, the RFC is published as a pull request to php/php-rfcs repo and anyone can comment or react with emojis. The final vote will still take place at wiki.php.net as before. According to Nikita’s message, this first experiment went well despite some noise in top-level comments, and the proposal received a lot of valuable feedback from the community.

The proposed syntax could be used anywhere you can use type declarations now: Noteworthy, the RFC is published as a pull request to php/php-rfcs repo and anyone can comment or react with emojis. The final vote will still take place at wiki.php.net as before. According to Nikita’s message, this first experiment went well despite some noise in top-level comments, and the proposal received a lot of valuable feedback from the community. In PHP 8 error_reporting will be E_ALL by default instead of the current:

E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED .

🛠 Tools

Symfony

Laravel

🌀 Async PHP

Creating a RESTful API with ReactPHP: Improving HTTP responses, Managing Orders

apisearch-io/symfony-async-kernel – Async kernel for Symfony based on ReactPHP promises. See the demo application: apisearch-io/symfony-react-demo.

clue/reactphp-stdio – Аn async tool for creating really interactive CLI-tools with ReactPHP. See the intro post.

💡 Misc

🔈 Podcasts

💬 Community

Thanks for reading!

If you have any interesting or useful links to share via PHP Annotated, leave a comment or drop me a message on Twitter.

Subscribe to PHP Annotated

Your JetBrains PhpStorm Team

The Drive to Develop