Il 13/11/23 07:54, J.O. Aho ha scritto:
mmmhhh...
Are you sure?
An example? (here's mine below)
~$ cat /tmp/aaa
<?php
#[ATTRIB]
class TARGET_CLASS {
#[ATTRIB]
function TARGET_METHOD() {}
}
#[ATTRIB]
function TARGET_FUNCTION() {}
function TARGET_xxx() {}
$reflections = [
new ReflectionClass('TARGET_CLASS'),
new ReflectionMethod('TARGET_CLASS::TARGET_METHOD'),
new ReflectionFunction('TARGET_FUNCTION'),
new ReflectionFunction('TARGET_xxx'),
];
foreach ($reflections as $reflection) {
echo $reflection->getName() . ': ';
echo $reflection->getAttributes()[0]->getTarget() || "IS ZERO";
echo PHP_EOL;
}
~$ php /tmp/aaa
TARGET_CLASS: 1
TARGET_METHOD: 1
TARGET_FUNCTION: 1
TARGET_xxx: PHP Warning: Undefined array key 0 in /tmp/aaa on line 25
PHP Fatal error: Uncaught Error: Call to a member function getTarget()
on null in /tmp/aaa:25
REPEAT:
An example?
typeof...???
https://www.google.com/search?channel=fs&client=ubuntu-sn&q=php+typeof#ip=1