1
0
mirror of https://github.com/halaxa/json-machine.git synced 2025-01-16 20:48:17 +01:00

PHP strict types required

This commit is contained in:
Filip Halaxa 2022-02-03 21:56:47 +01:00
parent f66459a869
commit ff02dcc4b6
43 changed files with 86 additions and 3 deletions

View File

@ -14,6 +14,7 @@ return $config->setRules([
'unary_operator_spaces' => false,
'visibility_required' => false,
'php_unit_test_class_requires_covers' => true,
'declare_strict_types' => true,
])
->setFinder($finder)
;

View File

@ -11,8 +11,8 @@
"scripts": {
"tests": "build/composer-update.sh && vendor/bin/phpunit",
"tests-coverage": "build/composer-update.sh && php -d xdebug.mode=coverage vendor/bin/phpunit --coverage-clover clover.xml",
"cs-check": "build/composer-update.sh && vendor/bin/php-cs-fixer fix --dry-run --verbose",
"cs-fix": "build/composer-update.sh && vendor/bin/php-cs-fixer fix --verbose",
"cs-check": "build/composer-update.sh && vendor/bin/php-cs-fixer fix --dry-run --verbose --allow-risky=yes",
"cs-fix": "build/composer-update.sh && vendor/bin/php-cs-fixer fix --verbose --allow-risky=yes",
"performance-tests": "php -n test/performance/testPerformance.php"
},
"config": {

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
require_once __DIR__.'/../../vendor/autoload.php';
$client = new \GuzzleHttp\Client();

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
use JsonMachine\Items;
require_once __DIR__.'/../../vendor/autoload.php';

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
use JsonMachine\Items;
use Symfony\Component\HttpClient\HttpClient;
use Symfony\Contracts\HttpClient\ResponseStreamInterface;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace JsonMachine\Exception;
class InvalidArgumentException extends JsonMachineException

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace JsonMachine\Exception;
class JsonMachineException extends \Exception

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace JsonMachine\Exception;
class PathNotFoundException extends JsonMachineException

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace JsonMachine\Exception;
class SyntaxErrorException extends JsonMachineException

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace JsonMachine\Exception;
class UnexpectedEndSyntaxErrorException extends SyntaxErrorException

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace JsonMachine;
class FileChunks implements \IteratorAggregate

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace JsonMachine;
use JsonMachine\Exception\InvalidArgumentException;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace JsonMachine\JsonDecoder;
class DecodingError

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace JsonMachine\JsonDecoder;
class ErrorWrappingDecoder implements ItemDecoder

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace JsonMachine\JsonDecoder;
class ExtJsonDecoder implements ItemDecoder

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace JsonMachine\JsonDecoder;
class InvalidResult

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace JsonMachine\JsonDecoder;
interface ItemDecoder

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace JsonMachine\JsonDecoder;
class PassThruDecoder implements ItemDecoder

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace JsonMachine\JsonDecoder;
class ValidResult

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace JsonMachine;
use JsonMachine\Exception\InvalidArgumentException;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace JsonMachine;
interface PositionAware

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace JsonMachine;
use JsonMachine\Exception\InvalidArgumentException;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace JsonMachine;
class StringChunks implements \IteratorAggregate

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace JsonMachine;
use Generator;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace JsonMachine;
class TokensWithDebugging implements \IteratorAggregate, PositionAware

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace JsonMachineTest\Exception;
use JsonMachine\Exception\SyntaxErrorException;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace JsonMachineTest;
use JsonMachine\FileChunks;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace JsonMachineTest;
use JsonMachine\Exception\InvalidArgumentException;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace JsonMachineTest;
use JsonMachine\Items;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace JsonMachineTest\JsonDecoder;
use JsonMachine\JsonDecoder\DecodingError;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace JsonMachineTest\JsonDecoder;
use JsonMachine\Items;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace JsonMachineTest\JsonDecoder;
use JsonMachine\JsonDecoder\ExtJsonDecoder;
@ -51,7 +53,7 @@ class ExtJsonDecoderTest extends PHPUnit_Framework_TestCase
public function testPassesPassesBigIntOptionToJsonDecode()
{
$bigintDecoder = new ExtJsonDecoder(null, 1, JSON_BIGINT_AS_STRING);
$bigintDecoder = new ExtJsonDecoder(false, 1, JSON_BIGINT_AS_STRING);
$bigintResult = $bigintDecoder->decode('123123123123123123123');
$this->assertSame('123123123123123123123', $bigintResult->getValue());
}

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace JsonMachineTest\JsonDecoder;
use JsonMachine\JsonDecoder\InvalidResult;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace JsonMachineTest\JsonDecoder;
use JsonMachine\JsonDecoder\PassThruDecoder;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace JsonMachineTest\JsonDecoder;
use JsonMachine\JsonDecoder\ItemDecoder;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace JsonMachineTest\JsonDecoder;
use JsonMachine\JsonDecoder\ValidResult;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace JsonMachineTest;
use JsonMachine\Exception\JsonMachineException;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace JsonMachineTest;
use JsonMachine\Exception\InvalidArgumentException;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace JsonMachineTest;
use JsonMachine\StringChunks;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace JsonMachineTest;
use JsonMachine\FileChunks;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace JsonMachineTest;
use JsonMachine\Exception\InvalidArgumentException;

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
require_once __DIR__.'/../vendor/autoload.php';
if ( ! class_exists('PHPUnit_Framework_TestCase')) {

View File

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
use JsonMachine\Items;
require_once __DIR__.'/../../vendor/autoload.php';