Skip to content

Comments

appendix 8.4 property hooks: confusing use of terms#4688

Open
belfie13 wants to merge 1 commit intophp:masterfrom
belfie13:patch-1
Open

appendix 8.4 property hooks: confusing use of terms#4688
belfie13 wants to merge 1 commit intophp:masterfrom
belfie13:patch-1

Conversation

@belfie13
Copy link

MAY This word, or the adjective "OPTIONAL", mean that an item is truly optional. RFC2119

in the property hooks example
// A "virtual" property. It **may** not be set explicitly.
could mean that the virtual property may OR may not be set explicitly.

updated to
// A "virtual" property. It **can** not be set explicitly.
also added to the example to show the error that would be thrown if the property was set

MAY   This word, or the adjective "OPTIONAL", mean that an item is truly optional. RFC2119

in the property hooks example
// A "virtual" property.  It **may** not be set explicitly.
could mean that the virtual property may OR may not be set explicitly.
updated to 
// A "virtual" property. It **can** not be set explicitly.
also added to the example to show the error that would be thrown if the property was set
@belfie13 belfie13 changed the title confusing use of terms appendix 8.4 property hooks: confusing use of terms May 20, 2025
$p->lastName = 'Peterson';
print $p->fullName; // Prints "Peter Peterson"

$p->fullName = "Peter 'Pete' Peterson"; // Fatal error: Property is read-only
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$p->fullName = "Peter 'Pete' Peterson"; // Fatal error: Property is read-only
$p->fullName = "Peter 'Pete' Peterson"; // Throws Error: "Property Person::$fullName is read-only"

class Person
{
// A "virtual" property. It may not be set explicitly.
// A "virtual" property. It can not be set explicitly.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// A "virtual" property. It can not be set explicitly.
// A "virtual" property. It cannot be set explicitly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants