Skip to content

Commit

Permalink
removed attached() & detached() methods (BC break)
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Feb 8, 2024
1 parent 4172ae7 commit c2c081c
Showing 1 changed file with 2 additions and 25 deletions.
27 changes: 2 additions & 25 deletions src/ComponentModel/Component.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,8 @@ final public function lookupPath(?string $type = null, bool $throw = true): ?str
*/
final public function monitor(string $type, ?callable $attached = null, ?callable $detached = null): void
{
if (func_num_args() === 1) {
$class = (new \ReflectionMethod($this, 'attached'))->getDeclaringClass()->getName();
trigger_error(__METHOD__ . "(): Methods $class::attached() and $class::detached() are deprecated, use monitor(\$type, [attached], [detached])", E_USER_DEPRECATED);
$attached = [$this, 'attached'];
$detached = [$this, 'detached'];
if (!$attached && !$detached) {
throw new Nette\InvalidStateException('At least one handler is required.');
}

if (
Expand All @@ -122,26 +119,6 @@ final public function unmonitor(string $type): void
}


/**
* This method will be called when the component (or component's parent)
* becomes attached to a monitored object. Do not call this method yourself.
* @deprecated use monitor($type, $attached)
*/
protected function attached(IComponent $obj): void
{
}


/**
* This method will be called before the component (or component's parent)
* becomes detached from a monitored object. Do not call this method yourself.
* @deprecated use monitor($type, null, $detached)
*/
protected function detached(IComponent $obj): void
{
}


/********************* interface IComponent ****************d*g**/


Expand Down

0 comments on commit c2c081c

Please sign in to comment.