mirror of
https://github.com/shufflingpixels/php-io.git
synced 2026-10-20 06:56:46 +02:00
Add Mago config and strict types
This commit is contained in:
parent
f669183060
commit
08c67dfa19
9 changed files with 83 additions and 7 deletions
|
|
@ -1,5 +1,8 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
namespace Shufflingpixels\IO;
|
||||
|
||||
use InvalidArgumentException;
|
||||
|
|
@ -93,14 +96,14 @@ class BinaryReader
|
|||
{
|
||||
$value = $this->readUInt16LE();
|
||||
|
||||
return $value >= 0x8000 ? $value - 0x10000 : $value;
|
||||
return $value >= 0x8000 ? $value - 0x1_0000 : $value;
|
||||
}
|
||||
|
||||
public function readInt16BE(): int
|
||||
{
|
||||
$value = $this->readUInt16BE();
|
||||
|
||||
return $value >= 0x8000 ? $value - 0x10000 : $value;
|
||||
return $value >= 0x8000 ? $value - 0x1_0000 : $value;
|
||||
}
|
||||
|
||||
public function readUInt32LE(): int
|
||||
|
|
@ -117,13 +120,13 @@ class BinaryReader
|
|||
{
|
||||
$value = $this->readUInt32LE();
|
||||
|
||||
return $value >= 0x80000000 ? $value - 0x100000000 : $value;
|
||||
return $value >= 0x8000_0000 ? $value - 0x1_0000_0000 : $value;
|
||||
}
|
||||
|
||||
public function readInt32BE(): int
|
||||
{
|
||||
$value = $this->readUInt32BE();
|
||||
|
||||
return $value >= 0x80000000 ? $value - 0x100000000 : $value;
|
||||
return $value >= 0x8000_0000 ? $value - 0x1_0000_0000 : $value;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
namespace Shufflingpixels\IO;
|
||||
|
||||
use InvalidArgumentException;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
namespace Shufflingpixels\IO\Exception;
|
||||
|
||||
class EndOfStreamException extends IOException
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
namespace Shufflingpixels\IO\Exception;
|
||||
|
||||
class IOException extends \Exception
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
namespace Shufflingpixels\IO;
|
||||
|
||||
use Shufflingpixels\IO\Exception\IOException;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
namespace Shufflingpixels\IO;
|
||||
|
||||
enum FileMode : string
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
namespace Shufflingpixels\IO;
|
||||
|
||||
use InvalidArgumentException;
|
||||
|
|
@ -8,9 +11,7 @@ use Psr\Http\Message\StreamInterface;
|
|||
use RuntimeException;
|
||||
use Shufflingpixels\IO\Exception\IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
class LimitedResource implements StreamInterface
|
||||
{
|
||||
private int $position = 0;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
namespace Shufflingpixels\IO;
|
||||
|
||||
use Psr\Http\Message\StreamInterface;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue