PHP Digest # 199 (8 a 22 de fevereiro de 2021)



O PHP 8.1 terĂĄ um enum e mais dois aceitos, dois rejeitados e trĂȘs novos RFCs para o PHP 8.1. O WordPress Ă© usado por 40% dos sites. Por que vocĂȘ precisa remover strict_types, por que vocĂȘ nĂŁo deve usar empty (), bem como ferramentas, vĂ­deos, artigos, podcasts e PHP Digest Live Ă s 10:00 GMT.



Gostar de ler!









Notícias e lançamentos





PHP Internals



  • Verifica [RFC] Enumerations

    44 7 . PHP 8.1 enum.



    enum RfcStatus {
        case Draft;
        case UnderDiscussion;
        case Accepted;
    }
    
    function setRfcStatus(RfcStatus $status) :void {
        // ...
    }
    
    setRFCStatus(RfcStatus::Accepted); // 
    setRFCStatus('Draft');                     // Deprecation notice  8.1, TypeError  9.0
    
          
          





    RFC php.watch.



    Symfony .
  • Verifica [RFC] Deprecate passing null to non-nullable arguments of internal functions

    PHP null



    , nullable



    .



    PHP 8.1 TypeError



    . , str_contains("", null)



    . 3v4l.org/OVoa0A.



    : , PHP.
  • Verifica [RFC] Array unpacking with string keys

    PHP 8.1 , :



    $array1 = ['a' => 'apple', 'p' => 'pear'];
    $array2 = ['b' => 'banana', 'o' => 'orange'];
    $array = [...$array1, ...$array2];
    //     :
    $array = array_merge($array1, $array2);
    
          
          



  • [RFC] Fibers

    , .



    Fiber API Ruby.



    ReactPHP trowski/react-fiber:



    
    $loop = new FiberLoop(Factory::create());
    
    $browser = new Browser($loop);
    
    $request = function (string $method, string $url) use ($browser, $loop): void {
        /** @var Response $response */
        $response = $loop->await($browser->requestStreaming($method, $url));
    
        /** @var ReadableStreamInterface $stream */
        $stream = $response->getBody();
    
        $body = $loop->await(Stream\buffer($stream));
    
        var_dump(\sprintf(
            '%s %s; Status: %d; Body length: %d',
            $method,
            $url,
            $response->getStatusCode(),
            \strlen($body)
        ));
    };
    
    $requests = [];
    
    $requests[] = $loop->async($request, 'GET', 'https://reactphp.org');
    $requests[] = $loop->async($request, 'GET', 'https://google.com');
    $requests[] = $loop->async($request, 'GET', 'https://www.php.net');
    
    $loop->await(Promise\all($requests));
    
          
          



  • [RFC] CachedIterable (rewindable, allows any key&repeating keys)

    Tyson Andre . .
  • Proposal: namespace the SPL

    Spl



    : Spl\FixedArray



    -> SplFixedArray



    . , CachedIterable



    ReverseIterator



    .



    azjezz/psl.

  • [RFC] mysqli bind in execute

    Kamil Tekiela mysqli



    . RFC mysqli_stmt::execute()



    . , , mysqli_stmt::bind_param()



    . , bind_param .
  • cruzar [RFC] PHP\iterable\any() and all() on iterables — any()



    all()



    .
  • cruzar [RFC] var_representation(): readable alternative to var_export() — var_export



    , brick/varexporter.
  • [Draft] Unify PHP's typing modes — PHP . — , , – strict_types=1



    – . , , .



    George Peter Banyard, RFC.



    .
  • Observer API PHP 8 — API . Xdebug, APM- New Relic, Tideways, ..






Symfony





Laravel





Yii





Async PHP



  • swow/swow — PHP, libuv, , PDO, file_get_ontents() .. ( ). , Swoole.


phpstorm PhpStorm









/





Divertido



  • mario-deluna / php-render Ă© um renderizador PHP 3D puro, mesmo sem usar FFI. Shaders, analisador de arquivos .obj e muito mais.



    CĂłdigo de exemplo:
















JĂĄ Ă© um fluxo tradicional baseado em PHP Digest. HaverĂĄ uma anĂĄlise de notĂ­cias e links do problema com detalhes e detalhes adicionais.

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






Se vocĂȘ notar um erro ou imprecisĂŁo, por favor, informe-nos em um Habr pessoal ou telegrama .





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 № 198




All Articles