We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Conditions | 1 |
| Paths | 1 |
| Total Lines | 19 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | public function testInvalidAlias($invalidAlias) |
||
| 18 | { |
||
| 19 | /** @var ContainerBuilder|MockObject $container */ |
||
| 20 | $container = $this->getMockBuilder(ContainerBuilder::class) |
||
| 21 | ->setMethods(['findTaggedServiceIds', 'findDefinition']) |
||
| 22 | ->getMock(); |
||
| 23 | $container->expects($this->once()) |
||
|
|
|||
| 24 | ->method('findTaggedServiceIds') |
||
| 25 | ->willReturn([ |
||
| 26 | 'my-id' => [ |
||
| 27 | ['alias' => $invalidAlias], |
||
| 28 | ], |
||
| 29 | ]); |
||
| 30 | |||
| 31 | $this->expectException(\InvalidArgumentException::class); |
||
| 32 | $this->expectExceptionMessage('Service "my-id" tagged "overblog_graphql.global_variable" should have a valid "alias" attribute.'); |
||
| 33 | |||
| 34 | (new GlobalVariablesPass())->process($container); |
||
| 35 | } |
||
| 36 | |||
| 49 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: