PHP Annotated – August 2019

php_annotated

Greetings everyone,

In our August edition of PHP Annotated, read about the future of PHP. Is it P++ or PHP2020? Get the latest on PHP 7.4.0 beta 2, Slim 4, and other releases. We cover Laracon US, as well as share other links for Laravel and Symfony, useful tools, videos, and a whole lot more!

⚡️ News & Releases

🐘 PHP Internals

  • P++ – The controversy and accusations in PHP Internals over the removal of short tags <?, explicit call-site send-by-ref syntax, and other discussions eventually resulted in an unexpected proposal from Zeev Suraski – create a new PHP dialect. The working name P++ is not accidental here, as Zeev suggests creating a “sister” language, like C++ for C. PHP and P++ are supposed to be developed side by side within a single runtime.

    In the new P++ it will be possible to implement a lot of revolutionary improvements, to deprecate legacy, and clear things up without thinking about backward compatibility. Since the language would have new branding, it would not have this bad reputation. A “classic” PHP would get all the performance and other non-syntax features but maintain backward compatibility.

    The proposal received a lot of counterarguments, which Zeev tried to address on a page P++ idea: FAQ. The questions are quite serious though: limited team (just ~2 people working on PHP fulltime), possible community fragmentation, Hack’s experience, how PHP and P+++ code would really coexist and interact, and a lot more.

  • [RFC] Namespace-scoped declares, again – In the scope of this RFC, Nikita Popov formulates a more evolutionary approach to language development. In a nutshell, using optional directives like strict_types, for example.

    There are two possible ways of implementation: fine-grained – where individual changes are controlled by separate declare directives, and coarse-grained – when a bunch of features are combined into one directive as part of an “edition” such as “PHP 2020” for example. Similar to Editions in Rust.

  • Call for participation: Annotating internal function argument and return types – Ever wanted to become a PHP core contributor? You couldn’t think of a better time to start!
    Lack of type information for internal functions in Reflection is a long-standing issue. In PHP 8, all the necessary technical groundwork to support argument and return type annotations on internal functions at scale is already done. The only thing left is to add those type annotations to functions. This is something everyone can help with as it does not need expertise in C. Nikita has opened a sample PR to show the process: https://github.com/php/php-src/pull/4499.

🛠 Tools

  • krakjoe/tombs – A tool for locating dead code. You plug this in on production without the fear of performance overhead or any code modifications, wait for a day/week/month, and then look at the statistics to see which functions/methods have never been executed. Read more in Joe Watkins’ blog post.
  • krakjoe/stat – One more cool tool from Joe. This is an extension for profiling PHP applications in production which gives profiling info in a parallel thread. For more details, see this blog post.
  • nunomaduro/pest – A nice syntax sugar for PHPUnit that allows writing tests in facebook/jest style.
  • mpratt/Embera – An Oembed consumer library which gives you information about URLs. It helps you replace URLs to YouTube or Vimeo, for example, with their HTML embed code.
  • NxtLvLSoftware/php-static-constructors – Static constructors à la C#. They are executed automatically and not more than once.
  • exussum12/coverageChecker – The instrument helps you introduce good practices into your project gradually. For example, you can require 90% code coverage with tests, and not for the whole codebase at once, but just for the changed piece.
  • DaveLiddament/sarb – A similar tool that implements a Baseline feature for the quality analysis tools, which allows you to use them in legacy applications.

Symfony

Laravel

🌀 Async PHP

Serverless

💡 Misc

🔈 Podcasts

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

image description