PHP Digest No. 178 (6 a 21 de abril de 2020)


Nova seleção com links para notícias e materiais. Na versão: Composer 2.0 Alpha e outras versões, 5 novas e uma oferta RFC aceita da PHP Internals, além de atributos atualizados na votação, uma porção de ferramentas úteis, podcasts, entrevistas e muito mais.

Gostar de ler!


Notícias e Lançamentos



PHP Internals


  • [RFC] throw expression — PHP 8 throw , . , , :

    $callable = fn() => throw new Exception();
    
    $foo = $bar['key'] ?? throw new KeyNotSetOnBarException();
    
  • [RFC] Attributes v2 — () . , , , , . .

    , . : <<>> @:.

    <<ExampleAttribute>>
    class Foo
    {
        <<ExampleAttribute>>
        public const FOO = 'foo';
    
        <<ExampleAttribute>>
        public $x;
    
        <<ExampleAttribute>>
        public function foo(<<ExampleAttribute>> $bar) { }
    }
    
    $object = new <<ExampleAttribute>> class () { };
    
    <<ExampleAttribute>>
    function f1() { }
    
    $f2 = <<ExampleAttribute>> function () { };
    
    $f3 = <<ExampleAttribute>> fn () => 1;
    
  • [RFC] PHP Namespace in core, [RFC] PHP Namespace Policy — RFC-, \PHP , .
  • [RFC] Mixed Type v2 — , , - . mixed .

    PHP 8. mixed array|bool|callable|int|float|null|object|resource|string.
  • [RFC] non-capturing catchescatch:

    try {
        changeImportantData();
    } catch (PermissionException) { // The intention is clear: exception details are irrelevant
        echo "You don't have permission to do this";
    }
    
  • [RFC] Match expressionswitch match, switch, . -.

    match ($condition) {
        1 => {
            foo();
            bar();
        },
        2 => baz(),
    }
    
    $expressionResult = match ($condition) {
        1, 2 => foo(),
        3, 4 => bar(),
        default => baz(),
    };
    
  • [RFC] Pipe Operator v2|> c . Elixir / JS (Hack) $$.

    $result = "Hello World"
        |> 'htmlentities'
        |> 'explode'
        |> fn($x) => array_map(fn($v) => 'strtoupper', $x)
        |> fn($x) => array_filter(fn($v) => $v != 'O');
    
  • : [RFC] Compact Object Property Assignment



Symfony



Laravel



Laminas



Async PHP





/



!

— , , .
.

Telegram- PHP Digest.



: PHP- № 177


All Articles