File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -493,14 +493,14 @@ public function stream_lock(int $operation): bool
493493 *
494494 * @codeCoverageIgnore
495495 *
496- * @param int $option one of STREAM_OPTION_BLOCKING, STREAM_OPTION_READ_TIMEOUT, STREAM_OPTION_WRITE_BUFFER
497- * @param int $arg1 depending on option
498- * @param int $arg2 depending on option
496+ * @param int $option one of STREAM_OPTION_BLOCKING, STREAM_OPTION_READ_TIMEOUT, STREAM_OPTION_WRITE_BUFFER
497+ * @param int $arg1 depending on option
498+ * @param int|null $arg2 depending on option
499499 *
500500 * @return bool Returns TRUE on success or FALSE on failure. If option is not implemented,
501501 * FALSE should be returned.
502502 */
503- public function stream_set_option (int $ option , int $ arg1 , int $ arg2 ): bool
503+ public function stream_set_option (int $ option , int $ arg1 , ? int $ arg2 = null ): bool
504504 {
505505 if (false === $ this ->resource ) {
506506 return false ;
Original file line number Diff line number Diff line change @@ -27,6 +27,24 @@ public function testFlockWithFilePutContents(): void
2727 $ this ->assertEquals (\strlen ($ testData ), $ res );
2828 }
2929
30+ public function testSetStreamOptions (): void
31+ {
32+ $ processor = new StreamProcessor ();
33+ $ processor ->intercept ();
34+
35+ $ handle = fopen ('tests/fixtures/file_put_contents ' , 'w ' );
36+
37+ self ::assertTrue (stream_set_blocking ($ handle , true ));
38+ self ::assertFalse (stream_set_timeout ($ handle , 10 ));
39+ self ::assertFalse (stream_set_timeout ($ handle , 5 , 2 ));
40+ self ::assertSame (-1 , stream_set_write_buffer ($ handle , 0 ));
41+ self ::assertSame (0 , stream_set_read_buffer ($ handle , 0 ));
42+
43+ fclose ($ handle );
44+
45+ $ processor ->restore ();
46+ }
47+
3048 /**
3149 * @dataProvider streamOpenAppendFilterProvider
3250 */
You can’t perform that action at this time.
0 commit comments