PHP Digest # 201 (15 - 29 de março de 2021)



Nova seleção com links para notícias e materiais. No lançamento: tudo sobre fibras e PHP assíncrono, além de novos lambdas, interseções de tipo e outras propostas para PHP 8.1. Próximos eventos, uma porção de ferramentas úteis, artigos, podcasts, vídeos e PHP Digest Stream.



Gostar de ler!









notícias





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:








Um stream baseado em PHP Digest será hospedado por Petr Myazin, o autor do podcast Five-Minute PHP , que está comigo hoje .



Analisaremos as notícias e links do assunto com detalhes e detalhes, e conversaremos com o convidado sobre o plugin para PhpStorm i18n Ally.



Começando às 19:00 Moscou, Minsk, Kiev.












Se você notar um erro ou imprecisão, informe-nos por meio de um habr ou telegrama pessoal .





Mais notícias e comentários no canal PHP Digest Telegram .



Enviar link

Links de busca em todos os resumos

← Número anterior: PHP-Digest № 200




All Articles