Skip to content

Commit 811410d

Browse files
committed
Fix wording at property_access.rst
1 parent d95a478 commit 811410d

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
@@ -410,16 +410,17 @@ Sometimes, adder and remover methods don't use the standard ``add`` or ``remove`
410410
{
411411
// ...
412412

413-
public function joinPeople(string $people): void
413+
public function joinPeople(string $person): void
414414
{
415-
$this->peoples[] = $people;
415+
$this->people[] = $person;
416416
}
417417

418-
public function leavePeople(string $people): void
418+
public function leavePeople(string $person): void
419419
{
420-
foreach ($this->peoples as $id => $item) {
421-
if ($people === $item) {
422-
unset($this->peoples[$id]);
420+
foreach ($this->people as $id => $item) {
421+
if ($person === $item) {
422+
unset($this->people[$id]);
423+
423424
break;
424425
}
425426
}
@@ -432,9 +433,9 @@ Sometimes, adder and remover methods don't use the standard ``add`` or ``remove`
432433
$list = new PeopleList();
433434
$reflectionExtractor = new ReflectionExtractor(null, null, ['join', 'leave']);
434435
$propertyAccessor = new PropertyAccessor(PropertyAccessor::DISALLOW_MAGIC_METHODS, PropertyAccessor::THROW_ON_INVALID_PROPERTY_PATH, null, $reflectionExtractor, $reflectionExtractor);
435-
$propertyAccessor->setValue($person, 'peoples', ['kevin', 'wouter']);
436+
$propertyAccessor->setValue($person, 'people', ['kevin', 'wouter']);
436437

437-
var_dump($person->getPeoples()); // ['kevin', 'wouter']
438+
var_dump($person->getPeople()); // ['kevin', 'wouter']
438439

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

0 commit comments

Comments
 (0)