File tree Expand file tree Collapse file tree 3 files changed +14
-4
lines changed
src/PHPUnit/Cobertura/Formatter Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ private function doRun(): int
71
71
$ this ->consoleOutput ->getFormatter ()->setDecorated (!$ this ->commandLine ->optionNoColor ());
72
72
73
73
if ($ this ->commandLine ->optionInit ()) {
74
- (new Creator ())->create ();
74
+ (new Creator ($ this -> consoleOutput ))->create ();
75
75
76
76
return self ::EXIT_CODE_OK ;
77
77
}
Original file line number Diff line number Diff line change 12
12
namespace AndreyTech \PHPUnit \Cobertura \Formatter \Config \File ;
13
13
14
14
use RuntimeException ;
15
+ use Symfony \Component \Console \Output \ConsoleOutput ;
15
16
16
17
use function copy ;
17
18
use function file_exists ;
18
19
use function getcwd ;
19
20
use function sprintf ;
20
21
21
- final class Creator
22
+ final readonly class Creator
22
23
{
23
24
private const string CONFIG_DIR = __DIR__ . '/../../../../../../config ' ;
24
25
private const string CONFIG_FILE = 'phpunit-cobertura-formatter.yml.dist ' ;
25
26
27
+ public function __construct (
28
+ private ConsoleOutput $ consoleOutput
29
+ ) {
30
+ }
31
+
26
32
public function create (): void
27
33
{
28
34
$ source = sprintf ('%s/%s ' , self ::CONFIG_DIR , self ::CONFIG_FILE );
@@ -34,10 +40,14 @@ public function create(): void
34
40
);
35
41
}
36
42
37
- if (!@ copy ($ source , $ destination )) {
43
+ if (!copy ($ source , $ destination )) {
38
44
throw new RuntimeException (
39
45
sprintf ('Failed to copy default config file to "%s". ' , $ destination )
40
46
);
41
47
}
48
+
49
+ $ this ->consoleOutput ->writeln (
50
+ sprintf ('Default config file created at "%s" ' , $ destination )
51
+ );
42
52
}
43
53
}
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ public function validate(array $config): void
56
56
*/
57
57
private function loadSchema (): array
58
58
{
59
- $ schema = @ file_get_contents (self ::SCHEMA_FILE );
59
+ $ schema = file_get_contents (self ::SCHEMA_FILE );
60
60
if (false === $ schema ) {
61
61
throw new RuntimeException (
62
62
sprintf ('Failed to load JSON schema file: "%s". ' , self ::SCHEMA_FILE )
You can’t perform that action at this time.
0 commit comments