Skip to content

appendix 8.4 property hooks: confusing use of terms #4688

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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
@@ -52,6 +52,8 @@ $p->firstName = 'peter';
print $p->firstName; // Prints "Peter"
$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"

@@ -23,7 +23,7 @@
<?php
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