Skip to content

Commit 9e17fe3

Browse files
Add method for querying where the cache writes its files
1 parent 0bc0140 commit 9e17fe3

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

ChangeLog.md

+7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
44

5+
## [9.1.1] - 2020-08-10
6+
7+
### Added
8+
9+
* Added `SebastianBergmann\CodeCoverage::cacheDirectory()` method for querying where the cache writes its files
10+
511
## [9.1.0] - 2020-08-10
612

713
### Added
@@ -195,6 +201,7 @@ All notable changes are documented in this file using the [Keep a CHANGELOG](htt
195201
* Class names are now abbreviated (unqualified name shown, fully qualified name shown on hover) in the file view of the HTML report
196202
* Update HTML report to Bootstrap 4
197203

204+
[9.1.1]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.1.0...9.1.1
198205
[9.1.0]: https://github.com/sebastianbergmann/php-code-coverage/compare/9.0.0...9.1.0
199206
[9.0.0]: https://github.com/sebastianbergmann/php-code-coverage/compare/8.0...9.0.0
200207
[8.0.2]: https://github.com/sebastianbergmann/php-code-coverage/compare/8.0.1...8.0.2

src/CodeCoverage.php

+14
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,20 @@ public function doNotCacheStaticAnalysis(): void
394394
$this->cacheDirectory = null;
395395
}
396396

397+
/**
398+
* @throws StaticAnalysisCacheNotConfiguredException
399+
*/
400+
public function cacheDirectory(): string
401+
{
402+
if (!$this->cachesStaticAnalysis()) {
403+
throw new StaticAnalysisCacheNotConfiguredException(
404+
'The static analysis cache is not configured'
405+
);
406+
}
407+
408+
return $this->cacheDirectory;
409+
}
410+
397411
/**
398412
* @psalm-param class-string $className
399413
*/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php declare(strict_types=1);
2+
/*
3+
* This file is part of phpunit/php-code-coverage.
4+
*
5+
* (c) Sebastian Bergmann <[email protected]>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
namespace SebastianBergmann\CodeCoverage;
11+
12+
use RuntimeException;
13+
14+
final class StaticAnalysisCacheNotConfiguredException extends RuntimeException implements Exception
15+
{
16+
}

0 commit comments

Comments
 (0)