Skip to content

Commit 6fff37a

Browse files
committed
Use php 8 native property types
1 parent aebd7d3 commit 6fff37a

15 files changed

+33
-66
lines changed

src/AbstractMenuItemsContainer.php

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,18 @@
99
abstract class AbstractMenuItemsContainer implements IMenuItemsContainer
1010
{
1111

12-
/** @var IMenu */
13-
protected $menu;
12+
protected IMenu $menu;
1413

15-
/** @var ILinkGenerator */
16-
protected $linkGenerator;
14+
protected ILinkGenerator $linkGenerator;
1715

18-
/** @var Translator */
19-
protected $translator;
16+
protected Translator $translator;
2017

21-
/** @var IAuthorizator */
22-
protected $authorizator;
18+
protected IAuthorizator $authorizator;
2319

24-
/** @var IMenuItemFactory */
25-
protected $menuItemFactory;
20+
protected IMenuItemFactory $menuItemFactory;
2621

2722
/** @var IMenuItem[] */
28-
private $items = [];
23+
private array $items = [];
2924

3025
public function __construct(
3126
IMenu $menu,

src/Config/MenuItemAction.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
final class MenuItemAction
66
{
77

8-
/** @var string */
9-
public $target;
8+
public string $target;
109

1110
/** @var array<string, string> */
12-
public $parameters = [];
11+
public array $parameters = [];
1312

1413
/**
1514
* @param array<string, mixed> $array

src/Config/MenuVisibility.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,10 @@
55
final class MenuVisibility
66
{
77

8-
/** @var bool */
9-
public $menu = true;
8+
public bool $menu = true;
109

11-
/** @var bool */
12-
public $breadcrumbs = true;
10+
public bool $breadcrumbs = true;
1311

14-
/** @var bool */
15-
public $sitemap = true;
12+
public bool $sitemap = true;
1613

1714
}

src/Config/TemplatePaths.php

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,10 @@
77
final class TemplatePaths
88
{
99

10-
/**
11-
* @var string
12-
*/
13-
public $menu = __DIR__ . '/../UI/templates/menu.latte';
10+
public string $menu = __DIR__ . '/../UI/templates/menu.latte';
1411

15-
/**
16-
* @var string
17-
*/
18-
public $breadcrumbs = __DIR__ . '/../UI/templates/breadcrumbs.latte';
12+
public string $breadcrumbs = __DIR__ . '/../UI/templates/breadcrumbs.latte';
1913

20-
/**
21-
* @var string
22-
*/
23-
public $sitemap = __DIR__ . '/../UI/templates/sitemap.latte';
14+
public string $sitemap = __DIR__ . '/../UI/templates/sitemap.latte';
2415

2516
}

src/LinkGenerator/NetteLinkGenerator.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@
99
final class NetteLinkGenerator implements ILinkGenerator
1010
{
1111

12-
/** @var IRequest */
13-
private $httpRequest;
12+
private IRequest $httpRequest;
1413

15-
/** @var LinkGenerator */
16-
private $linkGenerator;
14+
private LinkGenerator $linkGenerator;
1715

1816
public function __construct(IRequest $httpRequest, LinkGenerator $linkGenerator)
1917
{

src/Loaders/DefaultMenuLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ final class DefaultMenuLoader implements IMenuLoader
1313
{
1414

1515
/** @var array<string, stdClass> */
16-
private $items;
16+
private array $items;
1717

1818
/**
1919
* @param array<string, stdClass> $items

src/Menu.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,13 @@
1212
final class Menu extends AbstractMenuItemsContainer implements IMenu
1313
{
1414

15-
/** @var IMenuLoader */
16-
private $loader;
15+
private IMenuLoader $loader;
1716

18-
/** @var string */
19-
private $name;
17+
private string $name;
2018

21-
/** @var TemplatePaths */
22-
private $templateConfig;
19+
private TemplatePaths $templateConfig;
2320

24-
/** @var Presenter */
25-
private $activePresenter;
21+
private Presenter $activePresenter;
2622

2723
public function __construct(
2824
ILinkGenerator $linkGenerator,

src/MenuContainer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ final class MenuContainer
66
{
77

88
/** @var IMenu[] */
9-
private $menus = [];
9+
private array $menus = [];
1010

1111
public function getMenu(string $name): IMenu
1212
{

src/MenuItem.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,16 @@ final class MenuItem extends AbstractMenuItemsContainer implements IMenuItem
1717
use MenuItemData;
1818
use MenuItemVisibility;
1919

20-
/** @var string */
21-
private $title;
20+
private string $title;
2221

23-
/** @var MenuItemAction|null */
24-
private $action;
22+
private ?MenuItemAction $action = null;
2523

26-
/** @var string|null */
27-
private $link;
24+
private ?string $link = null;
2825

29-
/** @var bool */
30-
private $active;
26+
private ?bool $active = null;
3127

3228
/** @var string[] */
33-
private $include = [];
29+
private array $include = [];
3430

3531
public function __construct(
3632
IMenu $menu,

src/Traits/MenuItemData.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ trait MenuItemData
66
{
77

88
/** @var array<string, string> */
9-
private $data = [];
9+
private array $data = [];
1010

1111
/**
1212
* @return array<string, string>

0 commit comments

Comments
 (0)