Nouvelle sélection avec des liens vers des nouvelles et des documents. Dans la version: calendrier des versions de PHP 8, analyse de l'ergonomie des objets en PHP et 5 nouveaux RFC de PHP Internals, quelques outils utiles, vidéos, podcasts et bien plus encore.
Bonne lecture!
Internes PHP
- Publication du calendrier de publication de PHP 8 - La première version alpha est attendue le 18 juin et la version finale le 3 décembre. Plus de détails .
- [RFC] Constructor Property Promotion — PHP, , 3 RFC: Constructor Promotion, Named parameters, Compound Property Visibility (
{public get, private set}
).
, RFC :
class Point {
public float $x;
public float $y;
public float $z;
public function __construct(
float $x = 0.0,
float $y = 0.0,
float $z = 0.0
) {
$this->x = $x;
$this->y = $y;
$this->z = $z;
}
}
:
class Point {
public function __construct(
public float $x = 0.0,
public float $y = 0.0,
public float $z = 0.0
) {}
}
- [RFC] Allow trailing comma in parameter list — , . PHP 7.3.
class Uri {
private function __construct(
?string $scheme,
?string $user,
?string $pass,
?string $host,
?int $port,
string $path,
?string $query,
?string $fragment // <-- ARGH!
) {
...
}
}
- [RFC] Stricter type checks for arithmetic/bitwise operators — RFC TypeError, , .
var_dump([] % [42]);
- [RFC] Switch expression —
switch
, :
$expressionResult = switch ($condition) {
1 => foo(),
2 => bar(),
3, 4, 5 => baz(),
};
RFC case
: case 3, 4, 5: break;
case 3: case 4: case 5: break;
. - [RFC] Type casting in array destructuring expressions — :
[(int) $now, (int) $future] = ["2020", "2021"];
[$now, $future] = ["2020", "2021"];
$now = (int) $now;
$future = (int) $future;
, :
...[int $i] = ['a' => '123'];
function foo(...[int $i]) {
}
foo(['a' => '234']);
:
$var = (Foo) [
'a' => 123,
'b' => (Bar) [
'c' =>
],
];
- : Server-Side Request and Response Objects, Userspace operator overloading, Write-Once (readonly) Properties.

Symfony
Laravel
Yii

/
Merci pour l'attention!
Si vous constatez une erreur ou une inexactitude - veuillez m'en informer en PM .
Questions et suggestions écrivez à mail ou twitter .
Plus de nouvelles et de commentaires sur le canal PHP Digest Telegram .
Envoyer le lien
Rechercher des liens pour tous les résumés
← Version précédente: PHP Digest No. 176