Skip to content

Commit e6c8d51

Browse files
committed
Move some @throws phpdocs where they belong
1 parent b1d2a9c commit e6c8d51

File tree

4 files changed

+16
-23
lines changed

4 files changed

+16
-23
lines changed

src/Environment.php

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -323,10 +323,6 @@ public function getTemplateClass(string $name, ?int $index = null): string
323323
* Renders a template.
324324
*
325325
* @param string|TemplateWrapper $name The template name
326-
*
327-
* @throws LoaderError When the template cannot be found
328-
* @throws SyntaxError When an error occurred during compilation
329-
* @throws RuntimeError When an error occurred during rendering
330326
*/
331327
public function render($name, array $context = []): string
332328
{
@@ -337,10 +333,6 @@ public function render($name, array $context = []): string
337333
* Displays a template.
338334
*
339335
* @param string|TemplateWrapper $name The template name
340-
*
341-
* @throws LoaderError When the template cannot be found
342-
* @throws SyntaxError When an error occurred during compilation
343-
* @throws RuntimeError When an error occurred during rendering
344336
*/
345337
public function display($name, array $context = []): void
346338
{
@@ -351,10 +343,6 @@ public function display($name, array $context = []): void
351343
* Loads a template.
352344
*
353345
* @param string|TemplateWrapper $name The template name
354-
*
355-
* @throws LoaderError When the template cannot be found
356-
* @throws RuntimeError When a previously generated cache is corrupted
357-
* @throws SyntaxError When an error occurred during compilation
358346
*/
359347
public function load($name): TemplateWrapper
360348
{
@@ -379,9 +367,7 @@ public function load($name): TemplateWrapper
379367
* @param string $name The template name
380368
* @param int|null $index The index if it is an embedded template
381369
*
382-
* @throws LoaderError When the template cannot be found
383370
* @throws RuntimeError When a previously generated cache is corrupted
384-
* @throws SyntaxError When an error occurred during compilation
385371
*
386372
* @internal
387373
*/
@@ -438,9 +424,6 @@ public function loadTemplate(string $cls, string $name, ?int $index = null): Tem
438424
*
439425
* @param string $template The template source
440426
* @param string|null $name An optional name of the template to be used in error messages
441-
*
442-
* @throws LoaderError When the template cannot be found
443-
* @throws SyntaxError When an error occurred during compilation
444427
*/
445428
public function createTemplate(string $template, ?string $name = null): TemplateWrapper
446429
{
@@ -487,7 +470,6 @@ public function isTemplateFresh(string $name, int $time): bool
487470
* @param string|TemplateWrapper|array<string|TemplateWrapper> $names A template or an array of templates to try consecutively
488471
*
489472
* @throws LoaderError When none of the templates can be found
490-
* @throws SyntaxError When an error occurred during compilation
491473
*/
492474
public function resolveTemplate($names): TemplateWrapper
493475
{
@@ -524,9 +506,6 @@ public function setLexer(Lexer $lexer)
524506
$this->lexer = $lexer;
525507
}
526508

527-
/**
528-
* @throws SyntaxError When the code is syntactically wrong
529-
*/
530509
public function tokenize(Source $source): TokenStream
531510
{
532511
if (null === $this->lexer) {
@@ -546,8 +525,6 @@ public function setParser(Parser $parser)
546525

547526
/**
548527
* Converts a token stream to a node tree.
549-
*
550-
* @throws SyntaxError When the token stream is syntactically or semantically wrong
551528
*/
552529
public function parse(TokenStream $stream): ModuleNode
553530
{

src/Lexer.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ private function initialize(): void
181181
$this->isInitialized = true;
182182
}
183183

184+
/**
185+
* @throws SyntaxError When the code is syntactically wrong
186+
*/
184187
public function tokenize(Source $source): TokenStream
185188
{
186189
$this->initialize();

src/Parser.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ public function getVarName(): string
7676
return \sprintf('__internal_parse_%d', $this->varNameSalt++);
7777
}
7878

79+
/**
80+
* @throws SyntaxError When the token stream is syntactically or semantically wrong
81+
*/
7982
public function parse(TokenStream $stream, $test = null, bool $dropNeedle = false): ModuleNode
8083
{
8184
$vars = get_object_vars($this);

src/Template.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,13 +353,23 @@ public function getBlocks(): array
353353
return $this->blocks;
354354
}
355355

356+
/**
357+
* @throws LoaderError When the template cannot be found
358+
* @throws SyntaxError When an error occurred during compilation
359+
* @throws RuntimeError When an error occurred during rendering
360+
*/
356361
public function display(array $context, array $blocks = []): void
357362
{
358363
foreach ($this->yield($context, $blocks) as $data) {
359364
echo $data;
360365
}
361366
}
362367

368+
/**
369+
* @throws LoaderError When the template cannot be found
370+
* @throws SyntaxError When an error occurred during compilation
371+
* @throws RuntimeError When an error occurred during rendering
372+
*/
363373
public function render(array $context): string
364374
{
365375
if (!$this->useYield) {

0 commit comments

Comments
 (0)