Skip to content

Commit 60e7d2a

Browse files
committed
improved phpDoc
1 parent 8e4fd52 commit 60e7d2a

19 files changed

+66
-10
lines changed

src/Application/Helpers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public static function splitName(string $name): array
3434

3535

3636
/**
37-
* return string[]
37+
* @return array<string, class-string>
3838
*/
3939
public static function getClassesAndTraits(string $class): array
4040
{

src/Application/PresenterFactory.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
class PresenterFactory implements IPresenterFactory
2020
{
21-
/** @var array[] of module => splited mask */
21+
/** @var array<string, array{string, string, string}> module => splited mask */
2222
private array $mapping = [
2323
'*' => ['', '*Module\\', '*Presenter'],
2424
'Nette' => ['NetteModule\\', '*\\', '*Presenter'],
@@ -78,6 +78,7 @@ public function getPresenterClass(string &$name): string
7878

7979
/**
8080
* Sets mapping as pairs [module => mask]
81+
* @param array<string, string|array{string, string, string}> $mapping
8182
*/
8283
public function setMapping(array $mapping): static
8384
{
@@ -123,6 +124,7 @@ public function formatPresenterClass(string $presenter): string
123124

124125
/**
125126
* Sets pairs [alias => destination]
127+
* @param array<string, string> $aliases
126128
*/
127129
public function setAliases(array $aliases): static
128130
{

src/Application/Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* @property array $parameters
2121
* @property array $post
2222
* @property array $files
23-
* @property string|null $method
23+
* @property ?string $method
2424
*/
2525
final class Request
2626
{

src/Application/Responses/CallbackResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ final class CallbackResponse implements Nette\Application\Response
2222

2323

2424
/**
25-
* @param callable(Nette\Http\IRequest, Nette\Http\Response): void $callback
25+
* @param callable(Nette\Http\IRequest, Nette\Http\IResponse): void $callback
2626
*/
2727
public function __construct(callable $callback)
2828
{

src/Application/Routers/CliRouter.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ final class CliRouter implements Nette\Routing\Router
2222

2323

2424
public function __construct(
25+
/** @var array<string, mixed> */
2526
private readonly array $defaults = [],
2627
) {
2728
}
@@ -99,6 +100,7 @@ public function constructUrl(array $params, Nette\Http\UrlScript $refUrl): ?stri
99100

100101
/**
101102
* Returns default values.
103+
* @return array<string, mixed>
102104
*/
103105
public function getDefaults(): array
104106
{

src/Application/Routers/Route.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ public function match(Nette\Http\IRequest $httpRequest): ?array
9898

9999
/**
100100
* Constructs absolute URL from array.
101+
* @param array<string, mixed> $params
101102
*/
102103
public function constructUrl(array $params, Nette\Http\UrlScript $refUrl): ?string
103104
{
@@ -121,7 +122,10 @@ public function constructUrl(array $params, Nette\Http\UrlScript $refUrl): ?stri
121122
}
122123

123124

124-
/** @internal */
125+
/**
126+
* @return array<string, mixed>
127+
* @internal
128+
*/
125129
public function getConstantParameters(): array
126130
{
127131
$res = parent::getConstantParameters();

src/Application/Routers/RouteList.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ public function __construct(?string $module = null)
3333

3434
/**
3535
* Support for modules.
36+
* @param array<string, mixed> $params
37+
* @return ?array<string, mixed>
3638
*/
3739
protected function completeParameters(array $params): ?array
3840
{
@@ -47,6 +49,7 @@ protected function completeParameters(array $params): ?array
4749

4850
/**
4951
* Constructs absolute URL from array.
52+
* @param array<string, mixed> $params
5053
*/
5154
public function constructUrl(array $params, Nette\Http\UrlScript $refUrl): ?string
5255
{

src/Application/UI/AccessPolicy.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ private function getAttributes(): array
6363

6464

6565
/**
66-
* @param Requires[] $attrs
66+
* @param Attributes\Requires[] $attrs
67+
* @return Attributes\Requires[]
6768
*/
6869
private function applyInternalRules(array $attrs, Component $component): array
6970
{

src/Application/UI/Component.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ abstract class Component extends Nette\ComponentModel\Container implements Signa
2929

3030
/** @var array<callable(self): void> Occurs when component is attached to presenter */
3131
public array $onAnchor = [];
32+
33+
/** @var array<string, mixed> */
3234
protected array $params = [];
3335

3436

@@ -99,6 +101,7 @@ protected function validateParent(Nette\ComponentModel\IContainer $parent): void
99101

100102
/**
101103
* Calls public method if exists.
104+
* @param array<string, mixed> $params
102105
*/
103106
protected function tryCall(string $method, array $params): bool
104107
{
@@ -146,6 +149,7 @@ public static function getReflection(): ComponentReflection
146149

147150
/**
148151
* Loads state information.
152+
* @param array<string, mixed> $params
149153
*/
150154
public function loadState(array $params): void
151155
{
@@ -174,6 +178,7 @@ public function loadState(array $params): void
174178

175179
/**
176180
* Saves state information for next request.
181+
* @param array<string, mixed> $params
177182
*/
178183
public function saveState(array &$params): void
179184
{
@@ -235,6 +240,7 @@ final public function getParameter(string $name): mixed
235240

236241
/**
237242
* Returns component parameters.
243+
* @return array<string, mixed>
238244
*/
239245
final public function getParameters(): array
240246
{

src/Application/UI/ComponentReflection.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ final class ComponentReflection extends \ReflectionClass
3030

3131
/**
3232
* Returns array of class properties that are public and have attribute #[Persistent] or #[Parameter] or annotation @persistent.
33-
* @return array<string, array{def: mixed, type: string, since: ?class-string}>
33+
* @return array<string, array{def: mixed, type: string, since?: ?class-string}>
3434
*/
3535
public function getParameters(): array
3636
{
@@ -78,7 +78,7 @@ public function getParameters(): array
7878

7979
/**
8080
* Returns array of persistent properties. They are public and have attribute #[Persistent] or annotation @persistent.
81-
* @return array<string, array{def: mixed, type: string, since: class-string}>
81+
* @return array<string, array{def: mixed, type: string, since: ?class-string}>
8282
*/
8383
public function getPersistentParams(): array
8484
{
@@ -115,6 +115,9 @@ public function getPersistentComponents(): array
115115
}
116116

117117

118+
/**
119+
* @return string[] names of public properties with #[TemplateVariable] attribute
120+
*/
118121
public function getTemplateVariables(Control $control): array
119122
{
120123
$res = [];

0 commit comments

Comments
 (0)