[PHP-DEV] Convert return to expression like throw

2022-03-18 Thread Florian Stascheck
Hello, We remember the old days, when we had to do: function getUnreadDocuments(): int { $user = Auth::user(); if (is_null($user)) return 0; $documents = $user->getDocuments(); if (is_null($documents)) return 0; // actual logic of the function return 42; } And it was already really nice to do:

[PHP-DEV] Suggestion: Inconsistency: Allow array spread operator to work on string keys

2020-12-02 Thread Florian Stascheck
Hello! With PHP8 released and the named arguments RFC being implemented, there's now an inconsistency in how the spread operator works. Historically, the spread operator was first used in PHP 5.6 for arguments: function php56($a, $b) { return $a + $b; } $test = [1, 2]; php56(...$test) === 3;