PHP Digest # 187 (18 de agosto - 7 de setembro de 2020)



Nova seleção com links para notícias e materiais. No lançamento: PHP 8 beta 3, nova sintaxe de atributo adotada no PHP 8, Zephir tudo, um monte de ferramentas úteis, artigos, vídeos, podcasts.



Gostar de ler!





Notícias e lançamentos





PHP Internals



  • Verifica [RFC] Shorter Attribute Syntax Change — - . #[Attribute].
    #[
      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;
    }
    


    , @@Attr PR. #[ ] , .



    //   
    #[ORM\Entity]
    #[ORM\Table("user")]
    
    //  
    #[
        ORM\Entity,
        ORM\Table("user")
    ]


    .
  • Novo [RFC] any() and all() on iterables — :

    any(iterable $input, ?callable $callback = null): bool — , , true.

    all(...)true , true .



    :



    // 
    $satisifes_predicate = false;
    foreach ($item_list as $item) {
        if (API::satisfiesCondition($item)) {
            $satisfies_predicate = true;
            break;
        }
    }
    if (!$satisfies_predicate) {
        throw new APIException("No matches found");
    }
    
    // 
    if (!any($item_list, fn($item) => API::satisfiesCondition($item))) {
        throw new APIException("No matches found");
    }






Symfony





Laravel





Yii





Async PHP









/












Obrigado pela atenção!



Se você notar um erro ou imprecisão, informe-nos pessoalmente .

Perguntas e sugestões por escrito para e - mail ou twitter .



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 # 186




All Articles