PHP Digest # 200 (22 de fevereiro - 15 de março de 2021)

Foto: Grégoire Gaonach



Nova seleção com links para notícias e materiais. Na versão: Objetos em inicializadores, namespaces de extensão e outras sugestões de RFC para PHP 8.1. PSR-11 atualizado, PSR ClockInterface proposto. Uma porção de ferramentas úteis, vídeos, podcasts, artigos e PHP Digest Live às 20:00 GMT.



Gostar de ler!









Notícias e lançamentos



  • PHP 8.0.3 , PHP 7.4.16 .
  • PSR ClockInterface

    , , .



    :



    namespace Psr\Clock;
    
    interface ClockInterface
    {
        /**
         * Returns the current time as a DateTimeImmutable Object
         */
        public function now(): \DateTimeImmutable;
    }
    
          
          



  • PSR-11 Container Interface — , 1.1, , 2.0 — .
  • Git clone — . Git 2.30.2.
  • PhpStorm 2021.1 EAP — : PHP- , JSONPath vídeo . , EAP .
  • Composer 1.x — 2021 API packagist.org .


PHP Internals



  • [RFC] New in initializers

    PHP , , , . , , — . .



    , , .



    static $x = new Foo();
    
    const C = new Foo();
    
    #[AnAttribute(new Foo())]
    class Test {
        public const C = new Foo();
        public static $prop = new Foo();
        public $prop = new Foo();
    
        public function __construct(
            private Logger $logger = new NullLogger()
        ) {}
    }
    
    function test($param = new Foo()) {}
    
          
          





    new



    , .



    . , , , , , . PHP Live.

  • [RFC] Namespaces in bundled PHP extensions

    , PHP, . .



    RFC , PHP. . OpenSSLCertificate



    OpenSSL\Certificate



    .



    , , RFC . :

    str_contains()



    -> String\contains()





    in_array()



    -> Array\contains()



    .

    PHP 9.
  • [RFC] Static variables in inherited methods

    , , . , .



    RFC , .

    class A {
        public static function counter() {
            static $i = 0;
            return ++$i;
        }
    }
    class B extends A {}
    
    var_dump(A::counter()); // int(1)
    var_dump(A::counter()); // int(2)
    var_dump(B::counter()); // int(3)
    var_dump(B::counter()); // int(4)
    
          
          





  • [RFC] Fibers

    . , . : , , PHP . , :



    Swoole. , Swoole PHP, — , .



    Joe Watkins, , /. krakjoe/parallel .



    , , — , Swoole parallel.
  • [RFC] noreturn type

    Psalm PHPStan PHP — noreturn



    .



    , , exit()



    , die()



    , trigger_error()



    .



    function redirect(string $uri): noreturn {
        header('Location: ' . $uri);
        exit();
    }
    
    function redirectToLoginPage(): noreturn {
        redirect('/login');
    }
    
          
          





    Hack, Python, Psalm, PHPStan PhpStorm #[NoReturn]



    exitpoint .phpstormmeta.php.
  • [RFC] debug_backtrace_depth(int $limit=0): int — debug_backtrace_depth(int $limit=0), . , .



    : count(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, $limit=0))



    .
  • [RFC] println(string $data = ''): intprintln



    , stdout



    . str_contains()



    , , .






Symfony





Laravel





Yii













audio
















Após uma pequena pausa, voltamos com um stream e o apresentador Valentin Udaltsov!



Haverá uma análise de notícias e links da edição com detalhes e detalhes, a opinião de São Valentim sobre RFCs e artigos. Interessantes, mas não incluídos na edição, os resultados do sorteio e uma nova competição com elefantes.



Começando às 20:00 Moscou, Minsk / 19:00 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 # 199




All Articles