mirror of
https://github.com/shufflingpixels/php-io.git
synced 2026-08-15 11:48:13 +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
54
mago.toml
Normal file
54
mago.toml
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
#:schema https://mago.carthage.software/1.29.0/schema.json
|
||||
# Welcome to Mago!
|
||||
# For full documentation, see https://mago.carthage.software/tools/overview
|
||||
version = "1"
|
||||
php-version = "8.0.0"
|
||||
|
||||
[source]
|
||||
workspace = "."
|
||||
paths = ["src/"]
|
||||
includes = ["vendor"]
|
||||
excludes = []
|
||||
|
||||
[source.glob]
|
||||
literal-separator = true
|
||||
|
||||
[formatter]
|
||||
preset = "pint"
|
||||
preserve-breaking-member-access-chain = true
|
||||
preserve-breaking-member-access-chain-first-method-on-same-line = true
|
||||
preserve-breaking-argument-list = true
|
||||
preserve-breaking-array-like = true
|
||||
preserve-breaking-parameter-list = true
|
||||
preserve-breaking-attribute-list = true
|
||||
preserve-breaking-conditional-expression = true
|
||||
preserve-breaking-condition-expression = true
|
||||
preserve-redundant-logical-binary-expression-parentheses = true
|
||||
|
||||
[linter]
|
||||
integrations = ["pest"]
|
||||
|
||||
[linter.rules]
|
||||
ambiguous-function-call = { enabled = false }
|
||||
literal-named-argument = { enabled = false }
|
||||
halstead = { effort-threshold = 7000 }
|
||||
no-else-clause = { enabled = false }
|
||||
|
||||
[analyzer]
|
||||
plugins = []
|
||||
find-unused-definitions = true
|
||||
find-unused-expressions = false
|
||||
analyze-dead-code = false
|
||||
memoize-properties = true
|
||||
allow-possibly-undefined-array-keys = true
|
||||
check-throws = false
|
||||
unchecked-exceptions = ["Error", "LogicException"]
|
||||
unchecked-exception-classes = []
|
||||
check-missing-override = false
|
||||
find-unused-parameters = false
|
||||
strict-list-index-checks = false
|
||||
strict-array-index-existence = false
|
||||
allow-array-truthy-operand = false
|
||||
no-boolean-literal-comparison = false
|
||||
check-missing-type-hints = false
|
||||
register-super-globals = true
|
||||
|
|
@ -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