Skip to content

Property access #7870

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

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions components/property_access.rst
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,9 @@ can use setters, the magic ``__set()`` method or properties to set values::
{
public $firstName;
private $lastName;
private $children = array();
public $children = array();

public function setLastName($name)
public function getLastName()
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand this change. This section is about modifying objects not reading from them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this looks better.

{
$this->lastName = $name;
Copy link
Contributor

Choose a reason for hiding this comment

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

You should change this to return $this->lastName; then.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks

}
Expand Down
2 changes: 1 addition & 1 deletion service_container/service_decoration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,6 @@ order by configuring the priority of decoration, this can be any integer number

The generated code will be the following::

$this->services['foo'] = new Baz(new Bar(new Foo())));
$this->services['foo'] = new Baz(new Bar(new Foo()));

.. _decorator pattern: https://en.wikipedia.org/wiki/Decorator_pattern