diff --git a/src/Config/Repository.php b/src/Config/Repository.php index 40a334376..02c068def 100644 --- a/src/Config/Repository.php +++ b/src/Config/Repository.php @@ -194,7 +194,7 @@ protected function load($group, $namespace, $collection) // If we've already loaded this collection, we will just bail out since we do // not want to load it again. Once items are loaded a first time they will // stay kept in memory within this class and not loaded from disk again. - if (isset($this->afterLoad[$namespace])) { + if (isset($this->afterLoad[$namespace ?? ''])) { $items = $this->callAfterLoad($namespace, $group, $items); } @@ -211,7 +211,7 @@ protected function load($group, $namespace, $collection) */ protected function callAfterLoad($namespace, $group, $items) { - $callback = $this->afterLoad[$namespace]; + $callback = $this->afterLoad[$namespace ?? '']; return call_user_func($callback, $this, $group, $items); } @@ -314,7 +314,7 @@ public function package($namespace, $hint) */ public function afterLoading($namespace, Closure $callback) { - $this->afterLoad[$namespace] = $callback; + $this->afterLoad[$namespace ?? ''] = $callback; } /** diff --git a/src/Console/Traits/ProcessesQuery.php b/src/Console/Traits/ProcessesQuery.php index 19d88d758..06cbc1d21 100644 --- a/src/Console/Traits/ProcessesQuery.php +++ b/src/Console/Traits/ProcessesQuery.php @@ -16,7 +16,7 @@ trait ProcessesQuery * query by the provided chunkSize, running the callback on each record and * limiting number of records processed to the provided limit */ - public function processQuery(Builder $query, callable $callback, int $chunkSize = 100, int $limit = null): void + public function processQuery(Builder $query, callable $callback, int $chunkSize = 100, ?int $limit = null): void { $totalRecords = $query->count(); diff --git a/src/Halcyon/Processors/Processor.php b/src/Halcyon/Processors/Processor.php index 8a6b79df5..abe68d6d7 100644 --- a/src/Halcyon/Processors/Processor.php +++ b/src/Halcyon/Processors/Processor.php @@ -19,7 +19,7 @@ public function processSelectOne(Builder $query, $result) $fileName = array_get($result, 'fileName'); - return [$fileName => $this->parseTemplateContent($query, $result, $fileName)]; + return [($fileName ?? '') => $this->parseTemplateContent($query, $result, $fileName)]; } /** @@ -39,7 +39,7 @@ public function processSelect(Builder $query, $results) foreach ($results as $result) { $fileName = array_get($result, 'fileName'); - $items[$fileName] = $this->parseTemplateContent($query, $result, $fileName); + $items[$fileName ?? ''] = $this->parseTemplateContent($query, $result, $fileName); } return $items; diff --git a/src/Html/FormBuilder.php b/src/Html/FormBuilder.php index 640d09c11..d59f49a07 100644 --- a/src/Html/FormBuilder.php +++ b/src/Html/FormBuilder.php @@ -478,12 +478,12 @@ public function selectYear(string $name, int $begin = 1900, ?int $end = null, st /** * Create a select month field. */ - public function selectMonth(string $name, string|array|null $selected = null, array $options = [], $format = '%B'): string + public function selectMonth(string $name, string|array|null $selected = null, array $options = [], $format = 'F'): string { $months = []; foreach (range(1, 12) as $month) { - $months[$month] = strftime($format, mktime(0, 0, 0, $month, 1)); + $months[$month] = date($format, mktime(0, 0, 0, $month, 1)); } return $this->select($name, $months, $selected, $options); diff --git a/tests/Scheduling/ScheduleListCommandTest.php b/tests/Scheduling/ScheduleListCommandTest.php index 7e5e3b04c..02f678834 100644 --- a/tests/Scheduling/ScheduleListCommandTest.php +++ b/tests/Scheduling/ScheduleListCommandTest.php @@ -54,7 +54,7 @@ public function testDisplaySchedule() ->expectsOutput(' * * * * * Winter\Storm\Tests\Scheduling\FooJob Next Due: 1 minute from now') ->expectsOutput(' 0 9,17 * * * php artisan inspire ......... Next Due: 9 hours from now') ->expectsOutput(' 0 10 * * * php artisan inspire ........ Next Due: 10 hours from now') - ->expectsOutput(' * * * * * Closure at: Winter\Storm\Tests\Scheduling\FooCall Next Due: 1 minute from now') + ->expectsOutput(' * * * * * Winter\Storm\Tests\Scheduling\FooCall Next Due: 1 minute from now') ->expectsOutput(' * * * * * Closure at: Winter\Storm\Tests\Scheduling\FooCall::fooFunction Next Due: 1 minute from now') ->expectsOutput(' * * * * * Closure at: '.$closureFilePath.':'.$closureLineNumber.' Next Due: 1 minute from now'); } @@ -78,7 +78,7 @@ public function testDisplayScheduleWithSort() ->assertSuccessful() ->expectsOutput(' * * * * * php artisan foobar a='.ProcessUtils::escapeArgument('b').' ... Next Due: 1 minute from now') ->expectsOutput(' * * * * * Winter\Storm\Tests\Scheduling\FooJob Next Due: 1 minute from now') - ->expectsOutput(' * * * * * Closure at: Winter\Storm\Tests\Scheduling\FooCall Next Due: 1 minute from now') + ->expectsOutput(' * * * * * Winter\Storm\Tests\Scheduling\FooCall Next Due: 1 minute from now') ->expectsOutput(' * * * * * Closure at: Winter\Storm\Tests\Scheduling\FooCall::fooFunction Next Due: 1 minute from now') ->expectsOutput(' * * * * * Closure at: '.$closureFilePath.':'.$closureLineNumber.' Next Due: 1 minute from now') ->expectsOutput(' 0 9,17 * * * php artisan inspire ......... Next Due: 9 hours from now')