Skip to content

Commit 02ed26f

Browse files
committed
update records
1 parent c7155c3 commit 02ed26f

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

drafts/records.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,10 +551,12 @@ The `finalizeRecord()` method is used to make a record immutable and look up its
551551
returning an instance that represents the finalized record.
552552

553553
Calling `finalizeRecord()` on a record that has already been finalized will return the same instance.
554+
Attempting to finalize a regular object will throw a `ReflectionException`.
554555

555556
#### isRecord()
556557

557-
The `isRecord()` method is used to determine if an object is a record. It returns `true` if the object is a record.
558+
The `isRecord()` method is used to determine if an object is a record.
559+
It returns `true` if the object is a finalized record.
558560

559561
#### getInlineConstructor()
560562

@@ -587,7 +589,6 @@ For example, `var_dump()` will output `object` instead of `record`.
587589
The `isMutable()` method is used
588590
to determine if a record has been made mutable via `makeMutable()` or otherwise not yet finalized.
589591

590-
591592
#### Custom deserialization example
592593

593594
In cases where custom deserialization is required,

published/records.ptxt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,11 +489,11 @@ Attempting to use ''%%ReflectionClass%%'' or ''%%ReflectionFunction%%'' on a rec
489489

490490
The ''%%finalizeRecord()%%'' method is used to make a record immutable and look up its value in the internal cache, returning an instance that represents the finalized record.
491491

492-
Calling ''%%finalizeRecord()%%'' on a record that has already been finalized will return the same instance.
492+
Calling ''%%finalizeRecord()%%'' on a record that has already been finalized will return the same instance. Attempting to finalize a regular object will throw a ''%%ReflectionException%%''.
493493

494494
=== isRecord() ===
495495

496-
The ''%%isRecord()%%'' method is used to determine if an object is a record. It returns ''%%true%%'' if the object is a record.
496+
The ''%%isRecord()%%'' method is used to determine if an object is a record. It returns ''%%true%%'' if the object is a finalized record.
497497

498498
=== getInlineConstructor() ===
499499

0 commit comments

Comments
 (0)