1 | <?php |
||||
2 | |||||
3 | namespace WebStream\IO\Writer; |
||||
4 | |||||
5 | use WebStream\Exception\Extend\InvalidArgumentException; |
||||
0 ignored issues
–
show
|
|||||
6 | use WebStream\Exception\Extend\IOException; |
||||
0 ignored issues
–
show
The type
WebStream\Exception\Extend\IOException was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
7 | use WebStream\IO\FileOutputStream; |
||||
8 | |||||
9 | /** |
||||
10 | * FileWriter |
||||
11 | * @author Ryuichi TANAKA. |
||||
12 | * @since 2016/02/24 |
||||
13 | * @version 0.7 |
||||
14 | */ |
||||
15 | class FileWriter extends OutputStreamWriter |
||||
16 | { |
||||
17 | /** |
||||
18 | * constructor |
||||
19 | * @param mixed $file ファイルオブジェクトまたはファイルパス |
||||
20 | * @param bool $isAppend |
||||
21 | * @param int $bufferSize |
||||
22 | * @throws IOException |
||||
23 | * @throws InvalidArgumentException |
||||
24 | */ |
||||
25 | 3 | public function __construct($file, bool $isAppend = false, int $bufferSize = 0) |
|||
26 | { |
||||
27 | 3 | parent::__construct(new FileOutputStream($file, $isAppend)); |
|||
28 | |||||
29 | // fwriteのデフォルトバッファリングサイズは8KBなので、指定無しの場合は8KBになる |
||||
30 | // また、同じストリームに対して出力を行うプロセスが複数ある場合、8KBごとに停止する |
||||
31 | // see: http://php.net/manual/ja/function.stream-set-write-buffer.php |
||||
32 | 3 | if ($bufferSize > 0 && stream_set_write_buffer($this->stream, $bufferSize) !== 0) { |
|||
0 ignored issues
–
show
$this->stream of type WebStream\IO\OutputStream is incompatible with the type resource expected by parameter $stream of stream_set_write_buffer() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
33 | throw new IOException("Failed to change the buffer size."); |
||||
34 | } |
||||
35 | } |
||||
36 | |||||
37 | /** |
||||
38 | * ファイルに書き込む |
||||
39 | * @param mixed $data 書き込みデータ |
||||
40 | */ |
||||
41 | 3 | public function write($data) |
|||
42 | { |
||||
43 | 3 | $this->stream->write($data); |
|||
44 | } |
||||
45 | } |
||||
46 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths