PHP Digest # 186 (August 3 - 17, 2020)



Fresh selection with links to news and materials. In: PHP 8 Beta 1, again on attribute syntax in PHP 8: #[Attr]vs @[Attr], syntax suggestion for BigInt, PHP 8 reviews and many more videos, tools, streams, podcasts.



Enjoy reading!





News and releases





PHP Internals



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



    Tycon Andre , #[Attr] PHP 7. C , , ?



    @@Attr, #[Attr], <<Attr>> @[Attr]:
    @@ORM\Entity
    @@ORM\Table("user")
    class User
    {
        @@ORM\Id @@ORM\Column("integer") @@ORM\GeneratedValue
        private $id;
    
        @@ORM\Column("string", ORM\Column::UNIQUE)
        @@Assert\Email(["message" => "The email '{{ value }}' is not a valid email."])
        private $email;
    }
    
    #[
      ORM\Entity,
      ORM\Table("user")
    ]
    class User
    {
        #[ORM\Id, ORM\Column("integer"), ORM\GeneratedValue]
        private $id;
    
        #[ORM\Column("string", ORM\Column::UNIQUE)]
        #[Assert\Email(["message" => "The email '{{ value }}' is not a valid email."])]
        private $email;
    }
    
    @[
      ORM\Entity,
      ORM\Table("user")
    ]
    class User
    {
        @[ORM\Id, ORM\Column("integer"), ORM\GeneratedValue]
        private $id;
    
        @[ORM\Column("string", ORM\Column::UNIQUE)]
        @[Assert\Email(["message" => "The email '{{ value }}' is not a valid email."])]
        private $email;
    }
    
    <<
      ORM\Entity,
      ORM\Table("user")
    >>
    class User
    {
        <<ORM\Id, ORM\Column("integer"), ORM\GeneratedValue>>
        private $id;
    
        <<ORM\Column("string", ORM\Column::UNIQUE)>>
        <<Assert\Email(["message" => "The email '{{ value }}' is not a valid email."])>>
        private $email;
    }
    
    @:ORM\Entity
    @:ORM\Table("user")
    class User
    {
        @:ORM\Id @:ORM\Column("integer") @:ORM\GeneratedValue
        private $id;
    
        @:ORM\Column("string", ORM\Column::UNIQUE)
        @:Assert\Email(["message" => "The email '{{ value }}' is not a valid email."])
        private $email;
    }
    
  • [RFC] Named Parameters explicit opt in β€” , .
    //    
    function callBar(Foo $:parameterName) {
        $internalName->bar();
    }
    
    $x = new Foo();
    callBar(parameterName: $x);
    
    //   
    function callBar($externalName) {
        $externalName->bar();
    }
    
    $x = new Foo();
    callBar(externalName: $x); // Error: cannot call function callBar() using parameter $externalName by name.
    
    PHP 8 , 8.1, .
  • [Proposal] Bigint shorthand (123n) for GMP objects β€” RFC.



    PHP JavaScript Β«nΒ»:
    $theBiggestInt = 9007199254740991n


    GMP. GMP , , .
  • PHP (php -a), PR, . bobthecow/psysh.
  • cross [RFC] PHP Namespace Policy β€” .






Symfony





Laravel









/







  • www.elephpant.com - Original blue and pink elephants can be ordered by email to designer Vincent Pontier .



    The grays and blacks are also available at the Symfony shop.symfony.com - now shipping worldwide.






Thank you for attention!



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

Questions and suggestions write to mail or twitter .



More news and comments on the PHP Digest Telegram channel .



Send link

Search links in all digests

← Previous issue: PHP-Digest β„– 185




All Articles