Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Drop support for EOL PHP versions #164

Merged
merged 9 commits into from
Nov 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 9 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,13 @@ cache:
- $HOME/.composer/cache

php:
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3
- 7.4
- nightly

env:
global:
- LATEST_PHP_VERSION="7.3"
- LATEST_PHP_VERSION="7.4"
matrix:
- DEPENDENCIES="beta"
- DEPENDENCIES="low"
Expand All @@ -37,24 +34,20 @@ before_install:
- mkdir -p build/logs

install:
- if [ "$(phpenv version-name)" != "$LATEST_PHP_VERSION" ]; then
composer remove friendsofphp/php-cs-fixer phpstan/phpstan --dev;
fi
- if [ "$DEPENDENCIES" = "beta" ]; then
composer config minimum-stability beta;
composer update -n --prefer-dist;
composer update -n --no-dev --prefer-dist;
elif [ "$DEPENDENCIES" = "low" ]; then
composer update -n --prefer-dist --prefer-lowest;
composer update -n --no-dev --prefer-dist --prefer-lowest;
else
composer update -n --prefer-dist;
composer update -n --no-dev --prefer-dist;
fi;
- if [ "$(phpenv version-name)" = "$LATEST_PHP_VERSION" ]; then
echo "Install dev dependencies";
composer update -n --dev;
fi;

script:
- if [ "$(phpenv version-name)" != "$LATEST_PHP_VERSION" ]; then
echo "File validation is skipped for older PHP versions";
else
composer validate-files;
fi;
- if [ "$(phpenv version-name)" != "$LATEST_PHP_VERSION" ]; then
echo "Static analysis is skipped for older PHP versions";
else
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ There are two Route Formatters included in the package:

### Contributing
```bash
composer validate-files
composer run-static-analysis
composer check-code-style
composer run-tests
Expand Down
32 changes: 15 additions & 17 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
},

"require": {
"php": "^5.6|^7.0",
"php": "^7.3",
"ext-dom": "*",
"ext-json": "*",
"ext-pcre": "*",
Expand All @@ -52,38 +52,36 @@
},
"require-dev": {
"friendsofphp/php-cs-fixer": "*",
"jakub-onderka/php-parallel-lint": "^1.0",
"php-coveralls/php-coveralls": "^2.1",
"phpstan/phpstan": "^0.11",
"phpunit/phpunit": "^5.7",
"sensiolabs/security-checker": "^5.0"
"phpstan/phpstan": "^0.12",
"phpstan/phpstan-phpunit": "^0.12.16",
"phpunit/phpunit": "^9.0",
"sensiolabs/security-checker": "^5.0",
"slam/phpstan-extensions": "^5.0"
},

"scripts": {
"check-code-style": [
"php-cs-fixer fix --config='.php_cs' --no-interaction --diff -v --dry-run"
"php-cs-fixer fix --config='./tools/php-cs-fixer/config.php' --no-interaction --diff -v --dry-run"
],
"check-security": [
"security-checker security:check"
],
"fix-code-style": [
"php-cs-fixer fix --config='.php_cs' --no-interaction --diff -v"
"php-cs-fixer fix --config='./tools/php-cs-fixer/config.php' --no-interaction --diff -v"
],
"run-static-analysis": [
"phpstan analyse --level=1 src/"
"generate-phpstan-baselines": [
"phpstan analyse src/ --generate-baseline='./tools/phpstan/baseline/src.neon' --configuration='./tools/phpstan/config.neon' --ansi",
"phpstan analyse tests/ --generate-baseline='./tools/phpstan/baseline/tests.neon' --configuration='./tools/phpstan/config.neon' --ansi"
],
"run-static-analysis-including-tests": [
"@run-static-analysis",
"phpstan analyse --level=3 tests/"
"run-static-analysis": [
"phpstan analyse src/ tests/ --configuration='./tools/phpstan/config.neon' --ansi --no-progress"
],
"run-tests": [
"phpunit"
"phpunit --configuration='./tools/phpunit/config.xml'"
],
"run-tests-with-clover": [
"phpunit --coverage-clover build/logs/clover.xml"
],
"validate-files": [
"parallel-lint --exclude vendor --exclude bin ."
"phpunit --configuration='./tools/phpunit/config.xml' --coverage-clover='./build/logs/clover.xml'"
]
},

Expand Down
4 changes: 2 additions & 2 deletions src/NamedParameter.php
Original file line number Diff line number Diff line change
Expand Up @@ -652,11 +652,11 @@ public function setMaximum($maximum)
*
* @param int $position
*
* @return string
* @return string|null
*/
public function getExample($position = 0)
{
return $this->examples[$position];
return isset($this->examples[$position]) ? $this->examples[$position] : null;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/ApiDefinitionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

class ApiDefinitionTest extends TestCase
{
protected function setUp()
protected function setUp(): void
{
parent::setUp();
\setlocale(LC_NUMERIC, 'C');
Expand Down Expand Up @@ -465,7 +465,7 @@ private function assertValidationFailedWithErrors(ValidatorInterface $validator,
{
$this->assertFalse($validator->isValid(), 'Validator expected to fail');
foreach ($errors as $error) {
$this->assertContains(
$this->assertContainsEquals(
$error,
$validator->getErrors(),
$message = \sprintf('Validator expected to contain error: %s', $error->__toString()),
Expand Down
4 changes: 2 additions & 2 deletions tests/JsonSchemaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class JsonSchemaTest extends TestCase
*/
private $parser;

protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->parser = new Parser();
Expand All @@ -32,7 +32,7 @@ public function shouldReturnJsonString()
$schema = $body->getSchema();

$schemaString = (string) $schema;
$this->assertInternalType('string', $schemaString);
$this->assertIsString($schemaString);
$this->assertEquals('A list of songs', \json_decode($schemaString)->description);
}

Expand Down
6 changes: 3 additions & 3 deletions tests/MethodTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function shouldGetValidResponsesIfPassedExpectedValues()
$apiDefinition
);

$this->assertInternalType('array', $method->getResponses());
$this->assertIsArray($method->getResponses());
$this->assertCount(1, $method->getResponses());

$responses = $method->getResponses();
Expand Down Expand Up @@ -142,7 +142,7 @@ public function shouldGetGlobalProtocols()
$apiDefinition
);

$this->assertInternalType('array', $method->getProtocols());
$this->assertIsArray($method->getProtocols());
$this->assertCount(1, $method->getProtocols());
$this->assertSame(['HTTP'], $method->getProtocols());
}
Expand All @@ -164,7 +164,7 @@ public function shouldGetOverrideProtocols()
$apiDefinition
);

$this->assertInternalType('array', $method->getProtocols());
$this->assertIsArray($method->getProtocols());
$this->assertCount(2, $method->getProtocols());
$this->assertSame([
'HTTP',
Expand Down
3 changes: 2 additions & 1 deletion tests/NamedParameters/BaseUriParameterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ class BaseUriParameterTest extends TestCase
*/
private $parser;

protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->parser = new Parser();
\setlocale(LC_NUMERIC, 'C');
}
Expand Down
2 changes: 1 addition & 1 deletion tests/NamedParameters/MultipleTypesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class MultipleTypesTest extends TestCase
*/
private $parser;

protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->parser = new Parser();
Expand Down
2 changes: 1 addition & 1 deletion tests/NamedParameters/ParameterTypesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ParameterTypesTest extends TestCase
*/
private $validateBody;

protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->parser = new Parser();
Expand Down
2 changes: 1 addition & 1 deletion tests/NamedParameters/UriParameterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class UriParameterTest extends TestCase
*/
private $parser;

protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->parser = new Parser();
Expand Down
2 changes: 1 addition & 1 deletion tests/NamedParameters/WebFormBodyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class WebFormBodyTest extends TestCase
*/
private $parser;

protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->parser = new Parser();
Expand Down
6 changes: 3 additions & 3 deletions tests/ParseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ParseTest extends TestCase
*/
private $parser;

protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->parser = new Parser();
Expand Down Expand Up @@ -381,7 +381,7 @@ public function shouldNotParseJsonIfNotRequested()
$body = $response->getBodyByType('application/json');
$schema = $body->getSchema();

$this->assertInternalType('string', $schema);
$this->assertIsString($schema);
}

/**
Expand Down Expand Up @@ -455,7 +455,7 @@ public function shouldNotParseIncludedJsonIfNotRequired()
$body = $response->getBodyByType('application/json');
$schema = $body->getSchema();

$this->assertInternalType('string', $schema);
$this->assertIsString($schema);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/TypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class TypeTest extends TestCase
*/
private $parser;

protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->parser = new Parser();
Expand Down
2 changes: 1 addition & 1 deletion tests/Types/ArrayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ArrayTest extends TestCase
*/
private $parser;

protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->parser = new Parser();
Expand Down
2 changes: 1 addition & 1 deletion tests/Types/ObjectTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ObjectTypeTest extends TestCase
*/
private $apiDefinition;

protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->apiDefinition = (new Parser())->parse(__DIR__ . '/../fixture/object_types.raml');
Expand Down
2 changes: 1 addition & 1 deletion tests/Types/UnionTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class UnionTypeTest extends TestCase
*/
private $parser;

protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->parser = new Parser();
Expand Down
9 changes: 5 additions & 4 deletions tests/Validator/RequestValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Raml\Tests\Validator;

use Negotiation\Negotiator;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\StreamInterface;
Expand All @@ -22,17 +23,18 @@ class RequestValidatorTest extends TestCase
private $parser;

/**
* @var RequestInterface|PHPUnit_Framework_MockObject_MockObject
* @var RequestInterface&MockObject
*/
private $request;

/**
* @var UriInterface|PHPUnit_Framework_MockObject_MockObject
* @var UriInterface&MockObject
*/
private $uri;

protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->parser = new Parser();
$this->uri = $this->createMock(UriInterface::class);
$this->request = $this->createMock(RequestInterface::class);
Expand Down Expand Up @@ -163,7 +165,6 @@ public function shouldAllowEmptyRequestBody()

/**
* @test
* @doesNotPerformAssertions
*/
public function shouldParseContentTypeHeader()
{
Expand Down
10 changes: 5 additions & 5 deletions tests/Validator/ResponseValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Raml\Tests\Validator;

use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
Expand All @@ -22,21 +23,21 @@ class ResponseValidatorTest extends TestCase
private $parser;

/**
* @var RequestInterface|PHPUnit_Framework_MockObject_MockObject
* @var RequestInterface&MockObject
*/
private $request;

/**
* @var ResponseInterface|PHPUnit_Framework_MockObject_MockObject
* @var ResponseInterface&MockObject
*/
private $response;

/**
* @var UriInterface|PHPUnit_Framework_MockObject_MockObject
* @var UriInterface&MockObject
*/
private $uri;

protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->parser = new Parser();
Expand Down Expand Up @@ -174,7 +175,6 @@ public function shouldCatchInvalidBody()

/**
* @test
* @doesNotPerformAssertions
*/
public function shouldParseContentTypeHeader()
{
Expand Down
Loading