pub struct PropertyDef {Show 14 fields
pub name: Arc<str>,
pub ty: Option<Arc<Type>>,
pub inferred_ty: Option<Arc<Type>>,
pub visibility: Visibility,
pub is_static: bool,
pub is_readonly: bool,
pub default: Option<Arc<Type>>,
pub location: Option<Location>,
pub deprecated: Option<Arc<str>>,
pub has_native_type: bool,
pub from_docblock: bool,
pub get_only_hook: bool,
pub has_native_readonly: bool,
pub native_ty: Option<Arc<Type>>,
}Fields§
§name: Arc<str>§ty: Option<Arc<Type>>Declared/inferred/default types. Stored as Option<Arc<Type>> (8 B)
rather than inline Option<Type> (176 B, no niche) and interned via the
global pool on construction/deserialization — common property types
(string, int, a shared class type) dedup to one allocation. Mirrors
DeclaredParam::ty. On-disk format is unchanged (the serde helpers (de)serialize
the inner Type transparently).
inferred_ty: Option<Arc<Type>>§visibility: Visibility§is_static: bool§is_readonly: bool§default: Option<Arc<Type>>§location: Option<Location>§deprecated: Option<Arc<str>>@deprecated docblock annotation, if present.
has_native_type: boolTrue when the property declares a PHP native type hint (public int $x).
A property typed only via a @var docblock (or untyped entirely) is
false: PHP gives such a property an implicit null default, so it is
never “uninitialized” (no MissingConstructor) and accepts null on
assignment regardless of the advisory docblock type.
from_docblock: boolTrue when this entry was synthesised from a @property / @property-read /
@property-write docblock tag rather than a real PHP property declaration.
Such entries describe magic properties accessible via __get/__set and
do not participate in PHP’s inheritance visibility rules.
get_only_hook: boolTrue when the property declares a get hook with no accompanying set
hook. Such a property is virtual: it has no backing storage, computes
its value on every access, and can never be assigned to at all — so it
is never “left uninitialized” by the constructor. A property that also
declares (or only declares) a set hook is backed and can still be
left uninitialized, so it does not count here.
has_native_readonly: boolTrue when readonly comes from a native PHP keyword (readonly modifier or
readonly class). False when only a @readonly docblock annotation is present.
Distinguishes PHP-enforced read-only from advisory documentation.
native_ty: Option<Arc<Type>>The PHP native type hint alone, with any @var docblock refinement stripped —
None when has_native_type is false. ty mixes in the docblock type when
present, which makes it unsuitable for checking PHP’s redeclared-property
type invariance rule: that rule is enforced by the runtime purely on the
native hint, never on the (unenforced) docblock annotation.