result = array_merge( array_fill_keys(static::KEYS, null), [ "missing" => true, "null" => false, "valid" => false, "normalized" => false, ]); } function __get(string $name) { return $this->result[$name]; } function __set(string $name, $value): void { $this->result[$name] = $value; } function setMissing(ScalarSchema $schema, ?string $key=null): int { $this->missing = true; if (!$schema->required) { $this->null = true; $this->valid = true; $this->normalized = true; return ref_analyze::NORMALIZED; } else { $message = cl::get($schema->messages, "missing"); $message = str_replace("{key}", $key, $message); $this->message = $message; return ref_analyze::MISSING; } } function setNull(ScalarSchema $schema, ?string $key=null): int { $this->missing = true; if ($schema->nullable) { $this->valid = true; $this->normalized = true; return ref_analyze::NORMALIZED; } else { $message = cl::get($schema->messages, "null"); $message = str_replace("{key}", $key, $message); $this->message = $message; return ref_analyze::NULL; } } }