Skip to content

Conversation

@paz-ekino
Copy link
Contributor

When running "Example 3 Initializing Properties Eagerly" result in https://www.php.net/manual/en/language.oop5.lazy-objects.php, an error occurs :

Fatal error: Uncaught Error: Cannot access private property BlogPost::$id

Changing visibility to public on id property for class BlogPost, example 3 resolves this error. All properties for this class example are set to public for preserve visibility homogeneity.

With the restricted visibility on id property for class BlogPost, example 3 is not functional.
@devnexen devnexen requested a review from arnaud-lb December 11, 2024 13:20
@arnaud-lb arnaud-lb merged commit 49f60a8 into php:master Dec 11, 2024
2 checks passed
@arnaud-lb
Copy link
Member

Thank you!

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