com presentations: New attribute syntax: slides/internals/php80-attributes-after.xml slides/internals/php80-attributes-attribute-definition.xml
slides/internals/php80-attributes-use-cases.xml
| From: | Derick Rethans | Date: | Tue, 08 Sep 2020 08:55:23 +0000 |
| Subject: | com presentations: New attribute syntax: slides/internals/php80-attributes-after.xml slides/internals/php80-attributes-attribute-definition.xml slides/internals/php80-attributes-use-cases.xml |
||
| Groups: | php.pres | ||
| Request: | Send a blank email to pres+get-2384@lists.php.net to get a copy of this message | ||
Commit: 31fda81e8791ccc09c4a8a946f022c838f3c1df2
Author: Derick Rethans <github@derickrethans.nl> Tue, 8 Sep 2020 09:55:23 +0100
Parents: b905529e252186a28b0f2fe54ee5c7a6d679d313
Branches: master
Link: http://git.php.net/?p=presentations.git;a=commitdiff;h=31fda81e8791ccc09c4a8a946f022c838f3c1df2
Log:
New attribute syntax
Changed paths:
M slides/internals/php80-attributes-after.xml
M slides/internals/php80-attributes-attribute-definition.xml
M slides/internals/php80-attributes-use-cases.xml
Diff:
diff --git a/slides/internals/php80-attributes-after.xml
b/slides/internals/php80-attributes-after.xml
index 44329c1e..59053f1b 100644
--- a/slides/internals/php80-attributes-after.xml
+++ b/slides/internals/php80-attributes-after.xml
@@ -5,24 +5,24 @@
<?php
use Doctrine\ORM\Attributes as ORM;
-*@@ORM\Entity*
+*#[ORM\Entity]*
class Distillery
{
- *@@ORM\Id*
- *@@ORM\Column("string")*
+ *#[ORM\Id]*
+ *#[ORM\Column("string")]*
private $name;
}]]>
</example>
<div effect="fade-in">
<example inline="2" class="big"><![CDATA[
- @@*ORM\Column*("string") // Class Name]]>
+ #[*ORM\Column]*("string") // Class Name]]>
</example>
</div>
<div effect="fade-in">
<example inline="2" class="big"><![CDATA[
- @@ORM\Column(*"string"*) // Constructor Arguments]]>
+ #[ORM\Column](*"string"*) // Constructor Arguments]]>
</example>
</div>
diff --git a/slides/internals/php80-attributes-attribute-definition.xml
b/slides/internals/php80-attributes-attribute-definition.xml
index ce85ddc3..3ee9da7e 100644
--- a/slides/internals/php80-attributes-attribute-definition.xml
+++ b/slides/internals/php80-attributes-attribute-definition.xml
@@ -9,14 +9,14 @@ use MyORM\Attributes as ORM;
class Distillery
{
- @@ORM\Column("string")
+ #[ORM\Column("string")]
private $name;
}
]]></example><example><![CDATA[<?php
namespace MyORM\Attributes;
-use PhpAttribute;
+use Attribute;
-@@PhpAttribute
+#[Attribute]
class Column {
public function __construct(public string $type) { }
}
@@ -46,11 +46,6 @@ object(MyORM\Attributes\Column)#4 (1) {
</example>
</div>
-<div effect="fade-in">
- <break lines="2"/>
- <blurb
class="big-centre">%*PhpAttribute*%<br/>🠳<br/>%*Attribute*%</blurb>
-</div>
-
</td>
</tr>
</table>
diff --git a/slides/internals/php80-attributes-use-cases.xml
b/slides/internals/php80-attributes-use-cases.xml
index fc35acce..26da32a6 100644
--- a/slides/internals/php80-attributes-use-cases.xml
+++ b/slides/internals/php80-attributes-use-cases.xml
@@ -2,11 +2,24 @@
<title>Attributes: Use Cases</title>
<list>
- <bullet>Replaces phpdoc annotations in Doctrine, Symfony, etc…</bullet>
+ <bullet>Replaces phpdoc annotations in Doctrine, Symfony, etc…
+<example inline="2"><![CDATA[
+<?php
+use Doctrine\ORM\Attributes as ORM;
+
+*#[ORM\Entity]*
+class Distillery
+{
+ *#[ORM\Id]*
+ *#[ORM\Column("string")]*
+ private $name;
+}]]>
+</example>
+ </bullet>
<bullet>May add internal attributes:
<list>
- <bullet>%&lt;&lt;Deprecated("Use xyz
instead")>>%</bullet>
- <bullet>%&lt;&lt;Jit>>%,
%&lt;&lt;NoJit>>%</bullet>
+ <bullet><example inline="2">%#[Deprecated("Use xyz
instead")]%</example></bullet>
+ <bullet><example inline="2">%#[Jit]%</example><example
inline="2">%#[NoJit]%</example></bullet>
</list>
</bullet>
</list>