Skip to content

Commit fabfa0f

Browse files
committed
Fix wording at property_access.rst
1 parent 3214bf2 commit fabfa0f

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

components/property_access.rst

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -463,16 +463,17 @@ Sometimes, adder and remover methods don't use the standard ``add`` or ``remove`
463463
{
464464
// ...
465465

466-
public function joinPeople(string $people): void
466+
public function joinPeople(string $person): void
467467
{
468-
$this->peoples[] = $people;
468+
$this->people[] = $person;
469469
}
470470

471-
public function leavePeople(string $people): void
471+
public function leavePeople(string $person): void
472472
{
473-
foreach ($this->peoples as $id => $item) {
474-
if ($people === $item) {
475-
unset($this->peoples[$id]);
473+
foreach ($this->people as $id => $item) {
474+
if ($person === $item) {
475+
unset($this->people[$id]);
476+
476477
break;
477478
}
478479
}
@@ -485,9 +486,9 @@ Sometimes, adder and remover methods don't use the standard ``add`` or ``remove`
485486
$list = new PeopleList();
486487
$reflectionExtractor = new ReflectionExtractor(null, null, ['join', 'leave']);
487488
$propertyAccessor = new PropertyAccessor(PropertyAccessor::DISALLOW_MAGIC_METHODS, PropertyAccessor::THROW_ON_INVALID_PROPERTY_PATH, null, $reflectionExtractor, $reflectionExtractor);
488-
$propertyAccessor->setValue($person, 'peoples', ['kevin', 'wouter']);
489+
$propertyAccessor->setValue($person, 'people', ['kevin', 'wouter']);
489490

490-
var_dump($person->getPeoples()); // ['kevin', 'wouter']
491+
var_dump($person->getPeople()); // ['kevin', 'wouter']
491492

492493
Instead of calling ``add<SingularOfThePropertyName>()`` and ``remove<SingularOfThePropertyName>()``, the PropertyAccess
493494
component will call ``join<SingularOfThePropertyName>()`` and ``leave<SingularOfThePropertyName>()`` methods.

0 commit comments

Comments
 (0)