Skip to content

Commit

Permalink
Attributes: Rename rebindCallback to rebindCallbacks and fix PHPDocs
Browse files Browse the repository at this point in the history
  • Loading branch information
Timm Ortloff committed Jan 9, 2023
1 parent 8eb83e1 commit ad3f164
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/Attributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Closure;
use InvalidArgumentException;
use IteratorAggregate;
use ReflectionException;
use ReflectionFunction;
use Traversable;

Expand Down Expand Up @@ -513,17 +512,15 @@ public function getIterator(): Traversable
}

/**
* Rebind all {@see self::$callbacks} and {@see self::$setterCallbacks} that point to `$oldThis` to `$newThis`.
* Rebind all callbacks that point to `$oldThis` to `$newThis`.
*
* @param object $oldThis
* @param object $newThis
*
* @throws ReflectionException
*/
public function rebind(object $oldThis, object $newThis): void
{
$this->rebindCallback($this->callbacks, $oldThis, $newThis);
$this->rebindCallback($this->setterCallbacks, $oldThis, $newThis);
$this->rebindCallbacks($this->callbacks, $oldThis, $newThis);
$this->rebindCallbacks($this->setterCallbacks, $oldThis, $newThis);
}

/**
Expand All @@ -535,10 +532,8 @@ public function rebind(object $oldThis, object $newThis): void
* @param callable[] $callbacks
* @param object $oldThis
* @param object $newThis
*
* @throws ReflectionException
*/
private function rebindCallback(array &$callbacks, object $oldThis, object $newThis): void
private function rebindCallbacks(array &$callbacks, object $oldThis, object $newThis): void
{
foreach ($callbacks as &$callback) {
if (! $callback instanceof Closure) {
Expand Down

0 comments on commit ad3f164

Please sign in to comment.