Skip to content

Commit

Permalink
Add missing multistate lexer constructor type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
SerafimArts committed Aug 1, 2024
1 parent 3e6bfa1 commit 5448ff2
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/Exception/NotCreatableException.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class NotCreatableException extends NotAccessibleException

protected const CODE_LAST = self::CODE_INVALID_TYPE;

public static function fromInvalidType($source): self
public static function fromInvalidType(mixed $source): self
{
$message = \vsprintf('Cannot create %s instance from %s', [
ReadableInterface::class,
Expand Down
4 changes: 2 additions & 2 deletions src/Exception/NotReadableException.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public static function fromOpeningFile(string $filename, ?\Throwable $prev = nul
/**
* @return static
*/
public static function fromInvalidResource($stream): self
public static function fromInvalidResource(mixed $stream): self
{
$message = 'The "%s" is not valid resource stream';
$message = \sprintf($message, \str_replace("\0", '\0', \get_debug_type($stream)));
Expand All @@ -94,7 +94,7 @@ public static function fromInvalidResource($stream): self
*
* @return static
*/
public static function fromInvalidStream($stream): self
public static function fromInvalidStream(mixed $stream): self
{
assert(\is_resource($stream));

Expand Down
2 changes: 1 addition & 1 deletion src/Provider/PsrStreamSourceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function __construct(SourceFactory $parent)
$this->parent = $parent;
}

public function create($source): ?ReadableInterface
public function create(mixed $source): ?ReadableInterface
{
if (!$source instanceof StreamInterface) {
return null;
Expand Down
2 changes: 1 addition & 1 deletion src/Provider/SourceProviderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ interface SourceProviderInterface
* @throws SourceExceptionInterface in case of an error in creating the
* source object
*/
public function create($source): ?ReadableInterface;
public function create(mixed $source): ?ReadableInterface;
}
2 changes: 1 addition & 1 deletion src/Provider/SplFileInfoSourceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function __construct(SourceFactory $parent)
$this->parent = $parent;
}

public function create($source): ?ReadableInterface
public function create(mixed $source): ?ReadableInterface
{
if (!$source instanceof \SplFileInfo) {
return null;
Expand Down
2 changes: 1 addition & 1 deletion src/Provider/StreamSourceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function __construct(SourceFactory $parent)
$this->parent = $parent;
}

public function create($source): ?ReadableInterface
public function create(mixed $source): ?ReadableInterface
{
if (!\is_resource($source)) {
return null;
Expand Down
2 changes: 1 addition & 1 deletion src/Provider/TextSourceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function __construct(SourceFactory $parent)
$this->parent = $parent;
}

public function create($source): ?ReadableInterface
public function create(mixed $source): ?ReadableInterface
{
if (!\is_string($source)) {
return null;
Expand Down
4 changes: 2 additions & 2 deletions src/SourceFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function withPrependedProvider(SourceProviderInterface $provider): self
return $self;
}

public function create($source): ReadableInterface
public function create(mixed $source): ReadableInterface
{
foreach ($this->providers as $provider) {
$readable = $provider->create($source);
Expand Down Expand Up @@ -166,7 +166,7 @@ public function createFromFile(string $filename): FileInterface
/**
* @throws NotReadableException
*/
public function createFromStream($stream, ?string $name = null): ReadableInterface
public function createFromStream(mixed $stream, ?string $name = null): ReadableInterface
{
assert($name !== '', 'Name must not be empty');

Expand Down
4 changes: 2 additions & 2 deletions src/SourceFactoryTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static function getSourceFactory(): SourceFactoryInterface
*
* @psalm-suppress NoValue : Allow any value
*/
public static function new($source): ReadableInterface
public static function new(mixed $source): ReadableInterface
{
if ($source instanceof StreamInterface) {
return static::fromPsrStream($source);
Expand Down Expand Up @@ -129,7 +129,7 @@ public static function fromPsrStream(StreamInterface $stream, ?string $pathname
* @return ($pathname is null ? ReadableInterface : FileInterface)
* @throws SourceExceptionInterface
*/
public static function fromResource($resource, ?string $pathname = null): ReadableInterface
public static function fromResource(mixed $resource, ?string $pathname = null): ReadableInterface
{
$factory = static::getSourceFactory();

Expand Down

0 comments on commit 5448ff2

Please sign in to comment.