Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

UNIX is many things to many people, but it's never been everything to anybody.


devel / comp.lang.php / ReflectionAttribute: IS_INSTANCEOF and getTarget()

SubjectAuthor
* ReflectionAttribute: IS_INSTANCEOF and getTarget()alex
`* Re: ReflectionAttribute: IS_INSTANCEOF and getTarget()J.O. Aho
 `* Re: ReflectionAttribute: IS_INSTANCEOF and getTarget()alex
  `- Re: ReflectionAttribute: IS_INSTANCEOF and getTarget()J.O. Aho

1
ReflectionAttribute: IS_INSTANCEOF and getTarget()

<uhd6sm$1eugb$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=909&group=comp.lang.php#909

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 1j9448a02@lnx159sneakemail.com.invalid (alex)
Newsgroups: comp.lang.php
Subject: ReflectionAttribute: IS_INSTANCEOF and getTarget()
Date: Thu, 26 Oct 2023 10:09:58 +0200
Organization: A noiseless patient Spider
Lines: 5
Message-ID: <uhd6sm$1eugb$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 26 Oct 2023 08:09:58 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="e506b937edcd9ffb08d92d52bfe27f79";
logging-data="1538571"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/kCFS/z5FdhMcg42LFMwnB"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:anDEj7v6LRvQ5ryUrpTFZYqnBn0=
Content-Language: it-IT
 by: alex - Thu, 26 Oct 2023 08:09 UTC

https://www.php.net/manual/en/reflectionattribute.gettarget.php

https://www.php.net/manual/en/class.reflectionattribute.php#reflectionattribute.constants.is-instanceof

what are they for?

Re: ReflectionAttribute: IS_INSTANCEOF and getTarget()

<krdvhsFfkjrU1@mid.individual.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=911&group=comp.lang.php#911

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: user@example.net (J.O. Aho)
Newsgroups: comp.lang.php
Subject: Re: ReflectionAttribute: IS_INSTANCEOF and getTarget()
Date: Mon, 13 Nov 2023 07:54:52 +0100
Lines: 18
Message-ID: <krdvhsFfkjrU1@mid.individual.net>
References: <uhd6sm$1eugb$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net n04JJtUghyNXaZTrA/4uMg6LGcNMTY02hNOs/9xBU1WcEmDmGW
Cancel-Lock: sha1:1QgmsKwjDN9oZTBHeXF4i6Mm2dk= sha256:AIJkTVSJ18nqkw3isb+rubk4y1kY9w5JOda5Ni4a1HI=
User-Agent: Mozilla Thunderbird
Content-Language: en-US-large
In-Reply-To: <uhd6sm$1eugb$1@dont-email.me>
 by: J.O. Aho - Mon, 13 Nov 2023 06:54 UTC

On 26/10/2023 10.09, alex wrote:

Just my guesses as the documentation is a bit thin at the moment

> https://www.php.net/manual/en/reflectionattribute.gettarget.php

There are a number of attributes you can give a class, TARGET_* and you
will get the sum of all those targets as an unified bit value. 0 if none
of the TARGET_* are set.

> https://www.php.net/manual/en/class.reflectionattribute.php#reflectionattribute.constants.is-instanceof

this will give you something like typeof for the instance in question.

--
//Aho

Re: ReflectionAttribute: IS_INSTANCEOF and getTarget()

<uit2ht$kqjc$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=912&group=comp.lang.php#912

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 1j9448a02@lnx159sneakemail.com.invalid (alex)
Newsgroups: comp.lang.php
Subject: Re: ReflectionAttribute: IS_INSTANCEOF and getTarget()
Date: Mon, 13 Nov 2023 12:50:21 +0100
Organization: A noiseless patient Spider
Lines: 61
Message-ID: <uit2ht$kqjc$1@dont-email.me>
References: <uhd6sm$1eugb$1@dont-email.me> <krdvhsFfkjrU1@mid.individual.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 13 Nov 2023 11:50:22 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="1b5fb94a02a15f8b384a8cb990e09a65";
logging-data="682604"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+4vZJ8ZsoNJmcoNW5UKAaB"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:H3Fe8KY92ycy6Rv2E1F5wDSjWBg=
In-Reply-To: <krdvhsFfkjrU1@mid.individual.net>
Content-Language: it-IT
 by: alex - Mon, 13 Nov 2023 11:50 UTC

Il 13/11/23 07:54, J.O. Aho ha scritto:
>> https://www.php.net/manual/en/reflectionattribute.gettarget.php
>
> There are a number of attributes you can give a class, TARGET_* and you
> will get the sum of all those targets as an unified bit value. 0 if none
> of the TARGET_* are set.

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?

>> https://www.php.net/manual/en/class.reflectionattribute.php#reflectionattribute.constants.is-instanceof
>
> this will give you something like typeof for the instance in question.

typeof...???

https://www.google.com/search?channel=fs&client=ubuntu-sn&q=php+typeof#ip=1

Re: ReflectionAttribute: IS_INSTANCEOF and getTarget()

<kremroFfkjoU1@mid.individual.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=913&group=comp.lang.php#913

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: user@example.net (J.O. Aho)
Newsgroups: comp.lang.php
Subject: Re: ReflectionAttribute: IS_INSTANCEOF and getTarget()
Date: Mon, 13 Nov 2023 14:32:39 +0100
Lines: 42
Message-ID: <kremroFfkjoU1@mid.individual.net>
References: <uhd6sm$1eugb$1@dont-email.me> <krdvhsFfkjrU1@mid.individual.net>
<uit2ht$kqjc$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net Qh7yNyrQy5qXZrdWbJawegc6DSo+M3v4/rfwt4sBqaFQhbi5ZT
Cancel-Lock: sha1:rpWc9NiYgwbPKz43kbDUktYYtFI= sha256:mAI7VSHr/TBcEAFtElluAnhltMSpERLI8gbtSXQCK9g=
User-Agent: Mozilla Thunderbird
Content-Language: en-US-large
In-Reply-To: <uit2ht$kqjc$1@dont-email.me>
 by: J.O. Aho - Mon, 13 Nov 2023 13:32 UTC

On 13/11/2023 12.50, alex wrote:
> Il 13/11/23 07:54, J.O. Aho ha scritto:
>>> https://www.php.net/manual/en/reflectionattribute.gettarget.php
>>
>> There are a number of attributes you can give a class, TARGET_* and
>> you will get the sum of all those targets as an unified bit value. 0
>> if none of the TARGET_* are set.
>
> mmmhhh...
>
> Are you sure?

No and yes, it wasn't really what I thought

I thought it would give the value of
#[Attribute(Attribute::TARGET_CLASS|Attribute::IS_REPEATABLE)] (65)

but it only gives you

Attribute::TARGET_CLASS (1)
Attribute::TARGET_FUNCTION (2)
Attribute::TARGET_METHOD (4)

see:
https://github.com/php/php-src/blob/cc2bf119519c8dd7d6afa2b63aa4ea8b014f205d/Zend/zend_attributes.h

You can see at the unitest:
https://github.com/php/php-src/blob/cc2bf119519c8dd7d6afa2b63aa4ea8b014f205d/Zend/tests/attributes/020_userland_attribute_validation.phpt

>>> https://www.php.net/manual/en/class.reflectionattribute.php#reflectionattribute.constants.is-instanceof
>>
>> this will give you something like typeof for the instance in question.
>
> typeof...???

just ignore this part.. typeof used in other languages when you want to
know what type something is of and I was hasty in my reply and guessed
without really reading.

--
//Aho

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor