Skip to content

Commit 1079103

Browse files
committed
removed attached() & detached() methods (BC break)
1 parent 30bd7ed commit 1079103

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

10299
if (
@@ -120,26 +117,6 @@ final public function unmonitor(string $type): void
120117
}
121118

122119

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

145122

0 commit comments

Comments
 (0)