Skip to content

Commit ae5398b

Browse files
Update PHPDoc annotations for ResponseFactory class methods
- Added missing PHPDoc blocks for all methods - Improved existing documentation with better parameter and return - Added proper type hints in PHPDoc comments
1 parent 32e8014 commit ae5398b

File tree

1 file changed

+39
-3
lines changed

1 file changed

+39
-3
lines changed

src/ResponseFactory.php

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,16 @@ class ResponseFactory
3131

3232
protected $encryptHistory;
3333

34+
/***
35+
* @param string $name The name of the root view
36+
* @return void
37+
*/
3438
public function setRootView(string $name): void
3539
{
3640
$this->rootView = $name;
3741
}
3842

43+
3944
/**
4045
* @param string|array|Arrayable $key
4146
* @param mixed $value
@@ -52,6 +57,7 @@ public function share($key, $value = null): void
5257
}
5358

5459
/**
60+
* @param string|null $key
5561
* @param mixed $default
5662
* @return mixed
5763
*/
@@ -64,19 +70,27 @@ public function getShared(?string $key = null, $default = null)
6470
return $this->sharedProps;
6571
}
6672

67-
public function flushShared(): void
73+
74+
/**
75+
* @return void
76+
*/
77+
public function flushShared()
6878
{
6979
$this->sharedProps = [];
7080
}
7181

7282
/**
7383
* @param Closure|string|null $version
84+
* @return void
7485
*/
7586
public function version($version): void
7687
{
7788
$this->version = $version;
7889
}
7990

91+
/**
92+
* @return string
93+
*/
8094
public function getVersion(): string
8195
{
8296
$version = $this->version instanceof Closure
@@ -86,11 +100,18 @@ public function getVersion(): string
86100
return (string) $version;
87101
}
88102

103+
/**
104+
* @return void
105+
*/
89106
public function clearHistory(): void
90107
{
91108
session(['inertia.clear_history' => true]);
92109
}
93110

111+
/**
112+
* @param bool $encrypt
113+
* @return void
114+
*/
94115
public function encryptHistory($encrypt = true): void
95116
{
96117
$this->encryptHistory = $encrypt;
@@ -104,34 +125,48 @@ public function lazy(callable $callback): LazyProp
104125
return new LazyProp($callback);
105126
}
106127

128+
/**
129+
* @param callable $callback
130+
* @return OptionalProp
131+
*/
107132
public function optional(callable $callback): OptionalProp
108133
{
109134
return new OptionalProp($callback);
110135
}
111136

137+
/**
138+
*
139+
* @param callable $callback
140+
* @param string $group
141+
* @return DeferProp
142+
*/
112143
public function defer(callable $callback, string $group = 'default'): DeferProp
113144
{
114145
return new DeferProp($callback, $group);
115146
}
116147

117148
/**
118149
* @param mixed $value
150+
* @return MergeProp
119151
*/
120152
public function merge($value): MergeProp
121153
{
122154
return new MergeProp($value);
123155
}
124156

125157
/**
126-
* @param mixed $value
158+
* @param mixed $value
159+
* @return AlwaysProp
127160
*/
128161
public function always($value): AlwaysProp
129162
{
130163
return new AlwaysProp($value);
131164
}
132165

133166
/**
134-
* @param array|Arrayable $props
167+
* @param string $component
168+
* @param array|Arrayable $props
169+
* @return Response
135170
*/
136171
public function render(string $component, $props = []): Response
137172
{
@@ -150,6 +185,7 @@ public function render(string $component, $props = []): Response
150185

151186
/**
152187
* @param string|SymfonyRedirect $url
188+
* @return SymfonyResponse
153189
*/
154190
public function location($url): SymfonyResponse
155191
{

0 commit comments

Comments
 (0)