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 Aug 7, 2024
1 parent b85d242 commit 4b23011
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 @@ -92,11 +92,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 @@ -120,26 +117,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 4b23011

Please sign in to comment.