4
4
5
5
namespace Phplrt \Source ;
6
6
7
- use Phplrt \Contracts \Source \SourceFactoryInterface ;
8
7
use Phplrt \Contracts \Source \FileInterface ;
9
8
use Phplrt \Contracts \Source \ReadableInterface ;
9
+ use Phplrt \Contracts \Source \SourceFactoryInterface ;
10
10
use Phplrt \Source \Exception \NotCreatableException ;
11
11
use Phplrt \Source \Exception \NotFoundException ;
12
12
use Phplrt \Source \Exception \NotReadableException ;
@@ -41,18 +41,21 @@ final class SourceFactory implements SourceFactoryInterface
41
41
42
42
/**
43
43
* @var non-empty-string
44
+ *
44
45
* @psalm-readonly-allow-private-mutation
45
46
*/
46
47
public string $ algo = self ::DEFAULT_HASH_ALGO ;
47
48
48
49
/**
49
50
* @var non-empty-string
51
+ *
50
52
* @psalm-readonly-allow-private-mutation
51
53
*/
52
54
public string $ temp = self ::DEFAULT_TEMP_STREAM ;
53
55
54
56
/**
55
57
* @var int<1, max>
58
+ *
56
59
* @psalm-readonly-allow-private-mutation
57
60
*/
58
61
public int $ chunkSize = self ::DEFAULT_CHUNK_SIZE ;
@@ -63,12 +66,12 @@ final class SourceFactory implements SourceFactoryInterface
63
66
private array $ providers = [];
64
67
65
68
/**
66
- * @param non-empty-string $algo Hashing algorithm for the sources.
67
- * @param non-empty-string $temp The name of the temporary stream, which is
68
- * used as a resource during the reading of the source.
69
- * @param int<1, max> $chunkSize The chunk size used while non-blocking
70
- * reading the file inside the {@see \Fiber} context.
71
- * @param list<SourceProviderInterface> $providers List of source providers.
69
+ * @param non-empty-string $algo hashing algorithm for the sources
70
+ * @param non-empty-string $temp the name of the temporary stream, which is
71
+ * used as a resource during the reading of the source
72
+ * @param int<1, max> $chunkSize the chunk size used while non-blocking
73
+ * reading the file inside the {@see \Fiber} context
74
+ * @param list<SourceProviderInterface> $providers list of source providers
72
75
*/
73
76
public function __construct (
74
77
string $ algo = self ::DEFAULT_HASH_ALGO ,
@@ -136,7 +139,7 @@ public function create($source): ReadableInterface
136
139
throw NotCreatableException::fromInvalidType ($ source );
137
140
}
138
141
139
- public function createFromString (string $ content = '' , string $ name = null ): ReadableInterface
142
+ public function createFromString (string $ content = '' , ? string $ name = null ): ReadableInterface
140
143
{
141
144
assert ($ name !== '' , 'Name must not be empty ' );
142
145
@@ -163,7 +166,7 @@ public function createFromFile(string $filename): FileInterface
163
166
/**
164
167
* @throws NotReadableException
165
168
*/
166
- public function createFromStream ($ stream , string $ name = null ): ReadableInterface
169
+ public function createFromStream ($ stream , ? string $ name = null ): ReadableInterface
167
170
{
168
171
assert ($ name !== '' , 'Name must not be empty ' );
169
172
0 commit comments