Seleksi segar dengan tautan ke berita dan bahan. Dalam rilis: jadwal rilis PHP 8, analisis ergonomi objek dalam PHP dan 5 RFC segar dari PHP Internals, beberapa alat yang berguna, video, podcast, dan banyak lagi.
Selamat membaca!
PHP internal
- Jadwal Rilis PHP 8 yang Diterbitkan - Alfa pertama diharapkan pada tanggal 18 Juni, dan rilis terakhir pada tanggal 3 Desember. Lebih detail .
- [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

/
Terimakasih atas perhatiannya!
Jika Anda melihat kesalahan atau ketidaktepatan - mohon informasikan kepada saya di PM .
Pertanyaan dan saran menulis ke email atau twitter .
Lebih banyak berita dan komentar di Saluran Telegram PHP Digest .
Kirim tautan
Cari tautan untuk semua intisari
โ Rilis sebelumnya: PHP Digest No. 176