Skip to content

Commit 5448ff2

Browse files
committed
Add missing multistate lexer constructor type hints
1 parent 3e6bfa1 commit 5448ff2

9 files changed

+12
-12
lines changed

src/Exception/NotCreatableException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class NotCreatableException extends NotAccessibleException
1818

1919
protected const CODE_LAST = self::CODE_INVALID_TYPE;
2020

21-
public static function fromInvalidType($source): self
21+
public static function fromInvalidType(mixed $source): self
2222
{
2323
$message = \vsprintf('Cannot create %s instance from %s', [
2424
ReadableInterface::class,

src/Exception/NotReadableException.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public static function fromOpeningFile(string $filename, ?\Throwable $prev = nul
8181
/**
8282
* @return static
8383
*/
84-
public static function fromInvalidResource($stream): self
84+
public static function fromInvalidResource(mixed $stream): self
8585
{
8686
$message = 'The "%s" is not valid resource stream';
8787
$message = \sprintf($message, \str_replace("\0", '\0', \get_debug_type($stream)));
@@ -94,7 +94,7 @@ public static function fromInvalidResource($stream): self
9494
*
9595
* @return static
9696
*/
97-
public static function fromInvalidStream($stream): self
97+
public static function fromInvalidStream(mixed $stream): self
9898
{
9999
assert(\is_resource($stream));
100100

src/Provider/PsrStreamSourceProvider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function __construct(SourceFactory $parent)
2020
$this->parent = $parent;
2121
}
2222

23-
public function create($source): ?ReadableInterface
23+
public function create(mixed $source): ?ReadableInterface
2424
{
2525
if (!$source instanceof StreamInterface) {
2626
return null;

src/Provider/SourceProviderInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ interface SourceProviderInterface
1818
* @throws SourceExceptionInterface in case of an error in creating the
1919
* source object
2020
*/
21-
public function create($source): ?ReadableInterface;
21+
public function create(mixed $source): ?ReadableInterface;
2222
}

src/Provider/SplFileInfoSourceProvider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function __construct(SourceFactory $parent)
1919
$this->parent = $parent;
2020
}
2121

22-
public function create($source): ?ReadableInterface
22+
public function create(mixed $source): ?ReadableInterface
2323
{
2424
if (!$source instanceof \SplFileInfo) {
2525
return null;

src/Provider/StreamSourceProvider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function __construct(SourceFactory $parent)
1919
$this->parent = $parent;
2020
}
2121

22-
public function create($source): ?ReadableInterface
22+
public function create(mixed $source): ?ReadableInterface
2323
{
2424
if (!\is_resource($source)) {
2525
return null;

src/Provider/TextSourceProvider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function __construct(SourceFactory $parent)
1919
$this->parent = $parent;
2020
}
2121

22-
public function create($source): ?ReadableInterface
22+
public function create(mixed $source): ?ReadableInterface
2323
{
2424
if (!\is_string($source)) {
2525
return null;

src/SourceFactory.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public function withPrependedProvider(SourceProviderInterface $provider): self
122122
return $self;
123123
}
124124

125-
public function create($source): ReadableInterface
125+
public function create(mixed $source): ReadableInterface
126126
{
127127
foreach ($this->providers as $provider) {
128128
$readable = $provider->create($source);
@@ -166,7 +166,7 @@ public function createFromFile(string $filename): FileInterface
166166
/**
167167
* @throws NotReadableException
168168
*/
169-
public function createFromStream($stream, ?string $name = null): ReadableInterface
169+
public function createFromStream(mixed $stream, ?string $name = null): ReadableInterface
170170
{
171171
assert($name !== '', 'Name must not be empty');
172172

src/SourceFactoryTrait.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public static function getSourceFactory(): SourceFactoryInterface
3535
*
3636
* @psalm-suppress NoValue : Allow any value
3737
*/
38-
public static function new($source): ReadableInterface
38+
public static function new(mixed $source): ReadableInterface
3939
{
4040
if ($source instanceof StreamInterface) {
4141
return static::fromPsrStream($source);
@@ -129,7 +129,7 @@ public static function fromPsrStream(StreamInterface $stream, ?string $pathname
129129
* @return ($pathname is null ? ReadableInterface : FileInterface)
130130
* @throws SourceExceptionInterface
131131
*/
132-
public static function fromResource($resource, ?string $pathname = null): ReadableInterface
132+
public static function fromResource(mixed $resource, ?string $pathname = null): ReadableInterface
133133
{
134134
$factory = static::getSourceFactory();
135135

0 commit comments

Comments
 (0)