|
2 | 2 |
|
3 | 3 | namespace TelegramBot; |
4 | 4 |
|
| 5 | +use InvalidArgumentException; |
| 6 | +use RuntimeException; |
5 | 7 | use TelegramBot\Entities\Update; |
6 | 8 | use TelegramBot\Exception\InvalidBotTokenException; |
7 | 9 | use TelegramBot\Interfaces\HandlerInterface; |
@@ -91,7 +93,7 @@ public function addPlugins(Plugin|array $plugins): UpdateHandler { |
91 | 93 |
|
92 | 94 | foreach ($plugins as $plugin) { |
93 | 95 | if (!is_subclass_of($plugin, Plugin::class)) { |
94 | | - throw new \RuntimeException( |
| 96 | + throw new RuntimeException( |
95 | 97 | sprintf('The plugin %s must be an instance of %s', get_class($plugin), Plugin::class) |
96 | 98 | ); |
97 | 99 | } |
@@ -138,10 +140,10 @@ private function isFiltered(Update $update): bool { |
138 | 140 | } elseif (is_bool($value)) { |
139 | 141 | return $value; |
140 | 142 | } |
141 | | - throw new \InvalidArgumentException('The value of the filter must be a callable or a boolean'); |
| 143 | + throw new InvalidArgumentException('The value of the filter must be a callable or a boolean'); |
142 | 144 | } |
143 | 145 | } |
144 | | - throw new \InvalidArgumentException('Invalid filter'); |
| 146 | + throw new InvalidArgumentException('Invalid filter'); |
145 | 147 | } |
146 | 148 |
|
147 | 149 | return false; |
@@ -169,7 +171,7 @@ public function resolve(Update|null $update = null, array $config = []): void { |
169 | 171 | } |
170 | 172 |
|
171 | 173 | if (!method_exists($this, '__process')) { |
172 | | - throw new \RuntimeException('The method __process does not exist'); |
| 174 | + throw new RuntimeException('The method __process does not exist'); |
173 | 175 | } |
174 | 176 |
|
175 | 177 | if (is_array($config)) { |
@@ -203,15 +205,15 @@ private function loadPlugins(array $plugins): void { |
203 | 205 |
|
204 | 206 | foreach ($plugins as $plugin) { |
205 | 207 | if (!is_subclass_of($plugin['class'], Plugin::class)) { |
206 | | - throw new \InvalidArgumentException(sprintf( |
| 208 | + throw new InvalidArgumentException(sprintf( |
207 | 209 | 'The plugin %s must be an instance of %s', |
208 | 210 | get_class($plugin['class']), Plugin::class |
209 | 211 | )); |
210 | 212 | } |
211 | 213 | } |
212 | 214 |
|
213 | 215 | if (!$update instanceof Update) { |
214 | | - throw new \InvalidArgumentException(sprintf( |
| 216 | + throw new InvalidArgumentException(sprintf( |
215 | 217 | 'The update must be an instance of %s. %s given', |
216 | 218 | Update::class, gettype($update) |
217 | 219 | )); |
|
0 commit comments