notes/src/Common/ReflectedProperty.php
2024-05-27 18:06:56 +00:00

41 lines
905 B
PHP

<?php
namespace Notes\Common;
use Notes\Attribute\Ignore;
class ReflectedProperty extends Reflected implements ReflectedInterface, \ArrayAccess
{
public mixed $value;
public function __construct(
public string $name,
public false|ReflectedPropertyType|array $type = false,
public array $attributes = [],
) {}
## BACKWARD COMPATIBILITY ONLY To be removed really soon !
public function offsetExists(mixed $offset): bool
{
return isset($this->$offset);
}
public function offsetGet(mixed $offset): mixed
{
if ($offset === 'tags') {
return $this->attributes;
}
return $this->$offset;
}
public function offsetSet(mixed $offset, mixed $value): void
{
$this->$offset = $value;
}
public function offsetUnset(mixed $offset): void
{
unset($this->$offset);
}
}