Skip to content

Commit 594a33a

Browse files
committed
added missing typehints
1 parent ab7e0c5 commit 594a33a

File tree

8 files changed

+11
-11
lines changed

8 files changed

+11
-11
lines changed

src/DI/Compiler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function addExtension(?string $name, CompilerExtension $extension)
7171
public function getExtensions(string $type = null): array
7272
{
7373
return $type
74-
? array_filter($this->extensions, function ($item) use ($type) { return $item instanceof $type; })
74+
? array_filter($this->extensions, function ($item) use ($type): bool { return $item instanceof $type; })
7575
: $this->extensions;
7676
}
7777

src/DI/Config/Adapters/NeonAdapter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function dump(array $data): string
8080
{
8181
array_walk_recursive(
8282
$data,
83-
function (&$val) {
83+
function (&$val): void {
8484
if ($val instanceof Statement) {
8585
$val = self::statementToEntity($val);
8686
}
@@ -94,7 +94,7 @@ private static function statementToEntity(Statement $val): Neon\Entity
9494
{
9595
array_walk_recursive(
9696
$val->arguments,
97-
function (&$val) {
97+
function (&$val): void {
9898
if ($val instanceof Statement) {
9999
$val = self::statementToEntity($val);
100100
}

src/DI/ContainerBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function addDefinition(string $name, ServiceDefinition $definition = null
6262
if (!$definition) {
6363
$definition = new ServiceDefinition;
6464
}
65-
$definition->setNotifier(function () {
65+
$definition->setNotifier(function (): void {
6666
$this->autowiring->needRefresh();
6767
});
6868
return $this->definitions[$name] = $definition;
@@ -283,7 +283,7 @@ public static function literal(string $code, array $args = null): Nette\PhpGener
283283
/** @deprecated */
284284
public function formatPhp(string $statement, array $args): string
285285
{
286-
array_walk_recursive($args, function (&$val) {
286+
array_walk_recursive($args, function (&$val): void {
287287
if ($val instanceof Statement) {
288288
$val = (new ContainerResolver($this))->completeStatement($val);
289289

src/DI/Extensions/DecoratorExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function addTags(string $type, array $tags): void
6262

6363
private function findByType(string $type): array
6464
{
65-
return array_filter($this->getContainerBuilder()->getDefinitions(), function ($def) use ($type) {
65+
return array_filter($this->getContainerBuilder()->getDefinitions(), function (Nette\DI\ServiceDefinition $def) use ($type): bool {
6666
return is_a($def->getImplement(), $type, true)
6767
|| ($def->getImplementMode() !== $def::IMPLEMENT_MODE_GET && is_a($def->getType(), $type, true));
6868
});

src/DI/Extensions/InjectExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public static function getInjectMethods(string $class): array
7878
$res[$name] = (new \ReflectionMethod($class, $name))->getDeclaringClass()->getName();
7979
}
8080
}
81-
uksort($res, function ($a, $b) use ($res) {
81+
uksort($res, function ($a, $b) use ($res): int {
8282
return $res[$a] === $res[$b]
8383
? strcmp($a, $b)
8484
: (is_a($res[$a], $res[$b], true) ? 1 : -1);

src/DI/Helpers.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ public static function expand($var, array $params, $recursive = false)
8484
}
8585
}
8686
if ($php) {
87-
$res = array_filter($res, function ($val) { return $val !== ''; });
88-
$res = array_map(function ($val) { return $val instanceof PhpLiteral ? "($val)" : var_export((string) $val, true); }, $res);
87+
$res = array_filter($res, function ($val): bool { return $val !== ''; });
88+
$res = array_map(function ($val): string { return $val instanceof PhpLiteral ? "($val)" : var_export((string) $val, true); }, $res);
8989
return new PhpLiteral(implode(' . ', $res));
9090
}
9191
return implode('', $res);

src/DI/PhpGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ private function getServiceName($arg): ?string
255255
*/
256256
public function formatPhp(string $statement, array $args): string
257257
{
258-
array_walk_recursive($args, function (&$val) {
258+
array_walk_recursive($args, function (&$val): void {
259259
if ($val instanceof Statement) {
260260
$val = new PhpLiteral($this->formatStatement($val));
261261

src/DI/ServiceDefinition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ public function setInject(bool $state = true)
320320
/**
321321
* @internal
322322
*/
323-
public function setNotifier(?callable $notifier)
323+
public function setNotifier(?callable $notifier): void
324324
{
325325
$this->notifier = $notifier ?? 'pi';
326326
}

0 commit comments

Comments
 (0)