PHP Digest # 185 (July 20 - August 3, 2020)



Fresh selection with links to news and materials. In the release: PHP 8 Alpha 3, PhpStorm 2020.2, a new operator ?->, another discussion of attribute syntax and other PHP Internals news, an overview of the type system in PHP, a portion of useful tools, videos, streams and much more.



Enjoy reading!





News and releases



  • PHP 8.0.0 Alpha 3 - The latest planned alpha release. The first beta is expected on August 6th.
  • PhpStorm 2020.2 β€” PHP 8, , - GitHub, OpenAPI. .


PHP Internals



  • [RFC] Shorter Attribute Syntax Change β€” PHP 8 . .



    : << >>, @@, .

    @@ , RFC . , #[ ] Rust, .



    , PHP 8.1, - 8.0 4 . PHP 8.0, << >>, #[], @@, PHP 8.1 .



    : @[Attribute], PHPDoc /** @@MyAttribute */, β€” @ @@, @ .







    , @@, - , T_PAAMAYIM_NEKUDOTAYIM , - β€” PHP 8 Alpha 3 .
  • check [RFC] Treat namespaced names as single token β€” PHP 8 . , , namespace app\function { class Foo {} } .



    , , :
    use /** Try comments */ \FullyQualified \ /* in this ugly way */ SometTotallyDifferentTrait /** also after */;
  • check [RFC] Saner string to number comparisons β€” .



    PHP 8, == , .



    0 == 'foobar' false.





    <=>, ==, !=, >, >=, < <=, switch, in_array(), sort() .
  • check [RFC] Nullsafe operator β€” PHP 8 nullsafe: ?->.

    C null.



    , :
    
    private function getUserCountry(): ?string
    {
        $session = $this->sessionStorage->getSession();
    
        if (null === $session) {
            return null;
        }
    
        $user = $session->getUser();
    
        if (null === $user) {
            return null;
        }
    
        if (null === $user->address) {
            return null;
        }
    
        return $user->address->country;
    }
    
    :
    $country = $this->sessionStorage->getSession()?->getUser()?->address?->country;


    (@).
  • check [RFC] Allow trailing comma in closure use lists β€” use PHP 8 , .
    
    $f = function (
        $longArgument,
        $longerArgument,
        $muchLongerArgument,
    ) use (
        $longVar1,
        $longerVar2,
        $muchLongerVar3, //      
    ) {
       ...
    };
    
  • check [RFC] Named Arguments β€” PHP 8 !

    , .

    htmlspecialchars($string, ENT_COMPAT | ENT_HTML401 , ini_get("default_charset"), false);
    :

    htmlspecialchars($string, double_encode: false);


    stitcher.io/blog/php-8-named-arguments.
  • [RFC] Renamed Parameters β€” . RFC.



    :
    
    function callBar(Foo $internalName:externalName) {
        $internalName->bar();
    }
    
    $x = new Foo();
    callBar(externalName: $x);
    


    - Swift. , @@NameAlias.
  • cross [RFC] Make constructors and destructors return void β€” .




  • ramsey/conventional-commits β€” Conventional Commits. , .
  • jubianchi/ppc β€” . phplrt/phplrt.
  • thephpleague/mime-type-detection β€” - mime- .
  • zakirullin/typed-accessor β€” .
  • nette/php-generator β€” PHP- fluent-.


Symfony



  • Symfony #709 (27 β€” 2 2020)
  • Using Symfony's service iterators for secondary flows
  • Symfony 4.3 5.0 :


Laravel



  • Laravel 6 7 β€” Laravel 6 7. Laravel 5.5 'cookie'.
  • butschster/LaravelCycleORM β€” cycle/orm Laravel.
  • - Laravel.
  • habr «».
  • habr Laravel- (27 – 2 2020)
  • video Nuno Maduro Freek Murze PHPUnit Pest.
  • video Laracon EU Online 2020




  • PHP β€” PHP .
  • PHP 8: .
  • β€” , , .
  • PHP: Preloading β€” Manual β€” - , PHP 7.4.
  • PhpStorm, But Better! #2 β€” .
  • LearnXdebug.com β€” Xdebug.
  • ( , , ) .
  • ru MySQL Postgres.
  • ru .
  • habr PHP Internals News #38: WeakMaps.
  • habr PHP.
  • habr PHP-.
  • habr , - ?


/



  • audio PHP Internals News #63 β€” AndrΓ© RΓΈmcke .
  • audio PHP Internals News #64 β€” Benjamin Eberlei .
  • video Xdebug β€” Laravel Valet PhpStorm, , , .
  • videoru β€” 3 17.00, .
  • videoru MoreView #12 | β€” elisdn.ru deworker.pro. PHP, , .
  • videoru MoreView #13 | β€” «» Happy Job.
  • videoru PHP β€” .
  • audioru Five Minute PHP # 81 with rectorphp / rector review - Now short episodes of Five Minute are also on Instagram and TikTok .


Thank you for attention!



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

Questions and suggestions write to mail , twitter or telegram pronskiy...



More news and comments on the PHP Digest Telegram channel .



Send link

Search links in all digests

← Previous issue: PHP-Digest β„– 184




All Articles