Skip to content

Commit 5d4bd81

Browse files
committed
removed attached() & detached() methods (BC break)
1 parent 53e2af0 commit 5d4bd81

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
@@ -93,11 +93,8 @@ final public function lookupPath(?string $type = null, bool $throw = true): ?str
9393
*/
9494
final public function monitor(string $type, ?callable $attached = null, ?callable $detached = null): void
9595
{
96-
if (func_num_args() === 1) {
97-
$class = (new \ReflectionMethod($this, 'attached'))->getDeclaringClass()->getName();
98-
trigger_error(__METHOD__ . "(): Methods $class::attached() and $class::detached() are deprecated, use monitor(\$type, [attached], [detached])", E_USER_DEPRECATED);
99-
$attached = [$this, 'attached'];
100-
$detached = [$this, 'detached'];
96+
if (!$attached && !$detached) {
97+
throw new Nette\InvalidStateException('At least one handler is required.');
10198
}
10299

103100
if (
@@ -121,26 +118,6 @@ final public function unmonitor(string $type): void
121118
}
122119

123120

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

146123

0 commit comments

Comments
 (0)