Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
••••••••
Sicherheitslücken (CVE)CVE-2025-65823 | Meatmeet App on Android hard-coded credentials(29.09.2026 um 03:42 Uhr)
••••••••••
Sicherheitslücken (CVE)CVE-2025-65823 | Meatmeet App on Android hard-coded credentials(29.09.2026 um 03:42 Uhr)
••
Intelligence View
⚡ tsecurity.de Intelligence

PHP 8.4: Property Hooks

PHP 8.4 is expected for this fall. Let's review the RFC "Property Hooks." What are PHP RFCs? RFC means "Request For Comments." It's a pretty old concept (probably older than Internet itself) many core teams and their community…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

PHP 8.4 is expected for this fall. Let's review the RFC "Property Hooks."






What are PHP RFCs?



RFC means "Request For Comments." It's a pretty old concept (probably older than Internet itself) many core teams and their community use to discuss and implement new features, deprecate obsolete code or enhance existing structures.



The process for PHP is pretty well-documented, so do not hesitate to read this page if you want more details.



Here we'll focus on a specific RFC that looks promising: Property Hooks.






Other notable RFCs



While we'll focus on Property Hooks, there are other RFCs you might want to read:








Where to find all accepted RFCs?



You can check this page.






Property hooks in short



This RFC aims to remove the hassle of using boilerplate (e.g., getters/setters) for common interaction with object's properties.



PHP 8.0 already allows promoting properties in the constructor, so it's far less verbose than it used to be:




class User 
{
public function __construct(public string $name) {}
}





However, the RFC underlines the fact there's no built-in way to add custom behaviors or validation to these properties, which ultimately brings developers back to clumsy and verbose solutions (boilerplate or magic getters/setters).



With property hooks, this could be built-in the language:



interface Named
{
public string $fullName { get; } // make the hook required
}

class User implements Named
{
public function __construct(private string $firstName, private string $lastName) {}

public string $fullName {
get => strtoupper($this->firstName) . " " . strtoupper($this->lastName);
}
}







What's the problem with getters and setters?



You may read this [old] introduction:








👉🏻 When used blindly, setters and getters can break encapsulation, as the idea is to prevent anybody from modifying the object from the outside, and you probably want to keep the implementation private.






Wrap up



PHP contributors seem more and more inspired by other languages (e.g. Kotlin).



The RFC only includes two hooks: set and get, but there could be more hooks in the future.

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten PHP 8.4: Property Hooks

Thematisch verwandte Begriffe: Property, Hooks · 6 Treffer

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

💬 Kommentare werden geladen…
Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-102265 | PyJWT is a Python implementation of JSON Web Token standards. From 2.13…
Advisory →
tsecurity.de Icon
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag