[PRES] [presentations] master: Add missing slide
[email protected] (Derick Rethans) Tue, 12 Mar 2024 15:10:36 +0000
| Newsgroups | php.pres |
|---|---|
| Message-ID | <[email protected]> |
Author: Derick Rethans (derickr)
Date: 2024-03-12T14:56:45Z
Commit: https://github.com/php/presentations/commit/cc449535d1334f10f32616c216141374563f016c
Raw diff: https://github.com/php/presentations/commit/cc449535d1334f10f32616c216141374563f016c.diff
Add missing slide
Changed paths:
A slides/internals/php84-property-hooks.xml
Diff:
diff --git a/slides/internals/php84-property-hooks.xml b/slides/internals/php84-property-hooks.xml
new file mode 100644
index 00000000..0790ad43
--- /dev/null
+++ b/slides/internals/php84-property-hooks.xml
@@ -0,0 +1,24 @@
+<slide>
+<title>PHP 8.4: Property Hooks</title>
+
+<example inline="1"><![CDATA[<?php
+class User implements Named
+{
+ private bool $isModified = false;
+
+ public function __construct(private string $first, private string $last) {}
+
+ public string $fullName {
+ // Override the "read" action with arbitrary logic.
+ *get* *=>* $this->first . " " . $this->last;
+
+ // Override the "write" action with arbitrary logic.
+ *set {*
+ [$this->first, $this->last] = explode(' ', $value);
+ $this->isModified = true;
+ }
+ }
+}
+?>]]></example>
+
+</slide>