From 3e72847500b6ca8529b358be6d187ce03a1b0f28 Mon Sep 17 00:00:00 2001 From: Maritaria Date: Thu, 4 Nov 2021 13:32:31 +0100 Subject: [PATCH] Rename Facade to Debugbar (#1218) Creating the facade as a class named Debugbar enables better auto completion for IDEs and the like. To avoid naming conflicts it exists in a separate folder Facades. For backwards compatibility of existing code the current Facade persists as a class that extends the Debugbar facade class. This should allow for a minor update to the package with a deprecation notice on existing code importing the Facade explicitly. --- composer.json | 2 +- readme.md | 4 ++-- src/Facade.php | 12 ++++-------- src/Facades/Debugbar.php | 33 +++++++++++++++++++++++++++++++++ tests/BrowserTestCase.php | 4 ++-- tests/TestCase.php | 4 ++-- 6 files changed, 44 insertions(+), 15 deletions(-) create mode 100644 src/Facades/Debugbar.php diff --git a/composer.json b/composer.json index fff17ea4..65bb34dc 100644 --- a/composer.json +++ b/composer.json @@ -48,7 +48,7 @@ "Barryvdh\\Debugbar\\ServiceProvider" ], "aliases": { - "Debugbar": "Barryvdh\\Debugbar\\Facade" + "Debugbar": "Barryvdh\\Debugbar\\Facades\\Debugbar" } } }, diff --git a/readme.md b/readme.md index ecd61a60..a87deac8 100644 --- a/readme.md +++ b/readme.md @@ -38,7 +38,7 @@ And the default collectors: - MemoryCollector - ExceptionsCollector -It also provides a Facade interface for easy logging Messages, Exceptions and Time +It also provides a facade interface (`Debugbar`) for easy logging Messages, Exceptions and Time ## Installation @@ -65,7 +65,7 @@ Barryvdh\Debugbar\ServiceProvider::class, If you want to use the facade to log messages, add this to your facades in app.php: ```php -'Debugbar' => Barryvdh\Debugbar\Facade::class, +'Debugbar' => Barryvdh\Debugbar\Facades\Debugbar::class, ``` The profiler is enabled by default, if you have APP_DEBUG=true. You can override that in the config (`debugbar.enabled`) or by setting `DEBUGBAR_ENABLED` in your `.env`. See more options in `config/debugbar.php` diff --git a/src/Facade.php b/src/Facade.php index 12b457fa..933040d6 100644 --- a/src/Facade.php +++ b/src/Facade.php @@ -20,15 +20,11 @@ * @method static void warning(mixed $message) * @method static mixed measure(string $label, \Closure $closure) * + * @deprecated Renamed to \Barryvdh\Debugbar\Facades\Debugbar + * @see \Barryvdh\Debugbar\Facades\Debugbar + * * @see \Barryvdh\Debugbar\LaravelDebugbar */ -class Facade extends \Illuminate\Support\Facades\Facade +class Facade extends \Barryvdh\Debugbar\Facades\Debugbar { - /** - * {@inheritDoc} - */ - protected static function getFacadeAccessor() - { - return LaravelDebugbar::class; - } } diff --git a/src/Facades/Debugbar.php b/src/Facades/Debugbar.php new file mode 100644 index 00000000..3e7929b9 --- /dev/null +++ b/src/Facades/Debugbar.php @@ -0,0 +1,33 @@ + Facade::class]; + return ['Debugbar' => Debugbar::class]; } } diff --git a/tests/TestCase.php b/tests/TestCase.php index 00e478ef..ceac18d5 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -2,7 +2,7 @@ namespace Barryvdh\Debugbar\Tests; -use Barryvdh\Debugbar\Facade; +use Barryvdh\Debugbar\Facades\Debugbar; use Barryvdh\Debugbar\ServiceProvider; use Illuminate\Routing\Router; use Orchestra\Testbench\TestCase as Orchestra; @@ -31,7 +31,7 @@ protected function getPackageProviders($app) */ protected function getPackageAliases($app) { - return ['Debugbar' => Facade::class]; + return ['Debugbar' => Debugbar::class]; } /**