| Conditions | 4 |
| Paths | 2 |
| Total Lines | 8 |
| Code Lines | 4 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 69 | public static function fromFilename($filename) |
||
| 70 | { |
||
| 71 | if (!file_exists($filename) || !is_file($filename) || !is_readable($filename)) { |
||
| 72 | throw new RuntimeException(sprintf('Filename %s is an invalid profile file or is not readable', $filename)); |
||
| 73 | } |
||
| 74 | |||
| 75 | return new static(StreamUtils::open($filename, 'r')); |
||
| 76 | } |
||
| 77 | } |
||
| 78 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.