1
0
mirror of https://github.com/flarum/core.git synced 2025-08-03 15:07:53 +02:00

Use anonymous class for FakeApp (#2725)

It's a better implementation than declaring a second class in the same file, which can confuse IDEs. Furthermore, FakeApp shouldn't be used outside this file.
This commit is contained in:
Alexander Skvortsov
2021-03-22 14:00:36 -04:00
committed by GitHub
parent 397c4c10ed
commit aabf88e6d6

View File

@@ -17,12 +17,7 @@ class Schedule extends LaravelSchedule
{ {
public function dueEvents($container) public function dueEvents($container)
{ {
return (new Collection($this->events))->filter->isDue(new FakeApp($container)); return (new Collection($this->events))->filter->isDue(new class($container) {
}
}
class FakeApp
{
public function __construct($container) public function __construct($container)
{ {
$this->config = $container->make(Config::class); $this->config = $container->make(Config::class);
@@ -37,4 +32,6 @@ class FakeApp
{ {
return ''; return '';
} }
});
}
} }