Conditions | 1 |
Paths | 1 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
15 | public function testFromNonMultiOperationCache() |
||
16 | { |
||
17 | /** @var DoctrineCache|\PHPUnit_Framework_MockObject_MockObject $doctrineCache */ |
||
18 | $doctrineCache = $this->createMock(DoctrineCache::class); |
||
19 | |||
20 | $exception = CacheException::fromNonMultiOperationCache($doctrineCache); |
||
|
|||
21 | |||
22 | self::assertInstanceOf(CacheException::class, $exception); |
||
23 | self::assertInstanceOf(PsrCacheException::class, $exception); |
||
24 | |||
25 | self::assertStringMatchesFormat( |
||
26 | 'The given cache %s does not support multiple operations, ' |
||
27 | . 'but you tried to use a feature that requires a multi-operation cache.', |
||
28 | $exception->getMessage() |
||
29 | ); |
||
30 | } |
||
31 | } |
||
32 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.