File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 55class CommandLineParser implements CommandInterface
66{
77 private string $ parserDescriptor ;
8- private $ parser ;
8+ private mixed $ parser ;
99 private array $ args ;
1010 private string $ defaultFormat ;
1111
12- public function __construct ($ parser = null )
12+ public function __construct (mixed $ parser = null )
1313 {
1414 $ this ->parser = $ parser ;
1515 $ this ->defaultFormat = 'stylish ' ;
1616
1717 $ filename = __DIR__ . "/../docopt.txt " ;
1818 $ handler = @fopen ($ filename , 'r ' );
1919 $ filesize = filesize ($ filename );
20- $ this ->parserDescriptor = fread ($ handler , $ filesize );
20+ if (!is_null ($ handler ) && ($ filesize > 0 )) {
21+ $ fileData = fread ($ handler , $ filesize );
22+ if (is_string ($ fileData )) {
23+ $ this ->parserDescriptor = $ fileData ;
24+ }
25+ }
2126 fclose ($ handler );
2227 }
2328
You can’t perform that action at this time.
0 commit comments