PHP Digest # 200 (February 22 - March 15, 2021)

Photo: GrΓ©goire Gaonach



Fresh selection with links to news and materials. In release: Objects in initializers, namespaces for extensions, and other RFC proposals for PHP 8.1. Updated PSR-11, proposed PSR ClockInterface. A portion of useful tools, videos, podcasts, articles, and PHP Digest Live at 20:00 GMT.



Enjoy reading!









News and releases



  • 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 video . , 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 = ''): int β€” println



    , stdout



    . str_contains()



    , , .






Symfony





Laravel





Yii













audio
















After a short break, we return with a stream and presenter Valentin Udaltsov!



There will be a parsing of news and links from the issue with details and details, Valentine's opinion on RFCs and articles. Interesting but not included in the issue, the results of the drawing and a new competition with elephants.



Beginning at 20:00 Moscow, Minsk / 19:00 Kiev.




If you notice an error or inaccuracy, please let us know in a personal habr or telegram .





More news and comments on the PHP Digest Telegram channel .



Send link

Search links in all digests

← Previous issue: PHP-Digest # 199




All Articles