PHP Digest # 201 (15-29 de marzo de 2021)



Nueva selección con enlaces a noticias y materiales. En el lanzamiento: todo sobre fibras y PHP asíncrono, así como nuevas lambdas, intersecciones de tipos y otras propuestas para PHP 8.1. Próximos eventos, una parte de herramientas útiles, artículos, podcasts, videos y PHP Digest Stream.



¡Disfruta leyendo!









Noticias



  • Próximos Eventos:

    • 8 (), , PHP- — Skyeng, Yii Core Team Userstory.
    • 24 (), + , PHP- (/PHP Point). .
    • 15 (), + , PHP- — , , kPHP, devops Go. .
    • 28 (), , , PHP Russia, 2021.


    phpcommunity.ru.



Async PHP



  • [RFC] Fibers — PHP 8.1



    Swoole - .



    — , ( ). , . PHP.



    $fiber = new Fiber(function (): void {
        $value = Fiber::suspend('suspend');
        echo "Value used to resume fiber: ", $value, "\n";
    });
    
    $value = $fiber->start();
    
    echo "Value from fiber suspending: ", $value, "\n";
    
    $fiber->resume('resume');
    
    >   :
    Value from fiber suspending: suspend
    Value used to resume fiber: resume
    
          
          





    , PHP 8.1 ?

    . ReactPHP, Amp . , , .



    :

    Fibers — PHP 8.1 — RFC PHP.Watch.

    PHP: PHP? — ReactPHP .

     

    PHP 8.1 ext-fiber. , PHP 7.2.



  • PHP — : , , /. , PHP «- ».
  • Asynchronous PHP — Multiprocessing, Multithreading & Coroutines — PHP core team Laravel.


PHP Internals



  • [RFC] Auto-capturing multi-statement closures

    Larry Garfield Nuno Moduro .



    .



    :

    $y = 1;
    
    $fn1 = fn($x) => $x + $y;
    
          
          





    :

    $fn2 = function ($x) use ($y): int {
       // ...
       return $x + $y;
    };
    
          
          





    :

    $c = 1;
    $foo = fn($a, $b):int {
      // ...
      $val = $a * $b;
      return $val * $c;
    };
    
          
          





  • [RFC] Short Functions

    RFC .



    // 
    function add(int $a, int $b): int
    {
        return $a + $b;
    }
    
    // 
    function add(int $a, int $b): int => $a + $b;
    
          
          





    :
    class Person
    {
        public function __construct(
            private string $firstName,
            private string $lastName,
        ) {}
    
        public function getFirstName(): string => $this->firstName;
    
        public function getLastName(): string => $this->lastName;
    
        public function getFullName(): string => $this->firstName . ' ' . $this->lastName;
    }
    
          
          





    , PHP
    =>



    (, , , match).

    { ... }



    , return



    .

    function



    .

    fn



    , .

    • , .


  • [RFC] Deprecations for PHP 8.1

    . PHP 8.1 dreprecation notice, PHP 9 .



    : mysqli::init()



    , key(), current(), next(), prev(), and reset() , .
  • [RFC] Pure intersection types

    PHP 8.0 , RFC .



    TypeA&TypeB



    , instanceof TypeA



    instanceof TypeB



    .



    class A {
        private Traversable&Countable $countableIterator;
    
        public function setIterator(Traversable&Countable $countableIterator): void {
            $this->countableIterator = $countableIterator;
        }
    
        public function getIterator(): Traversable&Countable {
            return $this->countableIterator;
        }
    }
    
          
          





    pure intersection types, union .
  • [Draft] Add FPM early bootstrapping mode

    Benjamin Eberlei ( PHP 8) fpm.bootstrap_file



    . , FPM . , FPM-, .



    , , , , , , .





    - auto_prepend_file.

  • PHP JIT/arm64 port — ARM PHP JIT ARM-.
  • [RFC] mysqli bind in execute — .






Symfony





Laravel





Yii









/







  • phpday:








Peter Myazin, el autor del podcast PHP Pyatiminutka , alojará conmigo hoy una transmisión basada en PHP Digest .



Analizaremos las noticias y los enlaces del problema con detalles y detalles, y hablaremos con el invitado sobre el complemento para PhpStorm i18n Ally.



A partir de las 19:00 Moscú, Minsk, Kiev.












Si observa un error o inexactitud, háganoslo saber en un habr personal o telegrama .





Más noticias y comentarios en el canal PHP Digest Telegram .



Enviar enlace

Buscar enlaces en todos los resúmenes

Número anterior: PHP-Digest № 200




All Articles