Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix codestyle
  • Loading branch information
iulyanp committed May 5, 2017
commit 2a617134e76f00e658a86522a338f5659c0dd1af
14 changes: 8 additions & 6 deletions components/property_access.rst
Original file line number Diff line number Diff line change
Expand Up @@ -252,18 +252,20 @@ can use setters, the magic ``__set()`` method or properties to set values::
$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

}

public function __set($property, $value)
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->$property = $value;
}

public function getLastName() {
return $this->lastName;
}

public function getChildren() {
public function getChildren()
{
return $this->children;
}
Copy link
Member

Choose a reason for hiding this comment

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

I would move both methods between setLastName() and __set(). And to match the code style of the Symfony code the opening curly brace should be on its own line. However, we can easily make this change while merging your PR.


public function __set($property, $value)
{
$this->$property = $value;
}
}

$person = new Person();
Expand Down