Skip to content

Commit

Permalink
Fixed PHP 8.4 deprecation notices on implicitly nullable method argum…
Browse files Browse the repository at this point in the history
…ents
  • Loading branch information
fulopattila122 committed Mar 4, 2025
1 parent a5ccfed commit f5ff855
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 12 deletions.
5 changes: 5 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# AppShell Changelog

## Unreleased
##### 2025-XX-YY

- Fixed PHP 8.4 deprecation notices on implicitly nullable method arguments

## 4.9.0
##### 2025-03-03

Expand Down
4 changes: 2 additions & 2 deletions src/Acl/ResourcePermissionMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ final class ResourcePermissionMapper

private ?array $aliases = null;

public function __construct(array $aliases = null)
public function __construct(?array $aliases = null)
{
if (null !== $aliases) {
$this->loadAliases($aliases);
Expand Down Expand Up @@ -140,7 +140,7 @@ private function plural(string $word): string
return $this->customPluralForms[$word] ?? Str::plural($word);
}

private function loadAliases(array $aliases = null): void
private function loadAliases(?array $aliases = null): void
{
if (null !== $this->aliases) {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/Acl/ResourcePermissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ final class ResourcePermissions
*
* @return \Illuminate\Support\Collection
*/
public static function createPermissionsForResource($resources, string $guard = null)
public static function createPermissionsForResource($resources, ?string $guard = null)
{
$resources = is_array($resources) ? $resources : [$resources];
$result = collect();
Expand Down
6 changes: 3 additions & 3 deletions src/Helpers/DateHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class DateHelper
*
* @return string
*/
public function showDate($date, string $unknownDateText = '', string $format = null): string
public function showDate($date, string $unknownDateText = '', ?string $format = null): string
{
$carbon = $this->toCarbon($date);

Expand All @@ -52,7 +52,7 @@ public function showDate($date, string $unknownDateText = '', string $format = n
*
* @return string
*/
public function showDateTime($datetime, string $unknownDateTimeText = '', string $format = null): string
public function showDateTime($datetime, string $unknownDateTimeText = '', ?string $format = null): string
{
$carbon = $this->toCarbon($datetime);

Expand All @@ -76,7 +76,7 @@ public function showDateTime($datetime, string $unknownDateTimeText = '', string
*
* @return string
*/
public function showTime($datetime, string $unknownTimeText = '', string $format = null): string
public function showTime($datetime, string $unknownTimeText = '', ?string $format = null): string
{
$carbon = $this->toCarbon($datetime);

Expand Down
6 changes: 3 additions & 3 deletions src/Support/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function coloring(): ColorHelper
*
* @return string
*/
function show_date($date, string $unknownDateText = '', string $format = null): string
function show_date($date, string $unknownDateText = '', ?string $format = null): string
{
return helper('date')->showDate($date, $unknownDateText, $format);
}
Expand All @@ -81,7 +81,7 @@ function show_date($date, string $unknownDateText = '', string $format = null):
*
* @return string
*/
function show_datetime($datetime, string $unknownDateTimeText = '', string $format = null): string
function show_datetime($datetime, string $unknownDateTimeText = '', ?string $format = null): string
{
return helper('date')->showDateTime($datetime, $unknownDateTimeText, $format);
}
Expand All @@ -95,7 +95,7 @@ function show_datetime($datetime, string $unknownDateTimeText = '', string $form
*
* @return string
*/
function show_time($datetime, string $unknownTimeText = '', string $format = null): string
function show_time($datetime, string $unknownTimeText = '', ?string $format = null): string
{
return helper('date')->showTime($datetime, $unknownTimeText, $format);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Support/icon.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function enum_icon(Enum $enum): string
/**
* Renders an icon using the selected Icon theme
*/
function icon(string $name, string $color = null, array $attributes = []): string
function icon(string $name, ?string $color = null, array $attributes = []): string
{
return icon_theme()->render($name, ThemeColor::create($color), $attributes);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Widgets/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Filter implements Widget

private $criteria = null;

public function __construct(Theme $theme, string $id, FilterType $type, string $title = null)
public function __construct(Theme $theme, string $id, FilterType $type, ?string $title = null)
{
$this->theme = $theme;
$this->id = $id;
Expand Down
2 changes: 1 addition & 1 deletion src/Widgets/Table/HasTableCellAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private function getSpecifiedAttributes(array $attributes): array
return $result;
}

private function toCssRule(array $def, string $key, string $cssKey = null): string
private function toCssRule(array $def, string $key, ?string $cssKey = null): string
{
if (!isset($def[$key])) {
return '';
Expand Down

0 comments on commit f5ff855

Please sign in to comment.