Skip to content

Commit 8a6db9d

Browse files
committed
improved PHPDoc descriptions
1 parent c18169f commit 8a6db9d

15 files changed

Lines changed: 41 additions & 32 deletions

src/Application/Application.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function __construct(
5858

5959

6060
/**
61-
* Dispatch a HTTP request to a front controller.
61+
* Dispatches an HTTP request to a front controller.
6262
*/
6363
public function run(): void
6464
{
@@ -87,6 +87,10 @@ public function run(): void
8787
}
8888

8989

90+
/**
91+
* Creates request from the current HTTP request via router.
92+
* @throws BadRequestException
93+
*/
9094
public function createInitialRequest(): Request
9195
{
9296
$params = $this->router->match($this->httpRequest);
@@ -111,6 +115,9 @@ public function createInitialRequest(): Request
111115
}
112116

113117

118+
/**
119+
* Processes a presenter request and dispatches the response.
120+
*/
114121
public function processRequest(Request $request): void
115122
{
116123
process:
@@ -150,6 +157,9 @@ public function processRequest(Request $request): void
150157
}
151158

152159

160+
/**
161+
* Creates a forward request to the error presenter, or returns null if not configured.
162+
*/
153163
public function createErrorRequest(\Throwable $e): ?Request
154164
{
155165
$errorPresenter = $e instanceof BadRequestException
@@ -207,18 +217,12 @@ final public function getPresenter(): ?IPresenter
207217
/********************* services ****************d*g**/
208218

209219

210-
/**
211-
* Returns router.
212-
*/
213220
public function getRouter(): Router
214221
{
215222
return $this->router;
216223
}
217224

218225

219-
/**
220-
* Returns presenter factory.
221-
*/
222226
public function getPresenterFactory(): IPresenterFactory
223227
{
224228
return $this->presenterFactory;

src/Application/Helpers.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public static function splitName(string $name): array
3232

3333

3434
/**
35+
* Returns all classes, parent classes, and traits used by the given class, keyed by name.
3536
* @return array<string, class-string>
3637
*/
3738
public static function getClassesAndTraits(string $class): array

src/Application/MicroPresenter.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ public function __construct(
3232
}
3333

3434

35-
/**
36-
* Gets the context.
37-
*/
3835
public function getContext(): ?Nette\DI\Container
3936
{
4037
return $this->context;
@@ -107,7 +104,7 @@ public function run(Application\Request $request): Application\Response
107104

108105

109106
/**
110-
* Template factory.
107+
* Creates a template instance with default variables pre-populated.
111108
* @param ?callable(): Latte\Engine $latteFactory
112109
*/
113110
public function createTemplate(?string $class = null, ?callable $latteFactory = null): Application\UI\Template

src/Application/PresenterFactory.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ public function setAliases(array $aliases): static
136136
}
137137

138138

139+
/**
140+
* Returns the destination registered under the given alias, or throws if not found.
141+
*/
139142
public function getAlias(string $alias): string
140143
{
141144
return $this->aliases[$alias] ?? throw new Nette\InvalidStateException("Link alias '$alias' was not found.");

src/Application/Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function setPresenterName(string $name): static
6060

6161

6262
/**
63-
* Retrieve the presenter name.
63+
* Returns the presenter name.
6464
*/
6565
public function getPresenterName(): string
6666
{

src/Application/Responses/JsonResponse.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ public function getPayload(): mixed
2828
}
2929

3030

31-
/**
32-
* Returns the MIME content type of a downloaded file.
33-
*/
3431
public function getContentType(): string
3532
{
3633
return $this->contentType;

src/Application/Routers/RouteList.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ public function addRoute(
7777
}
7878

7979

80+
/**
81+
* Creates a sub-router scoped to the given module and attaches it to this list.
82+
*/
8083
public function withModule(string $module): static
8184
{
8285
$router = new static;

src/Application/UI/Component.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ abstract class Component extends Nette\ComponentModel\Container implements Signa
3434

3535

3636
/**
37-
* Returns the presenter where this component belongs to.
37+
* Returns the presenter where this component belongs to. Throws if not attached.
3838
*/
3939
public function getPresenter(): ?Presenter
4040
{
@@ -48,7 +48,7 @@ public function getPresenter(): ?Presenter
4848

4949

5050
/**
51-
* Returns the presenter where this component belongs to.
51+
* Returns the presenter where this component belongs to, or null if not attached.
5252
*/
5353
public function getPresenterIfExists(): ?Presenter
5454
{

src/Application/UI/Form.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ class Form extends Nette\Forms\Form implements SignalReceiver
2020
public array $onAnchor = [];
2121

2222

23-
/**
24-
* Application form constructor.
25-
*/
2623
public function __construct(?Nette\ComponentModel\IContainer $parent = null, ?string $name = null)
2724
{
2825
parent::__construct();
@@ -58,7 +55,7 @@ protected function validateParent(Nette\ComponentModel\IContainer $parent): void
5855

5956

6057
/**
61-
* Returns the presenter where this component belongs to.
58+
* Returns the presenter where this component belongs to. Throws if not attached.
6259
*/
6360
final public function getPresenter(): ?Presenter
6461
{
@@ -72,7 +69,7 @@ final public function getPresenter(): ?Presenter
7269

7370

7471
/**
75-
* Returns the presenter where this component belongs to.
72+
* Returns the presenter where this component belongs to, or null if not attached.
7673
*/
7774
final public function getPresenterIfExists(): ?Presenter
7875
{

src/Application/UI/ParameterConverter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public static function toArguments(\ReflectionFunctionAbstract $method, array $a
6464
* Converts list of arguments to named parameters & check types.
6565
* @param mixed[] $args
6666
* @param array<string, mixed> $supplemental
67-
* @param \ReflectionParameter[] $missing arguments
67+
* @param \ReflectionParameter[]|null $missing collects parameters with missing values
6868
* @throws InvalidLinkException
6969
* @internal
7070
*/

0 commit comments

Comments
 (0)