Skip to content

Commit c6cc7e0

Browse files
committed
Type hints and consistency
1 parent 1c8931e commit c6cc7e0

File tree

2 files changed

+70
-33
lines changed

2 files changed

+70
-33
lines changed

src/Facades/Menu.php

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,46 @@
33
namespace Native\Laravel\Facades;
44

55
use Illuminate\Support\Facades\Facade;
6+
use Native\Laravel\Menu\Items\Checkbox;
7+
use Native\Laravel\Menu\Items\GoToUrl;
8+
use Native\Laravel\Menu\Items\Label;
9+
use Native\Laravel\Menu\Items\Link;
10+
use Native\Laravel\Menu\Items\Radio;
11+
use Native\Laravel\Menu\Items\Role;
12+
use Native\Laravel\Menu\Items\Separator;
613

714
/**
8-
* @method static void create()
15+
* @method static \Native\Laravel\Menu\Menu make(MenuItem ...$items)
16+
* @method static Checkbox checkbox(string $label, bool $checked = false, ?string $hotkey = null)
17+
* @method static GoToLink goToUrl(string $url, string $label = null, ?string $hotkey = null)
18+
* @method static GoToLink goToRoute(string $url, string $label = null, ?string $hotkey = null)
19+
* @method static Label label(string $label)
20+
* @method static Link link(string $url, string $label = null, ?string $hotkey = null)
21+
* @method static Radio radio(string $label, bool $checked = false, ?string $hotkey = null)
22+
* @method static Role app()
23+
* @method static Role file()
24+
* @method static Role edit()
25+
* @method static Role view()
26+
* @method static Role window()
27+
* @method static Role help()
28+
* @method static Role window()
29+
* @method static Role fullscreen()
30+
* @method static Role separator()
31+
* @method static Role devTools()
32+
* @method static Role undo()
33+
* @method static Role redo()
34+
* @method static Role cut()
35+
* @method static Role copy()
36+
* @method static Role paste()
37+
* @method static Role pasteAndMatchStyle()
38+
* @method static Role reload()
39+
* @method static Role minimize()
40+
* @method static Role close()
41+
* @method static Role quit()
42+
* @method static Role help()
43+
* @method static Role hide()
44+
* @method static void create(MenuItem ...$items)
45+
* @method static void default()
946
*/
1047
class Menu extends Facade
1148
{

src/Menu/MenuBuilder.php

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -74,22 +74,22 @@ public function app(): Items\Role
7474
return new Items\Role(RolesEnum::APP_MENU);
7575
}
7676

77-
public function file($label = 'File'): Items\Role
77+
public function file(?string $label = null): Items\Role
7878
{
7979
return new Items\Role(RolesEnum::FILE_MENU, $label);
8080
}
8181

82-
public function edit($label = 'Edit'): Items\Role
82+
public function edit(?string $label = null): Items\Role
8383
{
8484
return new Items\Role(RolesEnum::EDIT_MENU, $label);
8585
}
8686

87-
public function view($label = 'View'): Items\Role
87+
public function view(?string $label = null): Items\Role
8888
{
8989
return new Items\Role(RolesEnum::VIEW_MENU, $label);
9090
}
9191

92-
public function window($label = 'Window'): Items\Role
92+
public function window(?string $label = null): Items\Role
9393
{
9494
return new Items\Role(RolesEnum::WINDOW_MENU, $label);
9595
}
@@ -99,73 +99,73 @@ public function separator(): Items\Separator
9999
return new Items\Separator;
100100
}
101101

102-
public function fullscreen(): Items\Role
102+
public function fullscreen(?string $label = null): Items\Role
103103
{
104-
return new Items\Role(RolesEnum::TOGGLE_FULL_SCREEN);
104+
return new Items\Role(RolesEnum::TOGGLE_FULL_SCREEN, $label);
105105
}
106106

107-
public function devTools(): Items\Role
107+
public function devTools(?string $label = null): Items\Role
108108
{
109-
return new Items\Role(RolesEnum::TOGGLE_DEV_TOOLS);
109+
return new Items\Role(RolesEnum::TOGGLE_DEV_TOOLS, $label);
110110
}
111111

112-
public function undo(): Items\Role
112+
public function undo(?string $label = null): Items\Role
113113
{
114-
return new Items\Role(RolesEnum::UNDO);
114+
return new Items\Role(RolesEnum::UNDO, $label);
115115
}
116116

117-
public function redo(): Items\Role
117+
public function redo(?string $label = null): Items\Role
118118
{
119-
return new Items\Role(RolesEnum::REDO);
119+
return new Items\Role(RolesEnum::REDO, $label);
120120
}
121121

122-
public function cut(): Items\Role
122+
public function cut(?string $label = null): Items\Role
123123
{
124-
return new Items\Role(RolesEnum::CUT);
124+
return new Items\Role(RolesEnum::CUT, $label);
125125
}
126126

127-
public function copy(): Items\Role
127+
public function copy(?string $label = null): Items\Role
128128
{
129-
return new Items\Role(RolesEnum::COPY);
129+
return new Items\Role(RolesEnum::COPY, $label);
130130
}
131131

132-
public function paste(): Items\Role
132+
public function paste(?string $label = null): Items\Role
133133
{
134-
return new Items\Role(RolesEnum::PASTE);
134+
return new Items\Role(RolesEnum::PASTE, $label);
135135
}
136136

137-
public function pasteAndMatchStyle(): Items\Role
137+
public function pasteAndMatchStyle(?string $label = null): Items\Role
138138
{
139-
return new Items\Role(RolesEnum::PASTE_STYLE);
139+
return new Items\Role(RolesEnum::PASTE_STYLE, $label);
140140
}
141141

142-
public function reload(): Items\Role
142+
public function reload(?string $label = null): Items\Role
143143
{
144-
return new Items\Role(RolesEnum::RELOAD);
144+
return new Items\Role(RolesEnum::RELOAD, $label);
145145
}
146146

147-
public function minimize(): Items\Role
147+
public function minimize(?string $label = null): Items\Role
148148
{
149-
return new Items\Role(RolesEnum::MINIMIZE);
149+
return new Items\Role(RolesEnum::MINIMIZE, $label);
150150
}
151151

152-
public function close(): Items\Role
152+
public function close(?string $label = null): Items\Role
153153
{
154-
return new Items\Role(RolesEnum::PASTE_STYLE);
154+
return new Items\Role(RolesEnum::CLOSE, $label);
155155
}
156156

157-
public function quit(): Items\Role
157+
public function quit(?string $label = null): Items\Role
158158
{
159-
return new Items\Role(RolesEnum::QUIT);
159+
return new Items\Role(RolesEnum::QUIT, $label);
160160
}
161161

162-
public function help(): Items\Role
162+
public function help(?string $label = null): Items\Role
163163
{
164-
return new Items\Role(RolesEnum::HELP);
164+
return new Items\Role(RolesEnum::HELP, $label);
165165
}
166166

167-
public function hide(): Items\Role
167+
public function hide(?string $label = null): Items\Role
168168
{
169-
return new Items\Role(RolesEnum::HIDE);
169+
return new Items\Role(RolesEnum::HIDE, $label);
170170
}
171171
}

0 commit comments

Comments
 (0)