summaryrefslogtreecommitdiff
path: root/Zend/tests/attributes/005_objects.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'Zend/tests/attributes/005_objects.phpt')
-rw-r--r--Zend/tests/attributes/005_objects.phpt46
1 files changed, 23 insertions, 23 deletions
diff --git a/Zend/tests/attributes/005_objects.phpt b/Zend/tests/attributes/005_objects.phpt
index 206d89fa10..62b14181ef 100644
--- a/Zend/tests/attributes/005_objects.phpt
+++ b/Zend/tests/attributes/005_objects.phpt
@@ -6,22 +6,22 @@ Attributes can be converted into objects.
#[Attribute(Attribute::TARGET_FUNCTION)]
class A1
{
- public string $name;
- public int $ttl;
-
- public function __construct(string $name, int $ttl = 50)
- {
- $this->name = $name;
- $this->ttl = $ttl;
- }
+ public string $name;
+ public int $ttl;
+
+ public function __construct(string $name, int $ttl = 50)
+ {
+ $this->name = $name;
+ $this->ttl = $ttl;
+ }
}
$ref = new \ReflectionFunction(#[A1('test')] function () { });
foreach ($ref->getAttributes() as $attr) {
- $obj = $attr->newInstance();
+ $obj = $attr->newInstance();
- var_dump(get_class($obj), $obj->name, $obj->ttl);
+ var_dump(get_class($obj), $obj->name, $obj->ttl);
}
echo "\n";
@@ -29,9 +29,9 @@ echo "\n";
$ref = new \ReflectionFunction(#[A1] function () { });
try {
- $ref->getAttributes()[0]->newInstance();
+ $ref->getAttributes()[0]->newInstance();
} catch (\ArgumentCountError $e) {
- var_dump('ERROR 1', $e->getMessage());
+ var_dump('ERROR 1', $e->getMessage());
}
echo "\n";
@@ -39,9 +39,9 @@ echo "\n";
$ref = new \ReflectionFunction(#[A1([])] function () { });
try {
- $ref->getAttributes()[0]->newInstance();
+ $ref->getAttributes()[0]->newInstance();
} catch (\TypeError $e) {
- var_dump('ERROR 2', $e->getMessage());
+ var_dump('ERROR 2', $e->getMessage());
}
echo "\n";
@@ -49,9 +49,9 @@ echo "\n";
$ref = new \ReflectionFunction(#[A2] function () { });
try {
- $ref->getAttributes()[0]->newInstance();
+ $ref->getAttributes()[0]->newInstance();
} catch (\Error $e) {
- var_dump('ERROR 3', $e->getMessage());
+ var_dump('ERROR 3', $e->getMessage());
}
echo "\n";
@@ -59,15 +59,15 @@ echo "\n";
#[Attribute]
class A3
{
- private function __construct() { }
+ private function __construct() { }
}
$ref = new \ReflectionFunction(#[A3] function () { });
try {
- $ref->getAttributes()[0]->newInstance();
+ $ref->getAttributes()[0]->newInstance();
} catch (\Error $e) {
- var_dump('ERROR 4', $e->getMessage());
+ var_dump('ERROR 4', $e->getMessage());
}
echo "\n";
@@ -78,9 +78,9 @@ class A4 { }
$ref = new \ReflectionFunction(#[A4(1)] function () { });
try {
- $ref->getAttributes()[0]->newInstance();
+ $ref->getAttributes()[0]->newInstance();
} catch (\Error $e) {
- var_dump('ERROR 5', $e->getMessage());
+ var_dump('ERROR 5', $e->getMessage());
}
echo "\n";
@@ -90,9 +90,9 @@ class A5 { }
$ref = new \ReflectionFunction(#[A5] function () { });
try {
- $ref->getAttributes()[0]->newInstance();
+ $ref->getAttributes()[0]->newInstance();
} catch (\Error $e) {
- var_dump('ERROR 6', $e->getMessage());
+ var_dump('ERROR 6', $e->getMessage());
}
?>