26 lines
494 B
Plaintext
26 lines
494 B
Plaintext
<?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);
|
|
}
|
|
} |