@@ -463,16 +463,17 @@ Sometimes, adder and remover methods don't use the standard ``add`` or ``remove`
463
463
{
464
464
// ...
465
465
466
- public function joinPeople(string $people ): void
466
+ public function joinPeople(string $person ): void
467
467
{
468
- $this->peoples [] = $people ;
468
+ $this->people [] = $person ;
469
469
}
470
470
471
- public function leavePeople(string $people ): void
471
+ public function leavePeople(string $person ): void
472
472
{
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
+
476
477
break;
477
478
}
478
479
}
@@ -485,9 +486,9 @@ Sometimes, adder and remover methods don't use the standard ``add`` or ``remove`
485
486
$list = new PeopleList();
486
487
$reflectionExtractor = new ReflectionExtractor(null, null, ['join', 'leave']);
487
488
$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']);
489
490
490
- var_dump($person->getPeoples ()); // ['kevin', 'wouter']
491
+ var_dump($person->getPeople ()); // ['kevin', 'wouter']
491
492
492
493
Instead of calling ``add<SingularOfThePropertyName>() `` and ``remove<SingularOfThePropertyName>() ``, the PropertyAccess
493
494
component will call ``join<SingularOfThePropertyName>() `` and ``leave<SingularOfThePropertyName>() `` methods.
0 commit comments