File tree Expand file tree Collapse file tree 3 files changed +25
-1
lines changed Expand file tree Collapse file tree 3 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 22
33All notable changes to ` phpunit-watcher ` will be documented in this file
44
5+ ## 1.2.1 - 2017-08-05
6+
7+ - throw exception if config file does not contain yml
8+
59## 1.2.0 - 2017-08-05
610
711- check parent directories for config file
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Spatie \PhpUnitWatcher \Exceptions ;
4+
5+ use Exception ;
6+
7+ class InvalidConfigfile extends Exception
8+ {
9+ public static function invalidContents (string $ path )
10+ {
11+ return new static ("The content of configfile ` {$ path }` is not valid. Make sure this file contains valid yaml. " );
12+ }
13+ }
Original file line number Diff line number Diff line change 22
33namespace Spatie \PhpUnitWatcher ;
44
5+ use Spatie \PhpUnitWatcher \Exceptions \InvalidConfigfile ;
56use Symfony \Component \Yaml \Yaml ;
67use Symfony \Component \Console \Command \Command ;
78use Symfony \Component \Console \Style \SymfonyStyle ;
@@ -48,7 +49,13 @@ protected function getOptionsFromConfigFile(): array
4849 return [];
4950 }
5051
51- return Yaml::parse (file_get_contents ($ configFile ));
52+ $ options = Yaml::parse (file_get_contents ($ configFile ));
53+
54+ if (is_null ($ options )) {
55+ throw InvalidConfigfile::invalidContents ($ configFile );
56+ }
57+
58+ return $ options ;
5259 }
5360
5461 protected function getConfigFileLocation ()
You can’t perform that action at this time.
0 commit comments