diff --git a/.travis.yml b/.travis.yml index ec57673..634a854 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,5 @@ language: php -dist: trusty - matrix: include: - php: 7.2 @@ -17,10 +15,10 @@ before_script: - composer install -n script: +- if [[ "$ANALYSIS" != 'true' ]]; then vendor/bin/phpunit ; fi - if [[ "$ANALYSIS" == 'true' ]]; then vendor/bin/phpunit --coverage-clover clover.xml ; fi -- vendor/bin/phpunit -- vendor/bin/phpcs -- vendor/bin/phpstan analyse src +- if [[ "$ANALYSIS" == 'true' ]]; then vendor/bin/phpcs ; fi +- if [[ "$ANALYSIS" == 'true' ]]; then vendor/bin/phpstan analyse src ; fi after_success: - if [[ "$ANALYSIS" == 'true' ]]; then vendor/bin/php-coveralls --coverage_clover=clover.xml -v ; fi diff --git a/composer.json b/composer.json index e1ef9c8..3241463 100644 --- a/composer.json +++ b/composer.json @@ -28,21 +28,22 @@ } ], "require": { + "php": "^7.2", + "ext-SimpleXML": "*", "ext-fileinfo": "*", "ext-json": "*", "ext-libxml": "*", - "ext-SimpleXML": "*", - "php": "^7.2", "psr/http-factory": "^1.0", "psr/http-message": "^1.0" }, "require-dev": { + "adriansuter/php-autoload-override": "v0.1-beta", + "laminas/laminas-diactoros": "^2.0", "nyholm/psr7": "^1.0", + "php-http/psr7-integration-tests": "dev-master", "phpstan/phpstan": "^0.10.3", "phpunit/phpunit": "^8.5", - "php-http/psr7-integration-tests": "dev-master", - "squizlabs/php_codesniffer": "^3.3.2", - "laminas/laminas-diactoros": "^2.0" + "squizlabs/php_codesniffer": "^3.5" }, "provide": { "psr/http-factory": "^1.0" @@ -66,5 +67,8 @@ "phpunit": "phpunit", "phpcs": "phpcs", "phpstan": "phpstan analyse src --memory-limit=-1" - } + }, + "config": { + "sort-packages": true + } } diff --git a/phpcs.xml b/phpcs.xml index 72e9907..07c6f0f 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -8,10 +8,10 @@ - + src tests - \ No newline at end of file + diff --git a/phpunit.xml.dist b/phpunit.xml.dist index d8dcc8f..71290c3 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,6 +1,6 @@ diff --git a/src/Factory/DecoratedResponseFactory.php b/src/Factory/DecoratedResponseFactory.php index 8b69d9c..1838076 100644 --- a/src/Factory/DecoratedResponseFactory.php +++ b/src/Factory/DecoratedResponseFactory.php @@ -1,4 +1,5 @@ expectException(RuntimeException::class); - $data = ['foo' => 'bar'.chr(233)]; - $this->assertEquals('bar'.chr(233), $data['foo']); + $data = ['foo' => 'bar' . chr(233)]; + $this->assertEquals('bar' . chr(233), $data['foo']); foreach ($this->factoryProviders as $factoryProvider) { /** @var Psr17FactoryProvider $provider */ diff --git a/tests/ServerRequestTest.php b/tests/ServerRequestTest.php index 27b2524..b672516 100644 --- a/tests/ServerRequestTest.php +++ b/tests/ServerRequestTest.php @@ -1,4 +1,5 @@ withHeader('Content-Type', 'application/hal+xml;charset=utf8') ->withBody($stream); - /** @var \stdClass $obj */ + /** @var stdClass $obj */ $obj = $request->getParsedBody(); $this->assertEquals('John', $obj->name); } @@ -853,7 +857,7 @@ public function testGetParsedBodyStructuredSuffixXml() ->withHeader('Content-Type', 'application/xml;charset=utf8') ->withBody($stream); - /** @var \stdClass $obj */ + /** @var stdClass $obj */ $obj = $request->getParsedBody(); $this->assertEquals('John', $obj->name); } @@ -874,7 +878,7 @@ public function testGetParsedBodyXmlWithTextXMLMediaType() ->withHeader('Content-Type', 'text/xml') ->withBody($stream); - /** @var \stdClass $obj */ + /** @var stdClass $obj */ $obj = $request->getParsedBody(); $this->assertEquals('John', $obj->name); } diff --git a/tests/TestCase.php b/tests/TestCase.php index 7d31737..19ff61a 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -1,4 +1,5 @@ [ + 'preg_split' => function (string $pattern, string $subject, int $limit = -1, int $flags = 0) { + if (isset($GLOBALS['preg_split_return'])) { + return $GLOBALS['preg_split_return']; + } -require __DIR__ . '/Assets/PhpFunctionOverrides.php'; + return preg_split($pattern, $subject, $limit, $flags); + } + ] +]);