Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f6d0b54

Browse files
Add return types - batch 5/n
1 parent 9004e35 commit f6d0b54

File tree

151 files changed

+436
-432
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

151 files changed

+436
-432
lines changed

src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,15 @@ public function removeSubscriber(EventSubscriberInterface $subscriber)
9292
/**
9393
* {@inheritdoc}
9494
*/
95-
public function getListeners(string $eventName = null)
95+
public function getListeners(string $eventName = null): array
9696
{
9797
return $this->dispatcher->getListeners($eventName);
9898
}
9999

100100
/**
101101
* {@inheritdoc}
102102
*/
103-
public function getListenerPriority(string $eventName, callable|array $listener)
103+
public function getListenerPriority(string $eventName, callable|array $listener): ?int
104104
{
105105
// we might have wrapped listeners for the event (if called while dispatching)
106106
// in that case get the priority by wrapper
@@ -118,7 +118,7 @@ public function getListenerPriority(string $eventName, callable|array $listener)
118118
/**
119119
* {@inheritdoc}
120120
*/
121-
public function hasListeners(string $eventName = null)
121+
public function hasListeners(string $eventName = null): bool
122122
{
123123
return $this->dispatcher->hasListeners($eventName);
124124
}
@@ -166,7 +166,7 @@ public function dispatch(object $event, string $eventName = null): object
166166
/**
167167
* @return array
168168
*/
169-
public function getCalledListeners(Request $request = null)
169+
public function getCalledListeners(Request $request = null): array
170170
{
171171
if (null === $this->callStack) {
172172
return [];
@@ -187,7 +187,7 @@ public function getCalledListeners(Request $request = null)
187187
/**
188188
* @return array
189189
*/
190-
public function getNotCalledListeners(Request $request = null)
190+
public function getNotCalledListeners(Request $request = null): array
191191
{
192192
try {
193193
$allListeners = $this->getListeners();
@@ -258,7 +258,7 @@ public function reset()
258258
*
259259
* @return mixed
260260
*/
261-
public function __call(string $method, array $arguments)
261+
public function __call(string $method, array $arguments): mixed
262262
{
263263
return $this->dispatcher->{$method}(...$arguments);
264264
}

src/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class RegisterListenersPass implements CompilerPassInterface
3131
/**
3232
* @return $this
3333
*/
34-
public function setHotPathEvents(array $hotPathEvents)
34+
public function setHotPathEvents(array $hotPathEvents): static
3535
{
3636
$this->hotPathEvents = array_flip($hotPathEvents);
3737

@@ -41,7 +41,7 @@ public function setHotPathEvents(array $hotPathEvents)
4141
/**
4242
* @return $this
4343
*/
44-
public function setNoPreloadEvents(array $noPreloadEvents): self
44+
public function setNoPreloadEvents(array $noPreloadEvents): static
4545
{
4646
$this->noPreloadEvents = array_flip($noPreloadEvents);
4747

src/Symfony/Component/EventDispatcher/EventDispatcher.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function dispatch(object $event, string $eventName = null): object
6565
/**
6666
* {@inheritdoc}
6767
*/
68-
public function getListeners(string $eventName = null)
68+
public function getListeners(string $eventName = null): array
6969
{
7070
if (null !== $eventName) {
7171
if (empty($this->listeners[$eventName])) {
@@ -91,7 +91,7 @@ public function getListeners(string $eventName = null)
9191
/**
9292
* {@inheritdoc}
9393
*/
94-
public function getListenerPriority(string $eventName, callable|array $listener)
94+
public function getListenerPriority(string $eventName, callable|array $listener): ?int
9595
{
9696
if (empty($this->listeners[$eventName])) {
9797
return null;
@@ -120,7 +120,7 @@ public function getListenerPriority(string $eventName, callable|array $listener)
120120
/**
121121
* {@inheritdoc}
122122
*/
123-
public function hasListeners(string $eventName = null)
123+
public function hasListeners(string $eventName = null): bool
124124
{
125125
if (null !== $eventName) {
126126
return !empty($this->listeners[$eventName]);

src/Symfony/Component/EventDispatcher/EventDispatcherInterface.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function removeSubscriber(EventSubscriberInterface $subscriber);
5050
*
5151
* @return array The event listeners for the specified event, or all event listeners by event name
5252
*/
53-
public function getListeners(string $eventName = null);
53+
public function getListeners(string $eventName = null): array;
5454

5555
/**
5656
* Gets the listener priority for a specific event.
@@ -59,12 +59,12 @@ public function getListeners(string $eventName = null);
5959
*
6060
* @return int|null The event listener priority
6161
*/
62-
public function getListenerPriority(string $eventName, callable $listener);
62+
public function getListenerPriority(string $eventName, callable $listener): ?int;
6363

6464
/**
6565
* Checks whether an event has any registered listeners.
6666
*
6767
* @return bool true if the specified event has any listeners, false otherwise
6868
*/
69-
public function hasListeners(string $eventName = null);
69+
public function hasListeners(string $eventName = null): bool;
7070
}

src/Symfony/Component/EventDispatcher/GenericEvent.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(mixed $subject = null, array $arguments = [])
4242
*
4343
* @return mixed The observer subject
4444
*/
45-
public function getSubject()
45+
public function getSubject(): mixed
4646
{
4747
return $this->subject;
4848
}
@@ -54,7 +54,7 @@ public function getSubject()
5454
*
5555
* @throws \InvalidArgumentException if key is not found
5656
*/
57-
public function getArgument(string $key)
57+
public function getArgument(string $key): mixed
5858
{
5959
if ($this->hasArgument($key)) {
6060
return $this->arguments[$key];
@@ -68,7 +68,7 @@ public function getArgument(string $key)
6868
*
6969
* @return $this
7070
*/
71-
public function setArgument(string $key, mixed $value)
71+
public function setArgument(string $key, mixed $value): static
7272
{
7373
$this->arguments[$key] = $value;
7474

@@ -80,7 +80,7 @@ public function setArgument(string $key, mixed $value)
8080
*
8181
* @return array
8282
*/
83-
public function getArguments()
83+
public function getArguments(): array
8484
{
8585
return $this->arguments;
8686
}
@@ -90,7 +90,7 @@ public function getArguments()
9090
*
9191
* @return $this
9292
*/
93-
public function setArguments(array $args = [])
93+
public function setArguments(array $args = []): static
9494
{
9595
$this->arguments = $args;
9696

@@ -102,7 +102,7 @@ public function setArguments(array $args = [])
102102
*
103103
* @return bool
104104
*/
105-
public function hasArgument(string $key)
105+
public function hasArgument(string $key): bool
106106
{
107107
return \array_key_exists($key, $this->arguments);
108108
}

src/Symfony/Component/EventDispatcher/ImmutableEventDispatcher.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,23 +68,23 @@ public function removeSubscriber(EventSubscriberInterface $subscriber)
6868
/**
6969
* {@inheritdoc}
7070
*/
71-
public function getListeners(string $eventName = null)
71+
public function getListeners(string $eventName = null): array
7272
{
7373
return $this->dispatcher->getListeners($eventName);
7474
}
7575

7676
/**
7777
* {@inheritdoc}
7878
*/
79-
public function getListenerPriority(string $eventName, callable|array $listener)
79+
public function getListenerPriority(string $eventName, callable|array $listener): ?int
8080
{
8181
return $this->dispatcher->getListenerPriority($eventName, $listener);
8282
}
8383

8484
/**
8585
* {@inheritdoc}
8686
*/
87-
public function hasListeners(string $eventName = null)
87+
public function hasListeners(string $eventName = null): bool
8888
{
8989
return $this->dispatcher->hasListeners($eventName);
9090
}

src/Symfony/Component/ExpressionLanguage/Compiler.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function getFunction(string $name)
3838
*
3939
* @return string The PHP code
4040
*/
41-
public function getSource()
41+
public function getSource(): string
4242
{
4343
return $this->source;
4444
}
@@ -55,7 +55,7 @@ public function reset()
5555
*
5656
* @return $this
5757
*/
58-
public function compile(Node\Node $node)
58+
public function compile(Node\Node $node): static
5959
{
6060
$node->compile($this);
6161

@@ -80,7 +80,7 @@ public function subcompile(Node\Node $node)
8080
*
8181
* @return $this
8282
*/
83-
public function raw(string $string)
83+
public function raw(string $string): static
8484
{
8585
$this->source .= $string;
8686

@@ -92,7 +92,7 @@ public function raw(string $string)
9292
*
9393
* @return $this
9494
*/
95-
public function string(string $value)
95+
public function string(string $value): static
9696
{
9797
$this->source .= sprintf('"%s"', addcslashes($value, "\0\t\"\$\\"));
9898

@@ -104,7 +104,7 @@ public function string(string $value)
104104
*
105105
* @return $this
106106
*/
107-
public function repr(mixed $value)
107+
public function repr(mixed $value): static
108108
{
109109
if (\is_int($value) || \is_float($value)) {
110110
if (false !== $locale = setlocale(\LC_NUMERIC, 0)) {

src/Symfony/Component/ExpressionLanguage/ExpressionFunction.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,23 +49,23 @@ public function __construct(string $name, callable $compiler, callable $evaluato
4949
/**
5050
* @return string
5151
*/
52-
public function getName()
52+
public function getName(): string
5353
{
5454
return $this->name;
5555
}
5656

5757
/**
5858
* @return \Closure
5959
*/
60-
public function getCompiler()
60+
public function getCompiler(): \Closure
6161
{
6262
return $this->compiler;
6363
}
6464

6565
/**
6666
* @return \Closure
6767
*/
68-
public function getEvaluator()
68+
public function getEvaluator(): \Closure
6969
{
7070
return $this->evaluator;
7171
}
@@ -81,7 +81,7 @@ public function getEvaluator()
8181
* @throws \InvalidArgumentException if given PHP function name is in namespace
8282
* and expression function name is not defined
8383
*/
84-
public static function fromPhp(string $phpFunctionName, string $expressionFunctionName = null)
84+
public static function fromPhp(string $phpFunctionName, string $expressionFunctionName = null): \Symfony\Component\ExpressionLanguage\ExpressionFunction
8585
{
8686
$phpFunctionName = ltrim($phpFunctionName, '\\');
8787
if (!\function_exists($phpFunctionName)) {

src/Symfony/Component/ExpressionLanguage/ExpressionLanguage.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function __construct(CacheItemPoolInterface $cache = null, array $provide
4848
*
4949
* @return string The compiled PHP source code
5050
*/
51-
public function compile(Expression|string $expression, array $names = [])
51+
public function compile(Expression|string $expression, array $names = []): string
5252
{
5353
return $this->getCompiler()->compile($this->parse($expression, $names)->getNodes())->getSource();
5454
}
@@ -58,7 +58,7 @@ public function compile(Expression|string $expression, array $names = [])
5858
*
5959
* @return mixed The result of the evaluation of the expression
6060
*/
61-
public function evaluate(Expression|string $expression, array $values = [])
61+
public function evaluate(Expression|string $expression, array $values = []): mixed
6262
{
6363
return $this->parse($expression, array_keys($values))->getNodes()->evaluate($this->functions, $values);
6464
}
@@ -68,7 +68,7 @@ public function evaluate(Expression|string $expression, array $values = [])
6868
*
6969
* @return ParsedExpression
7070
*/
71-
public function parse(Expression|string $expression, array $names)
71+
public function parse(Expression|string $expression, array $names): ParsedExpression
7272
{
7373
if ($expression instanceof ParsedExpression) {
7474
return $expression;

src/Symfony/Component/ExpressionLanguage/Lexer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Lexer
2525
*
2626
* @throws SyntaxError
2727
*/
28-
public function tokenize(string $expression)
28+
public function tokenize(string $expression): TokenStream
2929
{
3030
$expression = str_replace(["\r", "\n", "\t", "\v", "\f"], ' ', $expression);
3131
$cursor = 0;

src/Symfony/Component/ExpressionLanguage/Parser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function __construct(array $functions)
9090
*
9191
* @throws SyntaxError
9292
*/
93-
public function parse(TokenStream $stream, array $names = [])
93+
public function parse(TokenStream $stream, array $names = []): Node\Node
9494
{
9595
$this->lint = false;
9696

src/Symfony/Component/ExpressionLanguage/Token.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function __toString(): string
5353
*
5454
* @return bool
5555
*/
56-
public function test(string $type, string $value = null)
56+
public function test(string $type, string $value = null): bool
5757
{
5858
return $this->type === $type && (null === $value || $this->value == $value);
5959
}

src/Symfony/Component/ExpressionLanguage/TokenStream.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function expect(string $type, string $value = null, string $message = nul
7070
*
7171
* @return bool
7272
*/
73-
public function isEOF()
73+
public function isEOF(): bool
7474
{
7575
return Token::EOF_TYPE === $this->current->type;
7676
}

0 commit comments

Comments
 (0)