We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 403c9e9 commit 883d85aCopy full SHA for 883d85a
snippet/php_84/property_hook.php
@@ -0,0 +1,19 @@
1
+<?php
2
+
3
+declare(strict_types=1);
4
5
+use PhpParser\Modifiers;
6
7
+$propertyItem = new \PhpParser\Node\PropertyItem('someProperty');
8
+$property = new \PhpParser\Node\Stmt\Property(Modifiers::PUBLIC, [$propertyItem]);
9
10
+$plus = new \PhpParser\Node\Expr\BinaryOp\Plus(
11
+ new \PhpParser\Node\Expr\Variable('variable'),
12
+ new \PhpParser\Node\Scalar\Int_(100)
13
+);
14
15
+$getPropertyHook = new \PhpParser\Node\PropertyHook('getProperty', $plus);
16
17
+$property->hooks[] = $getPropertyHook;
18
19
+return $property;
0 commit comments