Skip to content

Commit 2e17aa7

Browse files
authored
Merge pull request #11 from koffinate/analysis-aVjNyZ
Apply fixes from StyleCI
2 parents 6eee3fb + c37ca61 commit 2e17aa7

File tree

8 files changed

+35
-35
lines changed

8 files changed

+35
-35
lines changed

helpers.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
* @return \Kfn\Menu\Contracts\GroupedMenu
1212
*/
13-
function menus(string|null $name = null): \Kfn\Menu\Contracts\GroupedMenu
13+
function menus(?string $name = null): \Kfn\Menu\Contracts\GroupedMenu
1414
{
1515
return new \Kfn\Menu\Factory(name: $name);
1616
}
@@ -23,7 +23,7 @@ function menus(string|null $name = null): \Kfn\Menu\Contracts\GroupedMenu
2323
* @param string|null $type
2424
* @return MenuType|string|null
2525
*/
26-
function menuType(string|null $type = null): MenuType|string|null
26+
function menuType(?string $type = null): MenuType|string|null
2727
{
2828
if ($type) {
2929
return MenuType::tryFrom($type);

src/Contracts/GroupItem.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ public function route(
2525
array $param = [],
2626
array $attribute = [],
2727
int $sort = 0,
28-
string|null $activeRoute = null,
29-
array|null $activeRouteParam = null,
28+
?string $activeRoute = null,
29+
?array $activeRouteParam = null,
3030
Closure|bool $resolver = true
3131
): static;
3232

@@ -48,8 +48,8 @@ public function url(
4848
array $param = [],
4949
array $attribute = [],
5050
int $sort = 0,
51-
string|null $activeUrl = null,
52-
array|null $activeUrlParam = null,
51+
?string $activeUrl = null,
52+
?array $activeUrlParam = null,
5353
Closure|bool $resolver = true
5454
): static;
5555

@@ -73,8 +73,8 @@ public function add(
7373
array $param = [],
7474
array $attribute = [],
7575
int $sort = 0,
76-
string|null $activeName = null,
77-
array|null $activeParam = null,
76+
?string $activeName = null,
77+
?array $activeParam = null,
7878
Closure|bool $resolver = true
7979
): static;
8080
}

src/Contracts/GroupedMenu.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function add(
3030
* @return \Kfn\Menu\GroupedMenu|\Kfn\Menu\GroupItem
3131
*/
3232
public function get(
33-
string|null $groupName = null,
33+
?string $groupName = null,
3434
bool $resolvedOnly = true
3535
): \Kfn\Menu\GroupedMenu|\Kfn\Menu\GroupItem;
3636
}

src/Contracts/Menu.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ public function route(
3030
string $title,
3131
array $param = [],
3232
array $attribute = [],
33-
string|null $activeRoute = null,
34-
array|null $activeRouteParam = null,
33+
?string $activeRoute = null,
34+
?array $activeRouteParam = null,
3535
Closure|bool $resolver = true,
3636
bool $hasChild = false
3737
): static;
@@ -53,8 +53,8 @@ public function url(
5353
string $title,
5454
array $param = [],
5555
array $attribute = [],
56-
string|null $activeUrl = null,
57-
array|null $activeUrlParam = null,
56+
?string $activeUrl = null,
57+
?array $activeUrlParam = null,
5858
Closure|bool $resolver = true,
5959
bool $hasChild = false
6060
): static;
@@ -78,8 +78,8 @@ public function add(
7878
string $title,
7979
array $param = [],
8080
array $attribute = [],
81-
string|null $activeName = null,
82-
array|null $activeParam = null,
81+
?string $activeName = null,
82+
?array $activeParam = null,
8383
Closure|bool $resolver = true,
8484
bool $hasChild = false
8585
): static;

src/Factory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ class Factory implements \Kfn\Menu\Contracts\GroupedMenu
1717
private static string $name;
1818

1919
/** @var \Illuminate\Support\Fluent|null */
20-
private static Fluent|null $factory = null;
20+
private static ?Fluent $factory = null;
2121

2222
/**
2323
* @param string|null $name
2424
*/
2525
public function __construct(
26-
string|null $name = null,
26+
?string $name = null,
2727
) {
2828
static::$name = $name ?: 'main';
2929
if (! static::$factory instanceof Fluent) {
@@ -72,7 +72,7 @@ public function add(
7272
* @throws \Throwable
7373
*/
7474
public function get(
75-
string|null $groupName = null,
75+
?string $groupName = null,
7676
bool $resolvedOnly = true,
7777
): GroupedMenu|GroupItem {
7878
try {

src/FactoryX.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ class FactoryX implements \Kfn\Menu\Contracts\GroupedMenu
1616
{
1717
private static string $name;
1818
private static string $group;
19-
private static MenuItemAttribute|null $groupAttribute = null;
20-
private static Fluent|null $factory = null;
19+
private static ?MenuItemAttribute $groupAttribute = null;
20+
private static ?Fluent $factory = null;
2121
private static string $childName;
2222

2323
/**
@@ -26,8 +26,8 @@ class FactoryX implements \Kfn\Menu\Contracts\GroupedMenu
2626
* @param array $groupAttribute
2727
*/
2828
public function __construct(
29-
string|null $name = null,
30-
string|null $group = null,
29+
?string $name = null,
30+
?string $group = null,
3131
array $groupAttribute = []
3232
) {
3333
static::$name = $name ?? 'main';
@@ -89,8 +89,8 @@ public function route(
8989
string $title,
9090
array $param = [],
9191
array $attribute = [],
92-
string|null $activeRoute = null,
93-
array|null $activeRouteParam = null,
92+
?string $activeRoute = null,
93+
?array $activeRouteParam = null,
9494
Closure|bool $resolver = true,
9595
bool $hasChild = false
9696
): static {
@@ -123,8 +123,8 @@ public function url(
123123
string $title,
124124
array $param = [],
125125
array $attribute = [],
126-
string|null $activeUrl = null,
127-
array|null $activeUrlParam = null,
126+
?string $activeUrl = null,
127+
?array $activeUrlParam = null,
128128
Closure|bool $resolver = true,
129129
bool $hasChild = false
130130
): static {
@@ -159,8 +159,8 @@ public function add(
159159
string $title,
160160
array $param = [],
161161
array $attribute = [],
162-
string|null $activeName = null,
163-
array|null $activeParam = null,
162+
?string $activeName = null,
163+
?array $activeParam = null,
164164
Closure|bool $resolver = true,
165165
bool $hasChild = false
166166
): static {

src/GroupItem.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class GroupItem implements \Kfn\Menu\Contracts\GroupItem
2929
private static string $collectionName;
3030

3131
/** @var \Illuminate\Support\Fluent|null */
32-
private static Fluent|null $factory = null;
32+
private static ?Fluent $factory = null;
3333

3434
/** @var string */
3535
public string $name;
@@ -92,7 +92,7 @@ public function route(
9292
array $attribute = [],
9393
int $sort = 0,
9494
string|array|null $activeRoute = null,
95-
array|null $activeRouteParam = null,
95+
?array $activeRouteParam = null,
9696
Closure|bool $resolver = true
9797
): static {
9898
return $this->add(
@@ -127,7 +127,7 @@ public function url(
127127
array $attribute = [],
128128
int $sort = 0,
129129
string|array|null $activeUrl = null,
130-
array|null $activeUrlParam = null,
130+
?array $activeUrlParam = null,
131131
Closure|bool $resolver = true
132132
): static {
133133
return $this->add(
@@ -164,7 +164,7 @@ public function add(
164164
array $attribute = [],
165165
int $sort = 0,
166166
string|array|null $activeName = null,
167-
array|null $activeParam = null,
167+
?array $activeParam = null,
168168
Closure|bool $resolver = true
169169
): static {
170170
$factory = static::getItems();

src/MenuItem.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class MenuItem implements \Kfn\Menu\Contracts\MenuItem
2929
public string $href = '#';
3030

3131
/** @var \Kfn\Menu\MenuCollection|null */
32-
public MenuCollection|null $items = null;
32+
public ?MenuCollection $items = null;
3333

3434
/**
3535
* @param \Kfn\Menu\Enum\MenuType $type
@@ -50,7 +50,7 @@ public function __construct(
5050
array|object $attribute = [],
5151
readonly public int $sort = 0,
5252
readonly public string|array|null $activeName = null,
53-
readonly public array|null $activeParam = null,
53+
readonly public ?array $activeParam = null,
5454
readonly public \Closure|bool $resolver = true
5555
) {
5656
if (! $attribute instanceof MenuItemAttribute) {
@@ -128,7 +128,7 @@ private function getActiveStatus(string|array|null $name = '', array $params = [
128128
{
129129
$name = collect((array) $name)->flatMap(function ($nm) {
130130
$nm = preg_replace('/\s+|\h+/', '', $nm);
131-
if (!empty($nm)) {
131+
if (! empty($nm)) {
132132
return MenuType::ROUTE === $this->type ? [$nm, $nm.'.*'] : [$nm, $nm.'/*'];
133133
}
134134
});

0 commit comments

Comments
 (0)