InputStream::isClosed()
last analyzed

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 1
1
<?php
2
3
/*
4
 * This file is part of the webmozart/console package.
5
 *
6
 * (c) Bernhard Schussek <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Webmozart\Console\Api\IO;
13
14
/**
15
 * The console input stream.
16
 *
17
 * @since  1.0
18
 *
19
 * @author Bernhard Schussek <[email protected]>
20
 */
21
interface InputStream
22
{
23
    /**
24
     * Reads the given amount of characters from the stream.
25
     *
26
     * @param int $length The number of characters to read.
27
     *
28
     * @return string The characters read from the stream.
29
     *
30
     * @throws IOException If reading fails or if the stream is closed.
31
     */
32
    public function read($length);
33
34
    /**
35
     * Reads a line from the stream.
36
     *
37
     * @param int $length The maximum number of characters to read. If `null`,
0 ignored issues
show
Documentation introduced by
Should the type for parameter $length not be integer|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
38
     *                    all characters up to the first newline are returned.
39
     *
40
     * @return string The characters read from the stream.
41
     *
42
     * @throws IOException If reading fails or if the stream is closed.
43
     */
44
    public function readLine($length = null);
45
46
    /**
47
     * Closes the stream.
48
     */
49
    public function close();
0 ignored issues
show
Documentation introduced by
For interfaces and abstract methods it is generally a good practice to add a @return annotation even if it is just @return void or @return null, so that implementors know what to do in the overridden method.

For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a @return doc comment to communicate to implementors of these methods what they are expected to return.

Loading history...
50
51
    /**
52
     * Returns whether the stream is closed.
53
     *
54
     * @return bool Returns `true` if the stream is closed.
55
     */
56
    public function isClosed();
57
}
58