-
-
Notifications
You must be signed in to change notification settings - Fork 37
Fix PHP 8.4 and 8.5 deprecations #229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: wip/1.3
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 ?? '']; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same question |
||
|
|
||
| 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; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same question |
||
| } | ||
|
|
||
| /** | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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)]; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
| } | ||
|
|
||
| /** | ||
|
|
@@ -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); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
|
|
||
There was a problem hiding this comment.
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?