- Added some reflected properties

This commit is contained in:
Dave Mc Nicoll 2026-04-23 18:10:19 +00:00
parent 237f0a30d2
commit fa0430a3fc
2 changed files with 36 additions and 0 deletions

View File

@ -18,4 +18,14 @@ class ReflectedPropertyType
return $this->type === $type;
}
public function isObject() : bool
{
return ! $this->builtIn && class_exists($this->type);
}
public function isEnum() : bool
{
return ! $this->builtIn && enum_exists($this->type);
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace Notes\Common;
class ReflectedPropertyType
{
public function __construct(
public string $type,
public bool $builtIn,
public bool $nullable,
) {}
public function isType(string $type) : bool
{
if ($type === "null" || $this->nullable) {
return true;
}
return $this->type === $type;
}
public function isObject() : bool
{
return ! $this->builtIn && class_exists($this->type);
}
}