Skip to content

Change and fix property visibility in lazy-objects example 3 #4294

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

Merged
merged 1 commit into from
Dec 11, 2024

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