PHP Digest # 201 (15. - 29. März 2021)



Neue Auswahl mit Links zu Nachrichten und Materialien. In der Version: Alles über Fasern und asynchrones PHP sowie neue Lambdas, Typschnittpunkte und andere Vorschläge für PHP 8.1. Bevorstehende Veranstaltungen, ein Teil nützlicher Tools, Artikel, Podcasts, Videos und PHP Digest Stream.



Viel Spaß beim Lesen!









Nachrichten



  • Kommende Veranstaltungen:

    • 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:








Ein auf PHP Digest basierender Stream wird heute von Petr Myazin, dem Autor des Fünf-Minuten-PHP- Podcasts, mit mir gehostet .



Wir werden die Nachrichten und Links aus dem Problem mit Details und Details analysieren und mit dem Gast über das Plugin für PhpStorm i18n Ally sprechen.



Ab 19:00 Uhr Moskau, Minsk, Kiew.












Wenn Sie einen Fehler oder eine Ungenauigkeit bemerken, teilen Sie uns dies bitte in einem persönlichen Habr oder Telegramm mit .





Weitere Neuigkeiten und Kommentare zum PHP Digest Telegram-Kanal .



Link senden

Links in allen Digests suchen

Vorherige Ausgabe: PHP-Digest № 200




All Articles