Skip to content

NOW MANAGED ON CODEBERG

Tweaked custom command registration, Added StyleCI fixes

Dan Brown1bf59f434bad
diff --git a/app/Auth/Access/ExternalBaseUserProvider.php b/app/Auth/Access/ExternalBaseUserProvider.php
index dc765ddc5..122425c11 100644
--- a/app/Auth/Access/ExternalBaseUserProvider.php
+++ b/app/Auth/Access/ExternalBaseUserProvider.php
@@ -64,7 +64,7 @@ class ExternalBaseUserProvider implements UserProvider
* Update the "remember me" token for the given user in storage.
*
* @param Authenticatable $user
- * @param string $token
+ * @param string $token
*
* @return void
*/
@@ -94,7 +94,7 @@ class ExternalBaseUserProvider implements UserProvider
* Validate a user against the given credentials.
*
* @param Authenticatable $user
- * @param array $credentials
+ * @param array $credentials
*
* @return bool
*/
diff --git a/app/Entities/Models/Entity.php b/app/Entities/Models/Entity.php
index eccec40b5..2b6f85d24 100644
--- a/app/Entities/Models/Entity.php
+++ b/app/Entities/Models/Entity.php
@@ -211,6 +211,7 @@ abstract class Entity extends Model implements Sluggable, Favouritable, Viewable
/**
* Check if this instance or class is a certain type of entity.
* Examples of $type are 'page', 'book', 'chapter'.
+ *
* @deprecated Use instanceof instead.
*/
public static function isA(string $type): bool
diff --git a/app/Interfaces/Deletable.php b/app/Interfaces/Deletable.php
index ca59e04f3..be9b4ac41 100644
--- a/app/Interfaces/Deletable.php
+++ b/app/Interfaces/Deletable.php
@@ -11,4 +11,4 @@ use Illuminate\Database\Eloquent\Relations\MorphMany;
interface Deletable
{
public function deletions(): MorphMany;
-}
\ No newline at end of file
+}
diff --git a/app/Theming/ThemeService.php b/app/Theming/ThemeService.php
index f0f8f033c..7bc12c5d1 100644
--- a/app/Theming/ThemeService.php
+++ b/app/Theming/ThemeService.php
@@ -3,6 +3,8 @@
namespace BookStack\Theming;
use BookStack\Auth\Access\SocialAuthService;
+use Illuminate\Console\Application;
+use Illuminate\Console\Application as Artisan;
use Illuminate\Contracts\Console\Kernel;
use Symfony\Component\Console\Command\Command;
@@ -50,9 +52,9 @@ class ThemeService
*/
public function registerCommand(Command $command)
{
- /** @var \Illuminate\Foundation\Console\Kernel $consoleKernel */
- $consoleKernel = app()->make(Kernel::class);
- $consoleKernel->registerCommand($command);
+ Artisan::starting(function(Application $application) use ($command) {
+ $application->addCommands([$command]);
+ });
}
/**
diff --git a/tests/ThemeTest.php b/tests/ThemeTest.php
index f04250bff..364bf6900 100644
--- a/tests/ThemeTest.php
+++ b/tests/ThemeTest.php
@@ -210,7 +210,7 @@ class ThemeTest extends TestCase
public function test_register_command_allows_provided_command_to_be_usable_via_artisan()
{
- Theme::registerCommand(new MyCustomCommand);
+ Theme::registerCommand(new MyCustomCommand());
Artisan::call('bookstack:test-custom-command', []);
$output = Artisan::output();
@@ -233,9 +233,12 @@ class ThemeTest extends TestCase
}
}
-class MyCustomCommand extends Command {
+class MyCustomCommand extends Command
+{
protected $signature = 'bookstack:test-custom-command';
- public function handle() {
+
+ public function handle()
+ {
$this->line('Command ran!');
}
-}
\ No newline at end of file
+}