php / php/doc-en

Overloading confusing example

Open
#3,013 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
XML
Stars
596
Forks
890
Avg merge
1d 15h
Merged PRs (30d)
55

Description

https://github.com/php/doc-en/blob/21191d3f9d170c8e9589ca670d1cda9f23e07ac4/language/oop5/overloading.xml#L127-L237

The final line of this example is quite confusing.

The error triggered when accessing the private property occurs within the __get() method. Despite this, accessing an overloaded private property is indeed possible, and that is the intended purpose of this chapter.

A solution would be to eliminate the $data property, remove the error trigger, and ensure clarity in conveying that it is permissible to access a private property of a class overloaded with the __get() method.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open language/oop5/overloading.xml around lines 127-237 and inspect the final line of the example. Remove the $data property and error trigger as proposed, then revise the example so it clearly explains that accessing a private property through __get() is permissible. Verify that the resulting example communicates the intended purpose of the overloading chapter.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.