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
7171 $ this ->consoleOutput ->getFormatter ()->setDecorated (!$ this ->commandLine ->optionNoColor ());
7272
7373 if ($ this ->commandLine ->optionInit ()) {
74- (new Creator ())->create ();
74+ (new Creator ($ this -> consoleOutput ))->create ();
7575
7676 return self ::EXIT_CODE_OK ;
7777 }
Original file line number Diff line number Diff line change 1212namespace AndreyTech \PHPUnit \Cobertura \Formatter \Config \File ;
1313
1414use RuntimeException ;
15+ use Symfony \Component \Console \Output \ConsoleOutput ;
1516
1617use function copy ;
1718use function file_exists ;
1819use function getcwd ;
1920use function sprintf ;
2021
21- final class Creator
22+ final readonly class Creator
2223{
2324 private const string CONFIG_DIR = __DIR__ . '/../../../../../../config ' ;
2425 private const string CONFIG_FILE = 'phpunit-cobertura-formatter.yml.dist ' ;
2526
27+ public function __construct (
28+ private ConsoleOutput $ consoleOutput
29+ ) {
30+ }
31+
2632 public function create (): void
2733 {
2834 $ source = sprintf ('%s/%s ' , self ::CONFIG_DIR , self ::CONFIG_FILE );
@@ -34,10 +40,14 @@ public function create(): void
3440 );
3541 }
3642
37- if (!@ copy ($ source , $ destination )) {
43+ if (!copy ($ source , $ destination )) {
3844 throw new RuntimeException (
3945 sprintf ('Failed to copy default config file to "%s". ' , $ destination )
4046 );
4147 }
48+
49+ $ this ->consoleOutput ->writeln (
50+ sprintf ('Default config file created at "%s" ' , $ destination )
51+ );
4252 }
4353}
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ public function validate(array $config): void
5656 */
5757 private function loadSchema (): array
5858 {
59- $ schema = @ file_get_contents (self ::SCHEMA_FILE );
59+ $ schema = file_get_contents (self ::SCHEMA_FILE );
6060 if (false === $ schema ) {
6161 throw new RuntimeException (
6262 sprintf ('Failed to load JSON schema file: "%s". ' , self ::SCHEMA_FILE )
You can’t perform that action at this time.
0 commit comments