1
0
mirror of https://github.com/halaxa/json-machine.git synced 2025-01-17 04:58:16 +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, 'unary_operator_spaces' => false,
'visibility_required' => false, 'visibility_required' => false,
'php_unit_test_class_requires_covers' => true, 'php_unit_test_class_requires_covers' => true,
'declare_strict_types' => true,
]) ])
->setFinder($finder) ->setFinder($finder)
; ;

View File

@ -11,8 +11,8 @@
"scripts": { "scripts": {
"tests": "build/composer-update.sh && vendor/bin/phpunit", "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", "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-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", "cs-fix": "build/composer-update.sh && vendor/bin/php-cs-fixer fix --verbose --allow-risky=yes",
"performance-tests": "php -n test/performance/testPerformance.php" "performance-tests": "php -n test/performance/testPerformance.php"
}, },
"config": { "config": {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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