Skip to content

Commit

Permalink
Merge pull request #55 from Felynx3/feat/upgrade-php-8.1
Browse files Browse the repository at this point in the history
chore: Update PHP to 8.1 and dependencies
  • Loading branch information
klaussilveira authored Nov 30, 2022
2 parents 3585c97 + 4b00d22 commit 9dc0e78
Show file tree
Hide file tree
Showing 36 changed files with 110 additions and 58 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.2'
php-version: '8.1'

- name: Validate composer.json and composer.lock
run: composer validate --strict
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ composer.phar
composer.lock
phpunit.xml
cache.properties
.php_cs.cache
.php-cs-fixer.cache
.phpunit.result.cache
.idea/
/data/cache/*
8 changes: 4 additions & 4 deletions .php_cs → .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
->in(__DIR__ . '/src')
->in(__DIR__ . '/tests');

return PhpCsFixer\Config::create()
return (new PhpCsFixer\Config())
->setRules([
'@Symfony' => true,
'@PHP71Migration:risky' => true,
Expand All @@ -15,12 +15,12 @@
'concat_space' => ['spacing' => 'one'],
'declare_strict_types' => true,
'increment_style' => ['style' => 'post'],
'is_null' => ['use_yoda_style' => false],
'is_null' => true,
'list_syntax' => ['syntax' => 'short'],
'method_argument_space' => ['ensure_fully_multiline' => true],
'method_argument_space' => true,
'method_chaining_indentation' => true,
'modernize_types_casting' => true,
'no_multiline_whitespace_before_semicolons' => true,
'multiline_whitespace_before_semicolons' => false,
'no_superfluous_elseif' => true,
'no_superfluous_phpdoc_tags' => true,
'no_useless_else' => true,
Expand Down
45 changes: 41 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,50 @@
"type": "library",
"license": "BSD-3-Clause",
"require": {
"php": ">=7.2",
"ramsey/uuid": "^3.8|^4.0",
"php": "^8.1",
"ramsey/uuid": "^4.5",
"doctrine/inflector": "^2.0"
},
"require-dev": {
"phpunit/phpunit": ">=6.0",
"friendsofphp/php-cs-fixer": "^2.4"
"friendsofphp/php-cs-fixer": "^3.11",
"michaelmoussa/php-coverage-checker": "^1.1",
"phpunit/phpunit": "^9.5",
"phpspec/prophecy": "^1.15",
"phpspec/prophecy-phpunit": "^2.0",
"phpstan/phpstan": "^0.12"
},
"scripts": {
"lint": [
"php-cs-fixer fix --ansi --verbose --show-progress=dots"
],
"lint:check": [
"@lint --dry-run"
],
"test:base": [
"php -d pcov.enabled=1 vendor/bin/phpunit --color=always"
],
"test": [
"@test:base --log-junit build/junit.xml --coverage-xml build/coverage-xml --coverage-clover build/coverage-clover.xml"
],
"test:with-html-coverage": [
"@test:base --coverage-html build/coverage-html"
],
"test:coverage-checker": [
"php-coverage-checker build/coverage-clover.xml 92;"
],
"test:check": [
"if [ -f build/coverage-clover.xml ]; then rm build/coverage-clover.xml; echo '>>> REMOVED OLD CLOVER.XML BUILD FILE!'; fi; # comment trick to allow composer params :D",
"@test",
"@test:coverage-checker"
],
"check": [
"@lint:check",
"@test:check",
"@static-analysis"
],
"static-analysis": [
"phpstan analyse --ansi --memory-limit=-1"
]
},
"autoload": {
"psr-4": {
Expand Down
7 changes: 7 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
parameters:
level: 0 # start increasing the level
paths:
- src
- tests
tmpDir: data/cache/phpstan
reportUnmatchedIgnoredErrors: false
33 changes: 16 additions & 17 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
backupGlobals="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
stopOnFailure="false"
bootstrap="./vendor/autoload.php">
<testsuites>
<testsuite name="Linio Framework Test Suite">
<directory>./tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
<exclude>
<file>src/Input/Constraint/ConstraintInterface.php</file>
<file>src/Input/Transformer/TransformerInterface.php</file>
<file>src/Input/InputTrait.php</file>
</exclude>
</whitelist>
</filter>
<coverage includeUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</include>
<exclude>
<file>src/Input/Constraint/ConstraintInterface.php</file>
<file>src/Input/Transformer/TransformerInterface.php</file>
<file>src/Input/InputTrait.php</file>
</exclude>
</coverage>
<testsuites>
<testsuite name="Linio Framework Test Suite">
<directory>./tests</directory>
</testsuite>
</testsuites>
</phpunit>
2 changes: 1 addition & 1 deletion src/Constraint/GuidValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class GuidValue extends Constraint
{
const ERROR_MESSAGE = 'Invalid GUID format';
public const ERROR_MESSAGE = 'Invalid GUID format';

public function __construct(string $errorMessage = null)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Constraint/UuidValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@

class UuidValue extends GuidValue
{
const ERROR_MESSAGE = 'Invalid UUID format';
public const ERROR_MESSAGE = 'Invalid UUID format';
}
3 changes: 1 addition & 2 deletions src/Transformer/UuidTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Linio\Component\Input\Transformer;

use Exception;
use Linio\Component\Input\Exception\TransformationException;
use Ramsey\Uuid\Uuid;

Expand All @@ -14,7 +13,7 @@ public function transform($value)
{
try {
return Uuid::fromString($value);
} catch (Exception $exception) {
} catch (\Exception $exception) {
throw new TransformationException($exception->getMessage());
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Constraint/DateRangeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Linio\Component\Input\Constraint;

use PHPUnit\Framework\TestCase;
use Linio\Component\Input\TestCase;

class DateRangeTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Constraint/DateTimeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Linio\Component\Input\Constraint;

use PHPUnit\Framework\TestCase;
use Linio\Component\Input\TestCase;

class DateTimeTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Constraint/EmailTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Linio\Component\Input\Constraint;

use PHPUnit\Framework\TestCase;
use Linio\Component\Input\TestCase;

class EmailTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Constraint/EnumTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Linio\Component\Input\Constraint;

use PHPUnit\Framework\TestCase;
use Linio\Component\Input\TestCase;

class EnumTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Constraint/GuidValueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Linio\Component\Input\Constraint;

use PHPUnit\Framework\TestCase;
use Linio\Component\Input\TestCase;

class GuidValueTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Constraint/NotNullTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Linio\Component\Input\Constraint;

use PHPUnit\Framework\TestCase;
use Linio\Component\Input\TestCase;

class NotNullTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Constraint/PatternTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Linio\Component\Input\Constraint;

use PHPUnit\Framework\TestCase;
use Linio\Component\Input\TestCase;

class PatternTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Constraint/RangeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Linio\Component\Input\Constraint;

use PHPUnit\Framework\TestCase;
use Linio\Component\Input\TestCase;

class RangeTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Constraint/StringSizeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Linio\Component\Input\Constraint;

use PHPUnit\Framework\TestCase;
use Linio\Component\Input\TestCase;

class StringSizeTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Constraint/TypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Linio\Component\Input\Constraint;

use PHPUnit\Framework\TestCase;
use Linio\Component\Input\TestCase;

class TypeTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Constraint/UrlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Linio\Component\Input\Constraint;

use PHPUnit\Framework\TestCase;
use Linio\Component\Input\TestCase;

class UrlTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Constraint/UuidValueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Linio\Component\Input\Constraint;

use PHPUnit\Framework\TestCase;
use Linio\Component\Input\TestCase;

class UuidValueTest extends TestCase
{
Expand Down
1 change: 0 additions & 1 deletion tests/InputHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use Linio\Component\Input\Constraint\StringSize;
use Linio\Component\Input\Instantiator\InstantiatorInterface;
use Linio\Component\Input\Instantiator\PropertyInstantiator;
use PHPUnit\Framework\TestCase;

class TestUser
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Instantiator/ConstructInstantiatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Linio\Component\Input\Instantiator;

use Linio\Component\Input\Constraint\Enum;
use PHPUnit\Framework\TestCase;
use Linio\Component\Input\TestCase;

class ConstructInstantiatorTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Instantiator/PropertyInstantiatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace Linio\Component\Input\Instantiator;

use Linio\Component\Input\TestCase;
use Linio\Component\Input\TestUser;
use PHPUnit\Framework\TestCase;

class PropertyInstantiatorTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Instantiator/ReflectionInstantiatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace Linio\Component\Input\Instantiator;

use Linio\Component\Input\TestCase;
use Linio\Component\Input\TestUser;
use PHPUnit\Framework\TestCase;

class ReflectionInstantiatorTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Instantiator/SetInstantiatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace Linio\Component\Input\Instantiator;

use Linio\Component\Input\TestCase;
use Linio\Component\Input\TestUser;
use PHPUnit\Framework\TestCase;

class SetInstantiatorTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Node/BaseNodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
use Linio\Component\Input\Constraint\Range;
use Linio\Component\Input\Constraint\StringSize;
use Linio\Component\Input\Exception\InvalidConstraintException;
use Linio\Component\Input\TestCase;
use Linio\Component\Input\Transformer\DateTimeTransformer;
use Linio\Component\Input\TypeHandler;
use PHPUnit\Framework\TestCase;

class BaseNodeTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Node/CollectionNodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
use Linio\Component\Input\Constraint\ConstraintInterface;
use Linio\Component\Input\Exception\InvalidConstraintException;
use Linio\Component\Input\Instantiator\InstantiatorInterface;
use Linio\Component\Input\TestCase;
use Linio\Component\Input\TypeHandler;
use PHPUnit\Framework\TestCase;

class CollectionNodeTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Node/IntNodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Linio\Component\Input\Node;

use PHPUnit\Framework\TestCase;
use Linio\Component\Input\TestCase;

class IntNodeTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Node/ObjectNodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
use Linio\Component\Input\Constraint\ConstraintInterface;
use Linio\Component\Input\Exception\InvalidConstraintException;
use Linio\Component\Input\Instantiator\InstantiatorInterface;
use Linio\Component\Input\TestCase;
use Linio\Component\Input\TypeHandler;
use PHPUnit\Framework\TestCase;

class ObjectNodeTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Node/ScalarCollectionNodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

use Linio\Component\Input\Constraint\ConstraintInterface;
use Linio\Component\Input\Exception\InvalidConstraintException;
use Linio\Component\Input\TestCase;
use Linio\Component\Input\TypeHandler;
use PHPUnit\Framework\TestCase;

class ScalarCollectionNodeTest extends TestCase
{
Expand Down
2 changes: 0 additions & 2 deletions tests/SchemaBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

namespace Linio\Component\Input;

use PHPUnit\Framework\TestCase;

class SchemaTestInputHandler extends InputHandler
{
public function define(): void
Expand Down
Loading

0 comments on commit 9dc0e78

Please sign in to comment.