PHP Digest Nr. 178 (6. - 21. April 2020)


Neue Auswahl mit Links zu Nachrichten und Materialien. In Release: Composer 2.0 Alpha und andere Releases, 5 neue und ein akzeptiertes RFC-Angebot von PHP Internals sowie aktualisierte Attribute fĂŒr Abstimmungen, einen Teil nĂŒtzlicher Tools, Podcasts, Interviews und vieles mehr.

Viel Spaß beim Lesen!


Nachrichten und Veröffentlichungen



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 catches — catch:

    try {
        changeImportantData();
    } catch (PermissionException) { // The intention is clear: exception details are irrelevant
        echo "You don't have permission to do this";
    }
    
  • [RFC] Match expression — switch 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