Hi Michał,
On Mon, Jan 16, 2017 at 10:30 AM, Michał Brzuchalski wrote:
> As I am familiar with those interceptions, I tend to point out some dirty
> hacks
> when reflection tells you property exists while getting notice on set, see
> https://3v4l.org/VDMHm
>
>
> class Foo
> {
> public $bar
As I am familiar with those interceptions, I tend to point out some dirty
hacks
when reflection tells you property exists while getting notice on set, see
https://3v4l.org/VDMHm
bar);
}
}
$foo = new FooHack(new Foo);
$reflectionFooBar = new \ReflectionProperty(Foo::class, 'bar');
var_dump((n
On Mon, Jan 16, 2017 at 9:49 AM, Michał Brzuchalski
wrote:
> Hi Marco,
>
> 2017-01-16 0:27 GMT+01:00 Marco Pivetta :
>
>> Hi Wes,
>>
>> This has been discussed before, and it's currently used to intercept
>> access
>> to properties. Since we don't have property accessors (sigh), the code
>> (simp
2017-01-16 9:49 GMT+01:00 Michał Brzuchalski :
> Hi Marco,
>
> 2017-01-16 0:27 GMT+01:00 Marco Pivetta :
>
>> Hi Wes,
>>
>> This has been discussed before, and it's currently used to intercept
>> access
>> to properties. Since we don't have property accessors (sigh), the code
>> (simplified versio
Hi Marco,
2017-01-16 0:27 GMT+01:00 Marco Pivetta :
> Hi Wes,
>
> This has been discussed before, and it's currently used to intercept access
> to properties. Since we don't have property accessors (sigh), the code
> (simplified version) would look like following:
>
> class Foo
> {
> public $
I do that too... but I feel bad for doing it :P Property accessors would be
great to have...
Almost forgot: these examples apply also to private and protected
properties. That's currently the only way to make the behavior consistent
across friend objects (same scope).
On Mon, Jan 16, 2017 at 12:27 AM, Marco Pivetta wrote:
> Hi Wes,
>
> This has been discussed before, and it's currently
Hi Wes,
This has been discussed before, and it's currently used to intercept access
to properties. Since we don't have property accessors (sigh), the code
(simplified version) would look like following:
class Foo
{
public $bar = 'baz';
}
class FooInterceptor extends Foo
{
private $wrappe
Hello elephpants.
Currently PHP allows explicitly declared fields (eg public $foo = 10;) to
be removed entirely through unset (eg unset($obj->foo)).
Now that isn't really an issue as properties in php are currently untyped
and therefore nullable; at worst you would get a notice. But it would
beco