From 4791d4a15ba55df0067415e965139398a79df7b1 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Sun, 20 Nov 2022 16:32:52 +0100 Subject: [PATCH 01/19] Create MakePublicationTypeCommandTest.php --- .../Commands/MakePublicationTypeCommandTest.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 packages/framework/tests/Feature/Commands/MakePublicationTypeCommandTest.php diff --git a/packages/framework/tests/Feature/Commands/MakePublicationTypeCommandTest.php b/packages/framework/tests/Feature/Commands/MakePublicationTypeCommandTest.php new file mode 100644 index 00000000000..3e4dd546e45 --- /dev/null +++ b/packages/framework/tests/Feature/Commands/MakePublicationTypeCommandTest.php @@ -0,0 +1,16 @@ + Date: Sun, 20 Nov 2022 16:33:01 +0100 Subject: [PATCH 02/19] Update MakePublicationTypeCommand.php --- .../src/Console/Commands/MakePublicationTypeCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/framework/src/Console/Commands/MakePublicationTypeCommand.php b/packages/framework/src/Console/Commands/MakePublicationTypeCommand.php index 351468fabaf..c30c84054f4 100644 --- a/packages/framework/src/Console/Commands/MakePublicationTypeCommand.php +++ b/packages/framework/src/Console/Commands/MakePublicationTypeCommand.php @@ -13,7 +13,7 @@ /** * Hyde Command to create a new publication type. * - * @see \Hyde\Framework\Testing\Feature\Commands\MakePageCommandTest + * @see \Hyde\Framework\Testing\Feature\Commands\MakePublicationTypeCommandTest */ class MakePublicationTypeCommand extends Command implements CommandHandleInterface { From 61cf0bca96c0aa79e46110a78e005d088d3c0d1f Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Sun, 20 Nov 2022 16:38:04 +0100 Subject: [PATCH 03/19] Copilot generate test --- .../Commands/MakePublicationTypeCommandTest.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/framework/tests/Feature/Commands/MakePublicationTypeCommandTest.php b/packages/framework/tests/Feature/Commands/MakePublicationTypeCommandTest.php index 3e4dd546e45..4410fccce60 100644 --- a/packages/framework/tests/Feature/Commands/MakePublicationTypeCommandTest.php +++ b/packages/framework/tests/Feature/Commands/MakePublicationTypeCommandTest.php @@ -12,5 +12,19 @@ */ class MakePublicationTypeCommandTest extends TestCase { - // + public function test_command_creates_publication() + { + $this->artisan(MakePublicationTypeCommand::class, ['title' => 'Test Publication']) + ->expectsOutput('Creating a new Publication Type!') + ->expectsOutput('Publication type name') + ->expectsOutput('Choose the default field you wish to sort by:') + ->expectsOutput(' 0: dateCreated (meta field)') + ->expectsOutput(' 1: title') + ->expectsOutput(' 2: body') + ->expectsOutput('Choose the default sort direction:') + ->expectsOutput(' 1 - Ascending (oldest items first if sorting by dateCreated)') + ->expectsOutput(' 2 - Descending (newest items first if sorting by dateCreated)') + ->expectsOutput('Publication type created successfully!') + ->assertExitCode(0); + } } From 9f9faa23e27c56bee60ee0a079fd2357db42320f Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Sun, 20 Nov 2022 16:43:31 +0100 Subject: [PATCH 04/19] Fix critical bug causing command to crash --- .../src/Console/Commands/MakePublicationTypeCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/framework/src/Console/Commands/MakePublicationTypeCommand.php b/packages/framework/src/Console/Commands/MakePublicationTypeCommand.php index c30c84054f4..357dd75676c 100644 --- a/packages/framework/src/Console/Commands/MakePublicationTypeCommand.php +++ b/packages/framework/src/Console/Commands/MakePublicationTypeCommand.php @@ -74,7 +74,7 @@ public function handle(): int $this->output->writeln('Choose a canonical name field (the values of this field have to be unique!):'); foreach ($fields as $k => $v) { - if ($fields->type != 'image') { + if ($fields->first()->type != 'image') { $offset = $k + 1; $this->line(" $offset: $v->name"); } From b952ee002e415c8480c0cca6008b33a27d1497ba Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Sun, 20 Nov 2022 16:47:55 +0100 Subject: [PATCH 05/19] Update MakePublicationTypeCommandTest.php --- .../MakePublicationTypeCommandTest.php | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/packages/framework/tests/Feature/Commands/MakePublicationTypeCommandTest.php b/packages/framework/tests/Feature/Commands/MakePublicationTypeCommandTest.php index 4410fccce60..d3a26e8404c 100644 --- a/packages/framework/tests/Feature/Commands/MakePublicationTypeCommandTest.php +++ b/packages/framework/tests/Feature/Commands/MakePublicationTypeCommandTest.php @@ -5,8 +5,11 @@ namespace Hyde\Framework\Testing\Feature\Commands; use Hyde\Console\Commands\MakePublicationTypeCommand; +use Hyde\Hyde; use Hyde\Testing\TestCase; +use function deleteDirectory; + /** * @covers \Hyde\Console\Commands\MakePublicationTypeCommand */ @@ -14,17 +17,25 @@ class MakePublicationTypeCommandTest extends TestCase { public function test_command_creates_publication() { - $this->artisan(MakePublicationTypeCommand::class, ['title' => 'Test Publication']) - ->expectsOutput('Creating a new Publication Type!') - ->expectsOutput('Publication type name') + $this->artisan('make:publicationType') + ->expectsQuestion('Publication type name', 'Test Publication') + ->expectsQuestion('Field name', 'Title') + ->expectsQuestion('Field type (1-7)', 1) + ->expectsQuestion('Min value (for strings, this refers to string length)', 'default') + ->expectsQuestion('Max value (for strings, this refers to string length)', 'default') + ->expectsQuestion('Add another field (y/n)', 'n') + ->expectsQuestion('Sort field (0-1)', 0) + ->expectsQuestion('Sort field (1-2)', 1) + ->expectsQuestion('Enter the pagesize (0 for no limit)', 10) + ->expectsQuestion('Generate previous/next links in detail view (y/n)', 'n') + ->expectsQuestion('Canonical field (1-1)', 1) + ->expectsOutputToContain('Creating a new Publication Type!') ->expectsOutput('Choose the default field you wish to sort by:') - ->expectsOutput(' 0: dateCreated (meta field)') - ->expectsOutput(' 1: title') - ->expectsOutput(' 2: body') ->expectsOutput('Choose the default sort direction:') - ->expectsOutput(' 1 - Ascending (oldest items first if sorting by dateCreated)') - ->expectsOutput(' 2 - Descending (newest items first if sorting by dateCreated)') - ->expectsOutput('Publication type created successfully!') + // ->expectsOutput('Publication type created successfully!') + // ->expectsOutput('Saving publicationType data to [test-publication/schema.json]') ->assertExitCode(0); + + deleteDirectory(Hyde::path('test-publication')); } } From 70ec66309b9bc533be2cecc168fa95665d86e431 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Sun, 20 Nov 2022 16:50:08 +0100 Subject: [PATCH 06/19] Add expected JSON --- .../MakePublicationTypeCommandTest.php | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/packages/framework/tests/Feature/Commands/MakePublicationTypeCommandTest.php b/packages/framework/tests/Feature/Commands/MakePublicationTypeCommandTest.php index d3a26e8404c..7d4b8889c10 100644 --- a/packages/framework/tests/Feature/Commands/MakePublicationTypeCommandTest.php +++ b/packages/framework/tests/Feature/Commands/MakePublicationTypeCommandTest.php @@ -36,6 +36,31 @@ public function test_command_creates_publication() // ->expectsOutput('Saving publicationType data to [test-publication/schema.json]') ->assertExitCode(0); + $this->assertFileExists(Hyde::path('test-publication/schema.json')); + $this->assertEquals( + file_get_contents(Hyde::path('test-publication/schema.json')), + <<<'JSON' + { + "name": "Test Publication", + "canonicalField": "Title", + "sortField": "__createdAt", + "sortDirection": "ASC", + "pagesize": 10, + "prevNextLinks": true, + "detailTemplate": "test-publication_detail", + "listTemplate": "test-publication_list", + "fields": [ + { + "name": "Title", + "min": "default", + "max": "default", + "type": "string" + } + ] + } + JSON + ); + deleteDirectory(Hyde::path('test-publication')); } } From c3d156972cdbdd49a72866d121089131e535b1c5 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Sun, 20 Nov 2022 16:50:32 +0100 Subject: [PATCH 07/19] Add todo --- .../tests/Feature/Commands/MakePublicationTypeCommandTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/framework/tests/Feature/Commands/MakePublicationTypeCommandTest.php b/packages/framework/tests/Feature/Commands/MakePublicationTypeCommandTest.php index 7d4b8889c10..728dc807262 100644 --- a/packages/framework/tests/Feature/Commands/MakePublicationTypeCommandTest.php +++ b/packages/framework/tests/Feature/Commands/MakePublicationTypeCommandTest.php @@ -61,6 +61,8 @@ public function test_command_creates_publication() JSON ); + // TODO: Assert Blade templates were created? + deleteDirectory(Hyde::path('test-publication')); } } From 1369d91941af1789bc1196ef1faf11edd9eaeb8f Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Sun, 20 Nov 2022 15:50:45 +0000 Subject: [PATCH 08/19] Apply fixes from StyleCI --- .../tests/Feature/Commands/MakePublicationTypeCommandTest.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/framework/tests/Feature/Commands/MakePublicationTypeCommandTest.php b/packages/framework/tests/Feature/Commands/MakePublicationTypeCommandTest.php index 728dc807262..fca80e2026a 100644 --- a/packages/framework/tests/Feature/Commands/MakePublicationTypeCommandTest.php +++ b/packages/framework/tests/Feature/Commands/MakePublicationTypeCommandTest.php @@ -4,12 +4,10 @@ namespace Hyde\Framework\Testing\Feature\Commands; -use Hyde\Console\Commands\MakePublicationTypeCommand; +use function deleteDirectory; use Hyde\Hyde; use Hyde\Testing\TestCase; -use function deleteDirectory; - /** * @covers \Hyde\Console\Commands\MakePublicationTypeCommand */ From b54767dba6d312f3de68acc36412496329e16d1b Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Sun, 20 Nov 2022 16:55:47 +0100 Subject: [PATCH 09/19] Update PHPDoc Comment to match signature --- .../Features/Publications/PublicationHelper.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/framework/src/Framework/Features/Publications/PublicationHelper.php b/packages/framework/src/Framework/Features/Publications/PublicationHelper.php index 49f212fbfc4..e269de9559f 100644 --- a/packages/framework/src/Framework/Features/Publications/PublicationHelper.php +++ b/packages/framework/src/Framework/Features/Publications/PublicationHelper.php @@ -21,12 +21,12 @@ class PublicationHelper /** * Ask for a CLI input value until we pass validation rules. * - * @param Command $command - * @param string $name - * @param string $message - * @param array $rules - * @param array $rules - * @return mixed $default + * @param Command $command + * @param string $name + * @param string $message + * @param \Rgasch\Collection\Collection|array $rules + * @param mixed|null $default + * @return mixed */ public static function askWithValidation(Command $command, string $name, string $message, Collection|array $rules = [], mixed $default = null) { From edd7e48f22c3314e58a27d72e9c0d0fbb5fb82af Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Sun, 20 Nov 2022 16:56:33 +0100 Subject: [PATCH 10/19] Add missing method return types --- .../src/Framework/Features/Publications/PublicationHelper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/framework/src/Framework/Features/Publications/PublicationHelper.php b/packages/framework/src/Framework/Features/Publications/PublicationHelper.php index e269de9559f..4a3e175c38c 100644 --- a/packages/framework/src/Framework/Features/Publications/PublicationHelper.php +++ b/packages/framework/src/Framework/Features/Publications/PublicationHelper.php @@ -28,7 +28,7 @@ class PublicationHelper * @param mixed|null $default * @return mixed */ - public static function askWithValidation(Command $command, string $name, string $message, Collection|array $rules = [], mixed $default = null) + public static function askWithValidation(Command $command, string $name, string $message, Collection|array $rules = [], mixed $default = null): mixed { if ($rules instanceof Collection) { $rules = $rules->toArray(); @@ -65,7 +65,7 @@ public static function getKernel(): HydeKernel * @param string $pubTypeNameRaw * @return string */ - public static function formatNameForStorage(string $pubTypeNameRaw) + public static function formatNameForStorage(string $pubTypeNameRaw): string { return Str::slug($pubTypeNameRaw); } From e3092c8c246e210a664d99c5f15a01857a02ca35 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Sun, 20 Nov 2022 16:58:49 +0100 Subject: [PATCH 11/19] Remove redundant PHPDoc comments inferred by strong types --- .../Publications/PublicationHelper.php | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/packages/framework/src/Framework/Features/Publications/PublicationHelper.php b/packages/framework/src/Framework/Features/Publications/PublicationHelper.php index 4a3e175c38c..7eadd98f1ab 100644 --- a/packages/framework/src/Framework/Features/Publications/PublicationHelper.php +++ b/packages/framework/src/Framework/Features/Publications/PublicationHelper.php @@ -51,8 +51,6 @@ public static function askWithValidation(Command $command, string $name, string /** * Get the available HydeKernel instance. - * - * @return \Hyde\Foundation\HydeKernel */ public static function getKernel(): HydeKernel { @@ -61,9 +59,6 @@ public static function getKernel(): HydeKernel /** * Format the publication type name to a suitable representation for file storage. - * - * @param string $pubTypeNameRaw - * @return string */ public static function formatNameForStorage(string $pubTypeNameRaw): string { @@ -96,9 +91,6 @@ public static function getPublicationTypes(): Collection /** * Return all publications for a given pub type, optionally sorted by the publication's sortField. * - * @param PublicationType $pubType - * @return Collection - * * @throws \Safe\Exceptions\FilesystemException */ public static function getPublicationsForPubType(PublicationType $pubType, $sort = true): Collection @@ -148,8 +140,7 @@ public static function getMediaForPubType(PublicationType $pubType, $sort = true /** * Read an MD file and return the parsed data. * - * @param string $fileData - * @return Collection + * @throws \Safe\Exceptions\FilesystemException */ public static function getPublicationData(string $mdFileName): PublicationPage { @@ -174,10 +165,6 @@ public static function getPublicationData(string $mdFileName): PublicationPage /** * Check whether a given publication type exists. * - * @param string $pubTypeName - * @param bool $isRaw - * @return bool - * * @throws \Exception */ public static function publicationTypeExists(string $pubTypeName, bool $isRaw = true): bool @@ -191,9 +178,6 @@ public static function publicationTypeExists(string $pubTypeName, bool $isRaw = /** * Remove trailing slashes from the start and end of a string. - * - * @param string $string - * @return string */ public static function unslash(string $string): string { From 9944821beadc3280acd46731ede6c5d1f6b7b86a Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Sun, 20 Nov 2022 16:59:19 +0100 Subject: [PATCH 12/19] Remove throws tag for exception that is never thrown --- .../src/Framework/Features/Publications/PublicationHelper.php | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/framework/src/Framework/Features/Publications/PublicationHelper.php b/packages/framework/src/Framework/Features/Publications/PublicationHelper.php index 7eadd98f1ab..3a0bb5f4ab6 100644 --- a/packages/framework/src/Framework/Features/Publications/PublicationHelper.php +++ b/packages/framework/src/Framework/Features/Publications/PublicationHelper.php @@ -118,7 +118,6 @@ public static function getPublicationsForPubType(PublicationType $pubType, $sort * @param PublicationType $pubType * @return Collection * - * @throws \Safe\Exceptions\FilesystemException */ public static function getMediaForPubType(PublicationType $pubType, $sort = true): Collection { From a6f71a41357b5bf496d02730f4956544f24c1cbc Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Sun, 20 Nov 2022 16:59:31 +0100 Subject: [PATCH 13/19] Remove redundant PHPDoc comments inferred by strong types --- .../src/Framework/Features/Publications/PublicationHelper.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/framework/src/Framework/Features/Publications/PublicationHelper.php b/packages/framework/src/Framework/Features/Publications/PublicationHelper.php index 3a0bb5f4ab6..e966adcc415 100644 --- a/packages/framework/src/Framework/Features/Publications/PublicationHelper.php +++ b/packages/framework/src/Framework/Features/Publications/PublicationHelper.php @@ -114,10 +114,6 @@ public static function getPublicationsForPubType(PublicationType $pubType, $sort /** * Return all media items for a given publication type. - * - * @param PublicationType $pubType - * @return Collection - * */ public static function getMediaForPubType(PublicationType $pubType, $sort = true): Collection { From 4e952059b230312267ce7d7ae66b4521aa47a6d6 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Sun, 20 Nov 2022 17:00:09 +0100 Subject: [PATCH 14/19] Use dynamic Hyde path for compatibility --- .../src/Framework/Features/Publications/PublicationHelper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/framework/src/Framework/Features/Publications/PublicationHelper.php b/packages/framework/src/Framework/Features/Publications/PublicationHelper.php index e966adcc415..b8e1e79c671 100644 --- a/packages/framework/src/Framework/Features/Publications/PublicationHelper.php +++ b/packages/framework/src/Framework/Features/Publications/PublicationHelper.php @@ -117,7 +117,7 @@ public static function getPublicationsForPubType(PublicationType $pubType, $sort */ public static function getMediaForPubType(PublicationType $pubType, $sort = true): Collection { - $root = base_path(); + $root = Hyde::path(); $files = glob("$root/_media/{$pubType->directory}/*.{jpg,jpeg,png,gif,pdf}", GLOB_BRACE); $media = Collection::create(); From 5bb5a7f492f3690db6fd8aac7d4c3fce6b292cf0 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Sun, 20 Nov 2022 17:01:06 +0100 Subject: [PATCH 15/19] Remove unused helpers (can be moved back to HydeHelper) --- .../Features/Publications/PublicationHelper.php | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/packages/framework/src/Framework/Features/Publications/PublicationHelper.php b/packages/framework/src/Framework/Features/Publications/PublicationHelper.php index b8e1e79c671..89ecaae8a4c 100644 --- a/packages/framework/src/Framework/Features/Publications/PublicationHelper.php +++ b/packages/framework/src/Framework/Features/Publications/PublicationHelper.php @@ -49,14 +49,6 @@ public static function askWithValidation(Command $command, string $name, string return self::askWithValidation($command, $name, $message, $rules); } - /** - * Get the available HydeKernel instance. - */ - public static function getKernel(): HydeKernel - { - return app(HydeKernel::class); - } - /** * Format the publication type name to a suitable representation for file storage. */ @@ -170,12 +162,4 @@ public static function publicationTypeExists(string $pubTypeName, bool $isRaw = return self::getPublicationTypes()->has($pubTypeName); } - - /** - * Remove trailing slashes from the start and end of a string. - */ - public static function unslash(string $string): string - { - return trim($string, '/\\'); - } } From 9e22927bf1aaa1e5b6563241db23d327c6459b33 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Sun, 20 Nov 2022 17:04:25 +0100 Subject: [PATCH 16/19] Fix typo --- .../src/Console/Commands/MakePublicationTypeCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/framework/src/Console/Commands/MakePublicationTypeCommand.php b/packages/framework/src/Console/Commands/MakePublicationTypeCommand.php index 357dd75676c..8095c65e34c 100644 --- a/packages/framework/src/Console/Commands/MakePublicationTypeCommand.php +++ b/packages/framework/src/Console/Commands/MakePublicationTypeCommand.php @@ -30,7 +30,7 @@ public function handle(): int $title = $this->argument('title'); if (! $title) { - $title = trim(PublicationHelper::askWithValidation($this, 'nanme', 'Publication type name', ['required', 'string'])); + $title = trim(PublicationHelper::askWithValidation($this, 'name', 'Publication type name', ['required', 'string'])); $dirname = PublicationHelper::formatNameForStorage($title); if (file_exists($dirname)) { throw new \InvalidArgumentException("Storage path [$dirname] already exists"); From a4645cab66d8aa406f15389b11a71575c22133d2 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Sun, 20 Nov 2022 17:04:41 +0100 Subject: [PATCH 17/19] Cleanup code --- .../src/Console/Commands/MakePublicationTypeCommand.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/framework/src/Console/Commands/MakePublicationTypeCommand.php b/packages/framework/src/Console/Commands/MakePublicationTypeCommand.php index 8095c65e34c..e4ddf8c254e 100644 --- a/packages/framework/src/Console/Commands/MakePublicationTypeCommand.php +++ b/packages/framework/src/Console/Commands/MakePublicationTypeCommand.php @@ -4,9 +4,11 @@ namespace Hyde\Console\Commands; +use Exception; use Hyde\Console\Commands\Interfaces\CommandHandleInterface; use Hyde\Framework\Actions\CreatesNewPublicationTypeSchema; use Hyde\Framework\Features\Publications\PublicationHelper; +use InvalidArgumentException; use LaravelZero\Framework\Commands\Command; use Rgasch\Collection\Collection; @@ -33,7 +35,7 @@ public function handle(): int $title = trim(PublicationHelper::askWithValidation($this, 'name', 'Publication type name', ['required', 'string'])); $dirname = PublicationHelper::formatNameForStorage($title); if (file_exists($dirname)) { - throw new \InvalidArgumentException("Storage path [$dirname] already exists"); + throw new InvalidArgumentException("Storage path [$dirname] already exists"); } } @@ -85,7 +87,7 @@ public function handle(): int try { $creator = new CreatesNewPublicationTypeSchema($title, $fields, $canonicalField, $sortField, $sortDirection, $pagesize, $prevNextLinks); $creator->create(); - } catch (\Exception $e) { + } catch (Exception $e) { $this->error('Error: '.$e->getMessage().' at '.$e->getFile().':'.$e->getLine()); return Command::FAILURE; From d2f56728302067bf4c1daaf6f4988476b980ba65 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Sun, 20 Nov 2022 17:11:52 +0100 Subject: [PATCH 18/19] Initialize offset variable --- .../src/Console/Commands/MakePublicationTypeCommand.php | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/framework/src/Console/Commands/MakePublicationTypeCommand.php b/packages/framework/src/Console/Commands/MakePublicationTypeCommand.php index e4ddf8c254e..5ad6e763335 100644 --- a/packages/framework/src/Console/Commands/MakePublicationTypeCommand.php +++ b/packages/framework/src/Console/Commands/MakePublicationTypeCommand.php @@ -43,6 +43,7 @@ public function handle(): int $this->output->writeln('Choose the default field you wish to sort by:'); $this->line(' 0: dateCreated (meta field)'); + $offset = 0; foreach ($fields as $k => $v) { $offset = $k + 1; $this->line(" $offset: $v[name]"); From c2b72e6c67bc35e24a71fca0a8ed8a3da285f285 Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Sun, 20 Nov 2022 16:12:03 +0000 Subject: [PATCH 19/19] Apply fixes from StyleCI --- .../Features/Publications/PublicationHelper.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/framework/src/Framework/Features/Publications/PublicationHelper.php b/packages/framework/src/Framework/Features/Publications/PublicationHelper.php index 89ecaae8a4c..79d313d445a 100644 --- a/packages/framework/src/Framework/Features/Publications/PublicationHelper.php +++ b/packages/framework/src/Framework/Features/Publications/PublicationHelper.php @@ -5,7 +5,6 @@ namespace Hyde\Framework\Features\Publications; use Carbon\Carbon; -use Hyde\Foundation\HydeKernel; use Hyde\Framework\Features\Publications\Models\PublicationType; use Hyde\Hyde; use Hyde\Pages\PublicationPage; @@ -21,11 +20,11 @@ class PublicationHelper /** * Ask for a CLI input value until we pass validation rules. * - * @param Command $command - * @param string $name - * @param string $message - * @param \Rgasch\Collection\Collection|array $rules - * @param mixed|null $default + * @param Command $command + * @param string $name + * @param string $message + * @param \Rgasch\Collection\Collection|array $rules + * @param mixed|null $default * @return mixed */ public static function askWithValidation(Command $command, string $name, string $message, Collection|array $rules = [], mixed $default = null): mixed