PHP Digest # 205 (del 1 al 15 de junio de 2021)





Una selección de noticias y materiales nuevos del mundo PHP. En versión: la primera versión alfa de PHP 8.1.0, Composer 2.1, Symfony 5.3 y otras versiones. Una descripción general de las nuevas propuestas para PHP 8.1: Aplicación de función parcial, operador de tubería, propiedades de solo lectura. Además de una parte de herramientas útiles, artículos, videos y podcasts.



¡Disfruta leyendo!



noticias



  • PHP 8.1.0 alfa 1



    - PHP 8.1. . 25 .



    20 , . :



    • Enum RFC;
    • never



      RFC;
    • RFC;
    • RFC;
    • RFC;
    • float



      int



      , RFC;
    • Serializable



      RFC;
    • 0o



      RFC;
    • $GLOBALS RFC;


    php.watch/versions/8.1.



  • PHP 8.0.7, PHP 7.4.20



    .



  • PhpStorm 2021.2



    , . , .

    : PHP 8.1, Extract Method, .



  • Composer 2.1.0



    reinstall



    , . .



  • packagist.org PHP-



    Composer, Jordi Boggiano, PHP.



    , packagist.org/php-statistics.



    , , , symfony/console/php-stats.



  • PHP Russia 2021



    28 . habr , , .



    : php_digest.





PHP Internals



  • [RFC] Partial Function Application



    RFC First-class callable syntax.



    — . ...



    , ?



    — .



    :

    1. $func = some_func(...)



      — . , .
    2. $func = some_func(1, 2, ?, 5)



      — , .
    3. $func = any_func($all, $params, ...)



      — , . , .


  • [RFC] Pipe Operator v2



    , - .



    :



    array_filter(array_map('strtoupper', str_split(htmlentities("Hello World"))), fn($v) => $v != 'O');
    
          
          





    :



    $result = "Hello World"
        |> htmlentities(?)
        |> str_split(?)
        |> array_map(strtoupper(?), ?)
        |> array_filter(?, fn($v) => $v != 'O');
    
          
          





  • [RFC] Pure intersection types



    , . audio PHP Internals News #88 George Peter Banyard, RFC.



  • [RFC] Readonly properties 2.0



    RFC readonly .



    readonly



    . .



    class Test {
        public readonly string $prop;
    
        public function __construct(string $prop) {
            // Legal initialization.
            $this->prop = $prop;
        }
    }
    
    $test = new Test("foobar");
    // Legal read.
    var_dump($test->prop); // string(6) "foobar"
    
    // Illegal reassignment. It does not matter that the assigned value is the same.
    $test->prop = "foobar";
    // Error: Cannot modify readonly property Test::$prop
    
          
          







    constructor property promotion PHP 8.0, :



    class User {
        public function __construct(
            public readonly string $name
        ) {}
    }
    
    $user = new User('Roman');
    echo $user->name; // Ok
    $user->name = 'Nikita'; // Error
    
          
          





  • [RFC] Make reflection setAccessible() no-op



    , ->setAccessible(true)



    .



    Marco «Ocramius» Pivetta , ReflectionProperty



    ReflectionMethod



    , setAccessible(true)



    .



    class Foo { private $bar = 'a'; }
    
    (new ReflectionProperty(Foo::class, 'bar'))->getValue();
    
          
          















Symfony







Laravel







Yii













/








Suscríbase al canal PHP Digest Telegram .



Si te gustó el resumen, dale un plus; esto es muy motivador para seguir haciéndolo.



¿Detectó un error o un error tipográfico? Informar en un habr personal o telegrama .



Puede enviar un enlace a través del formulario o simplemente escribiéndome en un telegrama .

Buscar enlaces en todos los resúmenes

Número anterior: PHP-Digest # 204








All Articles