ITKarma picturePhoto James Titcumb

Fresh selection with links to news and materials. The release is all about PHP 8: the first alpha, the new CDMY0CDMY expression, a bug in the CDMY1CDMY syntax for attributes, real JIT benchmarks, 4 new sentences. And, as always, tools, articles, videos, and podcasts.

Enjoy reading!

ITKarma pictureNews and Releases



ITKarma picturePHP Internals


  • check[RFC] Shorter Attribute Syntax - Voted on new syntax CDMY3CDMY won for attributes.

    Later it turned out that this syntax could be interpreted ambiguously, and a hack was used in the implementation to circumvent the problem and this was not mentioned in the sentence.

    The ambiguity is this: CDMY4CDMY can be interpreted as CDMY5CDMY (attribute CDMY6CDMY and without type) or CDMY7CDMY (attribute CDMY8CDMY and CDMY9CDMY parameter type). Because PHP allows spaces around the namespace separator.

    Fortunately for CDMY10CDMY syntax fans, Nikita found a way to solve the problem if the proposal [RFC] Treat namespaced names as single token .
  • check[RFC] Match expression v2 - Will be available in PHP 8 a new expression CDMY11CDMY, which works as CDMY12CDMY, but has a type check and the ability to return a value.

    //Вот так работает switch: switch ('foo') { case 0: $result="Oh no!\n"; break; case 'foo': $result="This is what I expected\n"; break; } echo $result;//> Oh no!//То же самое на match: echo match ('foo') { 0 => "Oh no!\n", 'foo' => "This is what I expected\n", };//> This is what I expected 
  • [RFC] Allow trailing comma in closure use lists - It is proposed to allow the optional the comma at the end of the list CDMY13CDMY for closures, by analogy with what has already been done for the arguments and parameters of functions.

    Hidden text
    $longArgs_longVars=function ( $longArgument, $longerArgument, $muchLongerArgument,//Здесь запятая в PHP 8.0 уже разрешена ) use ( $longVar1, $longerVar2, $muchLongerVar3//А вот здесь предлагается добавить ) {//body }; 
  • [RFC] Property write/set visibility - This document is proposed to do it is possible to specify two access modifiers for properties: separately for reading and writing. And there are two syntax options:
    //Syntax Option A class User { public:private int $id; public:protected string $name; }//Syntax Option B class User { public private(set) int $id; public protected(set) string $name; } 

    Judging by the thread , something similar will happen, but already in PHP 8.1, because it takes more time to discuss nuances and intersections with other RFCs, for example, full accessors , readonly properties , immutable classes .
  • [RFC] Language Constructs Syntax Changes - Since CDMY14CDMY and CDMY15CDMY are not functions, but language constructs, like CDMY16CDMY, it is proposed to allow them to be called without parentheses.

    declare(strict_types=1);//=> declare strict_types=1; 
  • [RFC] Saner numeric strings - In this RFC It is proposed to make two changes regarding the processing of strings with numbers.

    First, get rid of the concept of a “line starting with numbers.” For example, in this case CDMY17CDMY the result will be not 4, but 2 and CDMY18CDMY will be thrown instead of CDMY19CDMY.

    And secondly, allow whitespace at the end of numeric lines, that is, so that CDMY20CDMY is CDMY21CDMY and all other operations work, as well as for lines with leading spaces.

ITKarma pictureTools


  • Guzzle 7 - Fresh release of the most famous HTTP client for PHP. Now the client implements the standard PSR-18 , the minimum version of PHP 7.2, and added time tints.
  • deligoez/xDebug-Toggler - A macOS app for quickly turning Xdebug on/off.
  • denisyukphp/tmpfile-manager - Temporary file manager. Able to close resources, automatically or manually clean temporary files, run your garbage collector. Submitted by @jebox .
  • php-aidc/label-printer - Library for working with label printers with support for Fingerprint languages, Direct Protocol, TSPL/TSPL2. Submitted by jhaoda .

ITKarma pictureSymfony



ITKarma pictureLaravel



ITKarma pictureAsync PHP



ITKarma pictureTraining Materials



ITKarma pictureAudio/Video



Спасибо за внимание!

Если вы заметили ошибку или неточность — сообщите, пожалуйста, в личку .
Вопросы и предложения пишите на почту или в твиттер .

Больше новостей и комментариев в Telegram-канале PHP Digest .

Прислать ссылку
Поиск ссылок по всем дайджестам
Предыдущий выпуск: PHP-Дайджест № 182

.


Source