Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Config/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?? ''])) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would namespace be null? Docblock currently only says string, what calls this method and passes it a null? Can we update this method to use real argument types?

$items = $this->callAfterLoad($namespace, $group, $items);
}

Expand All @@ -211,7 +211,7 @@ protected function load($group, $namespace, $collection)
*/
protected function callAfterLoad($namespace, $group, $items)
{
$callback = $this->afterLoad[$namespace];
$callback = $this->afterLoad[$namespace ?? ''];
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question


return call_user_func($callback, $this, $group, $items);
}
Expand Down Expand Up @@ -314,7 +314,7 @@ public function package($namespace, $hint)
*/
public function afterLoading($namespace, Closure $callback)
{
$this->afterLoad[$namespace] = $callback;
$this->afterLoad[$namespace ?? ''] = $callback;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question

}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Console/Traits/ProcessesQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
4 changes: 2 additions & 2 deletions src/Halcyon/Processors/Processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)];
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under what condition would this be null? That seems like a bigger issue and one that should be protected against by returning null earlier from this method.

}

/**
Expand All @@ -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);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under what condition would this be null? Seems like it would be a bigger issue if it did and would also cause issues with overwriting items if multiple returned null filename

}

return $items;
Expand Down
4 changes: 2 additions & 2 deletions src/Html/FormBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Form facade would also need to be updated for this.

{
$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);
Expand Down
4 changes: 2 additions & 2 deletions tests/Scheduling/ScheduleListCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand All @@ -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')
Expand Down
Loading