From b0b08ef39ae2016ddef13c3132f528e048c2d4c0 Mon Sep 17 00:00:00 2001 From: Simon Asika Date: Mon, 12 Jun 2017 23:58:18 +0800 Subject: [PATCH] deprecate CoreCommandTrait --- src/Core/Asset/AssetManager.php | 2 +- src/Core/Console/CoreCommandTrait.php | 12 ++++++------ .../Migration/Command/Migration/CreateCommand.php | 6 ++---- .../Migration/Command/Migration/StatusCommand.php | 6 ++---- src/Core/Package/Command/Package/InstallCommand.php | 7 ++----- src/Core/Queue/Command/Queue/FailedTableCommand.php | 6 ++---- src/Core/Queue/Command/Queue/RemoveFailedCommand.php | 7 ++----- src/Core/Queue/Command/Queue/RestartCommand.php | 7 ++----- src/Core/Queue/Command/Queue/RetryCommand.php | 7 ++----- src/Core/Queue/Command/Queue/TableCommand.php | 6 ++---- src/Core/Queue/Command/Queue/WorkerCommand.php | 7 ++----- src/Core/Queue/Driver/ResqueQueueDriver.php | 2 +- src/Debugger/Templates/_global/html.php | 4 +--- src/SystemPackage/Command/RunCommand.php | 7 ++----- 14 files changed, 29 insertions(+), 57 deletions(-) diff --git a/src/Core/Asset/AssetManager.php b/src/Core/Asset/AssetManager.php index b3d52e15..dab747c4 100644 --- a/src/Core/Asset/AssetManager.php +++ b/src/Core/Asset/AssetManager.php @@ -828,7 +828,7 @@ public static function getJSObject($data, $quoteKey = false) foreach ($array as $key => $value) { - $encodedKey = json_encode($key); + $encodedKey = json_encode((string) $key); if (!$quoteKey && preg_match('/[^0-9A-Za-z_]+/m', $key) == 0) { diff --git a/src/Core/Console/CoreCommandTrait.php b/src/Core/Console/CoreCommandTrait.php index 5d471e05..705b7894 100644 --- a/src/Core/Console/CoreCommandTrait.php +++ b/src/Core/Console/CoreCommandTrait.php @@ -12,13 +12,13 @@ * The CoreCommandTrait class. * * @since 3.0 + * + * @deprecated Extend \Windwalker\Core\Console\CoreCommand instead. */ trait CoreCommandTrait { - /** - * Property console. - * - * @var CoreConsole - */ - protected $console; + public function bootCoreCommandTrait() + { + throw new \LogicException('Please do not use this trait, extend Windwalker\Core\Console\CoreCommand instead.'); + } } diff --git a/src/Core/Migration/Command/Migration/CreateCommand.php b/src/Core/Migration/Command/Migration/CreateCommand.php index bbff5bae..2d6defd3 100644 --- a/src/Core/Migration/Command/Migration/CreateCommand.php +++ b/src/Core/Migration/Command/Migration/CreateCommand.php @@ -8,8 +8,7 @@ namespace Windwalker\Core\Migration\Command\Migration; -use Windwalker\Console\Command\AbstractCommand; -use Windwalker\Core\Console\CoreCommandTrait; +use Windwalker\Core\Console\CoreCommand; use Windwalker\Core\Migration\Command\MigrationCommandTrait; /** @@ -17,9 +16,8 @@ * * @since 2.0 */ -class CreateCommand extends AbstractCommand +class CreateCommand extends CoreCommand { - use CoreCommandTrait; use MigrationCommandTrait; /** diff --git a/src/Core/Migration/Command/Migration/StatusCommand.php b/src/Core/Migration/Command/Migration/StatusCommand.php index a0689606..a4f1a07c 100644 --- a/src/Core/Migration/Command/Migration/StatusCommand.php +++ b/src/Core/Migration/Command/Migration/StatusCommand.php @@ -8,8 +8,7 @@ namespace Windwalker\Core\Migration\Command\Migration; -use Windwalker\Console\Command\AbstractCommand; -use Windwalker\Core\Console\CoreCommandTrait; +use Windwalker\Core\Console\CoreCommand; use Windwalker\Core\Migration\Command\MigrationCommandTrait; /** @@ -17,9 +16,8 @@ * * @since 2.0 */ -class StatusCommand extends AbstractCommand +class StatusCommand extends CoreCommand { - use CoreCommandTrait; use MigrationCommandTrait; /** diff --git a/src/Core/Package/Command/Package/InstallCommand.php b/src/Core/Package/Command/Package/InstallCommand.php index a1842872..c4775e04 100644 --- a/src/Core/Package/Command/Package/InstallCommand.php +++ b/src/Core/Package/Command/Package/InstallCommand.php @@ -8,11 +8,10 @@ namespace Windwalker\Core\Package\Command\Package; -use Windwalker\Console\Command\Command; use Windwalker\Console\Prompter\BooleanPrompter; use Windwalker\Console\Prompter\TextPrompter; use Windwalker\Core\Console\ConsoleHelper; -use Windwalker\Core\Console\CoreCommandTrait; +use Windwalker\Core\Console\CoreCommand; use Windwalker\Core\Package\AbstractPackage; use Windwalker\Filesystem\File; use Windwalker\Filesystem\Folder; @@ -22,10 +21,8 @@ * * @since 3.0 */ -class InstallCommand extends Command +class InstallCommand extends CoreCommand { - use CoreCommandTrait; - /** * Property name. * diff --git a/src/Core/Queue/Command/Queue/FailedTableCommand.php b/src/Core/Queue/Command/Queue/FailedTableCommand.php index 37eff8b5..ea2b5a29 100644 --- a/src/Core/Queue/Command/Queue/FailedTableCommand.php +++ b/src/Core/Queue/Command/Queue/FailedTableCommand.php @@ -8,8 +8,7 @@ namespace Windwalker\Core\Queue\Command\Queue; -use Windwalker\Console\Command\Command; -use Windwalker\Core\Console\CoreCommandTrait; +use Windwalker\Core\Console\CoreCommand; use Windwalker\Core\Migration\Command\MigrationCommandTrait; /** @@ -17,9 +16,8 @@ * * @since 3.2 */ -class FailedTableCommand extends Command +class FailedTableCommand extends CoreCommand { - use CoreCommandTrait; use MigrationCommandTrait; /** diff --git a/src/Core/Queue/Command/Queue/RemoveFailedCommand.php b/src/Core/Queue/Command/Queue/RemoveFailedCommand.php index 233637f1..0677b166 100644 --- a/src/Core/Queue/Command/Queue/RemoveFailedCommand.php +++ b/src/Core/Queue/Command/Queue/RemoveFailedCommand.php @@ -8,19 +8,16 @@ namespace Windwalker\Core\Queue\Command\Queue; -use Windwalker\Console\Command\Command; use Windwalker\Console\Exception\WrongArgumentException; -use Windwalker\Core\Console\CoreCommandTrait; +use Windwalker\Core\Console\CoreCommand; /** * The WorkerCommand class. * * @since 3.2 */ -class RemoveFailedCommand extends Command +class RemoveFailedCommand extends CoreCommand { - use CoreCommandTrait; - /** * Property name. * diff --git a/src/Core/Queue/Command/Queue/RestartCommand.php b/src/Core/Queue/Command/Queue/RestartCommand.php index f2bc9b03..7fd0e174 100644 --- a/src/Core/Queue/Command/Queue/RestartCommand.php +++ b/src/Core/Queue/Command/Queue/RestartCommand.php @@ -8,8 +8,7 @@ namespace Windwalker\Core\Queue\Command\Queue; -use Windwalker\Console\Command\Command; -use Windwalker\Core\Console\CoreCommandTrait; +use Windwalker\Core\Console\CoreCommand; use Windwalker\Core\DateTime\Chronos; use Windwalker\Filesystem\File; @@ -18,10 +17,8 @@ * * @since 3.2 */ -class RestartCommand extends Command +class RestartCommand extends CoreCommand { - use CoreCommandTrait; - /** * Property name. * diff --git a/src/Core/Queue/Command/Queue/RetryCommand.php b/src/Core/Queue/Command/Queue/RetryCommand.php index d8a8c9c8..c2601c8c 100644 --- a/src/Core/Queue/Command/Queue/RetryCommand.php +++ b/src/Core/Queue/Command/Queue/RetryCommand.php @@ -8,9 +8,8 @@ namespace Windwalker\Core\Queue\Command\Queue; -use Windwalker\Console\Command\Command; use Windwalker\Console\Exception\WrongArgumentException; -use Windwalker\Core\Console\CoreCommandTrait; +use Windwalker\Core\Console\CoreCommand; use Windwalker\Utilities\Arr; /** @@ -18,10 +17,8 @@ * * @since 3.2 */ -class RetryCommand extends Command +class RetryCommand extends CoreCommand { - use CoreCommandTrait; - /** * Property name. * diff --git a/src/Core/Queue/Command/Queue/TableCommand.php b/src/Core/Queue/Command/Queue/TableCommand.php index e561c9de..d755fa6e 100644 --- a/src/Core/Queue/Command/Queue/TableCommand.php +++ b/src/Core/Queue/Command/Queue/TableCommand.php @@ -8,8 +8,7 @@ namespace Windwalker\Core\Queue\Command\Queue; -use Windwalker\Console\Command\Command; -use Windwalker\Core\Console\CoreCommandTrait; +use Windwalker\Core\Console\CoreCommand; use Windwalker\Core\Migration\Command\MigrationCommandTrait; /** @@ -17,9 +16,8 @@ * * @since 3.2 */ -class TableCommand extends Command +class TableCommand extends CoreCommand { - use CoreCommandTrait; use MigrationCommandTrait; /** diff --git a/src/Core/Queue/Command/Queue/WorkerCommand.php b/src/Core/Queue/Command/Queue/WorkerCommand.php index f9e5b230..c4ec362f 100644 --- a/src/Core/Queue/Command/Queue/WorkerCommand.php +++ b/src/Core/Queue/Command/Queue/WorkerCommand.php @@ -8,8 +8,7 @@ namespace Windwalker\Core\Queue\Command\Queue; -use Windwalker\Console\Command\Command; -use Windwalker\Core\Console\CoreCommandTrait; +use Windwalker\Core\Console\CoreCommand; use Windwalker\Core\Queue\Job\JobInterface; use Windwalker\Core\Queue\QueueMessage; use Windwalker\Core\Queue\Worker; @@ -21,10 +20,8 @@ * * @since 3.2 */ -class WorkerCommand extends Command +class WorkerCommand extends CoreCommand { - use CoreCommandTrait; - /** * Property name. * diff --git a/src/Core/Queue/Driver/ResqueQueueDriver.php b/src/Core/Queue/Driver/ResqueQueueDriver.php index 9c54e85a..76de8a4f 100644 --- a/src/Core/Queue/Driver/ResqueQueueDriver.php +++ b/src/Core/Queue/Driver/ResqueQueueDriver.php @@ -8,8 +8,8 @@ namespace Windwalker\Core\Queue\Driver; -use Windwalker\Core\Queue\Resque\Resque; use Windwalker\Core\Queue\QueueMessage; +use Windwalker\Core\Queue\Resque\Resque; /** * The ResqueQueueDriver class. diff --git a/src/Debugger/Templates/_global/html.php b/src/Debugger/Templates/_global/html.php index a82457ee..51c29e5d 100644 --- a/src/Debugger/Templates/_global/html.php +++ b/src/Debugger/Templates/_global/html.php @@ -6,9 +6,7 @@ * @license GNU General Public License version 2 or later; */ -use Windwalker\Core\Package\AbstractPackage; -use Windwalker\Core\Router\PackageRouter; -use Windwalker\Structure\Structure;use Windwalker\Uri\UriData; +use Windwalker\Core\Package\AbstractPackage;use Windwalker\Core\Router\PackageRouter;use Windwalker\Structure\Structure;use Windwalker\Uri\UriData; /** * @var Structure $uri diff --git a/src/SystemPackage/Command/RunCommand.php b/src/SystemPackage/Command/RunCommand.php index 9c967a86..b4a29f0c 100644 --- a/src/SystemPackage/Command/RunCommand.php +++ b/src/SystemPackage/Command/RunCommand.php @@ -9,9 +9,8 @@ namespace Windwalker\SystemPackage\Command; use Symfony\Component\Process\Process; -use Windwalker\Console\Command\Command; use Windwalker\Core\Console\ConsoleHelper; -use Windwalker\Core\Console\CoreCommandTrait; +use Windwalker\Core\Console\CoreCommand; use Windwalker\Utilities\Arr; /** @@ -19,10 +18,8 @@ * * @since 3.0 */ -class RunCommand extends Command +class RunCommand extends CoreCommand { - use CoreCommandTrait; - /** * Property name. *