mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-30 11:18:59 +01:00
Fix NOT optimization
This commit is contained in:
parent
6cc71a5c8e
commit
2e7a50a8c0
2
docs
2
docs
@ -1 +1 @@
|
||||
Subproject commit 1dae2c3bc73effbcd19cb61fe16e61050c1d6553
|
||||
Subproject commit 6936aa2703675f1b144d613e69e4922b51ea358f
|
2
schemas
2
schemas
@ -1 +1 @@
|
||||
Subproject commit 5bac791635b33c1c978bacad22f65c0f11633eb6
|
||||
Subproject commit 2185331bb36565039fd1bcbe14ee7c25eeab2f51
|
@ -18,15 +18,15 @@ final class FilterNot extends Filter
|
||||
}
|
||||
public function initialize(EventHandler $API): ?Filter
|
||||
{
|
||||
$filter = $this->filter->initialize($API);
|
||||
if ($filter === null) {
|
||||
// The nested filter didn't replace itself
|
||||
return $this;
|
||||
}
|
||||
$filter = $this->filter->initialize($API) ?? $this;
|
||||
if ($filter instanceof self) {
|
||||
// The nested filter is a FilterNot, optimize !!A => A
|
||||
return $filter->filter;
|
||||
}
|
||||
if ($filter === $this) {
|
||||
// The nested filter didn't replace itself
|
||||
return $this;
|
||||
}
|
||||
// The nested filter replaced itself, re-wrap it
|
||||
return new self($filter);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user