It seems like $offset defined by $this->stream->tell() on line 53 can also be of type boolean; however, GuzzleHttp\Stream\StreamInterface::seek() does only seem to accept integer, maybe add an additional type check?
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:
/** * @return array|string */functionreturnsDifferentValues($x){if($x){return'foo';}returnarray();}$x=returnsDifferentValues($y);if(is_array($x)){// $x is an array.}
If this a common case that PHP Analyzer should handle natively, please let us
know by opening an issue.
Loading history...
58
59
return $data;
60
}
61
62
/**
63
* Create color profile object from filename.
64
*
65
* @param string $filename
66
*
67
* @return $this
68
*/
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'));
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.