Skip to content

Commit 8a3718e

Browse files
committed
removed attached() & detached() methods (BC break)
1 parent 2cadac2 commit 8a3718e

File tree

1 file changed

+2
-25
lines changed

1 file changed

+2
-25
lines changed

src/ComponentModel/Component.php

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,8 @@ final public function lookupPath(?string $type = null, bool $throw = true): ?str
9494
*/
9595
final public function monitor(string $type, ?callable $attached = null, ?callable $detached = null): void
9696
{
97-
if (func_num_args() === 1) {
98-
$class = (new \ReflectionMethod($this, 'attached'))->getDeclaringClass()->getName();
99-
trigger_error(__METHOD__ . "(): Methods $class::attached() and $class::detached() are deprecated, use monitor(\$type, [attached], [detached])", E_USER_DEPRECATED);
100-
$attached = [$this, 'attached'];
101-
$detached = [$this, 'detached'];
97+
if (!$attached && !$detached) {
98+
throw new Nette\InvalidStateException('At least one handler is required.');
10299
}
103100

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

124121

125-
/**
126-
* This method will be called when the component (or component's parent)
127-
* becomes attached to a monitored object. Do not call this method yourself.
128-
* @deprecated use monitor($type, $attached)
129-
*/
130-
protected function attached(IComponent $obj): void
131-
{
132-
}
133-
134-
135-
/**
136-
* This method will be called before the component (or component's parent)
137-
* becomes detached from a monitored object. Do not call this method yourself.
138-
* @deprecated use monitor($type, null, $detached)
139-
*/
140-
protected function detached(IComponent $obj): void
141-
{
142-
}
143-
144-
145122
/********************* interface IComponent ****************d*g**/
146123

147124

0 commit comments

Comments
 (0)