Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve containers types to use iterable objects #299

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Prev Previous commit
Next Next commit
Fix tests
  • Loading branch information
xepozz committed Dec 2, 2022
commit 0e0d1045cf8419d988b58c73be4d6bfa5d255847
2 changes: 1 addition & 1 deletion src/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ private function validateDefinitionTags(mixed $tags): void
throw new InvalidConfigException(
sprintf(
'Invalid definition: tags should be either iterable or array of strings, %s given.',
$this->getVariableType($tags)
get_debug_type($tags)
)
);
}
Expand Down
8 changes: 4 additions & 4 deletions tests/Unit/ContainerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1970,15 +1970,15 @@ public function dataInvalidTags(): array
{
return [
[
'/^Invalid tags configuration: tag should be string, 42 given\.$/',
'Invalid tags configuration: tag should be string, array given.',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That does not look right. The problem here is 42, right?

[42 => [EngineMarkTwo::class]],
],
[
'Invalid tags configuration: tag should be either iterable or array of service IDs, integer given.',
'Invalid tags configuration: tag should be either iterable or array of service IDs, int given.',
['engine' => 42],
],
[
'/^Invalid tags configuration: service should be defined as class string, (integer|int) given\.$/',
'Invalid tags configuration: service should be defined as class string, int given.',
['engine' => [42]],
],
];
Expand All @@ -1993,7 +1993,7 @@ public function testInvalidTags(string $message, array $tags): void
->withTags($tags);

$this->expectException(InvalidConfigException::class);
$this->expectExceptionMessageMatches($message);
$this->expectExceptionMessage($message);
new Container($config);
}
}