self::INT_REF, self::STR => self::STR_REF, self::FLOAT => self::FLOAT_REF, self::BOOL => self::BOOL_REF, self::ARRAY => self::ARRAY_REF, default => null, }; } public static function getReferencedType(string $type): string { return match ($type) { self::INT_REF => self::INT, self::STR_REF => self::STR, self::FLOAT_REF => self::FLOAT, self::BOOL_REF => self::BOOL, self::ARRAY_REF => self::ARRAY, default => $type, }; } /** * Return the C++ expression for the initial state of a fixed value type. * * Fixed TypePHP storage never becomes UNDEF: unset() releases the current * value and restores this state instead. Objects are handled separately * because null is their valid empty state rather than a value-type default. */ public static function getDefaultValueExpression(string $type): ?string { return match ($type) { self::INT => '0', self::FLOAT => '0.0', self::BOOL => 'false', self::STR => self::STR . '()', self::ARRAY => self::ARRAY . '{}', default => null, }; } }