diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..a61a3ab --- /dev/null +++ b/.editorconfig @@ -0,0 +1,19 @@ +# EditorConfig helps developers define and maintain consistent +# coding styles between different editors and IDEs +# editorconfig.org + +root = true + +[*] +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +indent_style = space +indent_size = 2 + +[*.{diff,md}] +trim_trailing_whitespace = false + +[*.{php,xml,json}] +indent_size = 4 diff --git a/.travis.yml b/.travis.yml index e816287..d663d75 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,10 +12,11 @@ language: php matrix: include: - - php: 7.1 - env: CHECKS=yes - - php: 7.2 - php: 7.3 + env: CHECKS=yes + - php: 7.4 + - php: 8.0 + - php: 8.1 sudo: false diff --git a/composer.json b/composer.json index d328dec..ec370d8 100644 --- a/composer.json +++ b/composer.json @@ -15,20 +15,29 @@ } ], "require": { - "php": ">=7.1", + "php": ">=7.3", "axy/backtrace": "~2.0.0" }, "require-dev": { - "phpunit/phpunit": "^7.5", + "phpunit/phpunit": "^9.0", "squizlabs/php_codesniffer": "^3.4", "phpmd/phpmd": "^2.6" }, "autoload": { "psr-4": { - "axy\\errors\\": "src", - "axy\\errors\\tests\\": "tests" + "axy\\errors\\": "src/" } }, + "autoload-dev": { + "psr-4": { + "axy\\errors\\tests\\": "tests/" + } + }, + "scripts": { + "test": "phpunit -c phpunit.xml.dist", + "md": "phpmd --exclude vendor . text phpmd.xml.dist", + "cs": "phpcs --standard=PSR2 --encoding=utf-8 --ignore=vendor ." + }, "archive": { "exclude": ["/tests/*", "/doc/*", "/cs.sh", "/phpmd.sh", "/*.xml.dist", "/CHANGELOG.md"] } diff --git a/cs.sh b/cs.sh old mode 100755 new mode 100644 diff --git a/index.php b/index.php deleted file mode 100644 index efffb3e..0000000 --- a/index.php +++ /dev/null @@ -1,24 +0,0 @@ - - * @license https://raw.github.com/axypro/errors/master/LICENSE MIT - * @link https://github.com/axypro/errors repository - * @link https://github.com/axypro/errors/blob/master/README.md documentation - * @link https://packagist.org/packages/axy/errors composer - * @uses PHP7.1+ - */ - -declare(strict_types=1); - -namespace axy\errors; - -use LogicException; - -if (!is_file(__DIR__.'/vendor/autoload.php')) { - throw new LogicException('Please: composer install'); -} - -require_once(__DIR__.'/vendor/autoload.php'); diff --git a/phpmd.sh b/phpmd.sh old mode 100755 new mode 100644 index 386ee36..ecc3767 --- a/phpmd.sh +++ b/phpmd.sh @@ -5,7 +5,6 @@ args="text phpmd.xml.dist" if [ "$#" -ne 0 ]; then ${cmd} "$@" ${args} -else +else ${cmd} . ${args} fi - diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 73c541c..c81f508 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,6 +1,8 @@ - - - - ./tests/ - - - - - ./src - - + + + ./src + + + + + ./tests/ + + diff --git a/src/ContainerReadOnly.php b/src/ContainerReadOnly.php index 3a7c459..333b11f 100644 --- a/src/ContainerReadOnly.php +++ b/src/ContainerReadOnly.php @@ -15,7 +15,7 @@ * * @link https://github.com/axypro/errors/blob/master/doc/classes/ContainerReadOnly.md documentation */ -class ContainerReadOnly extends Logic implements ReadOnly +class ContainerReadOnly extends Logic implements ReadOnlyException { /** * {@inheritdoc} diff --git a/src/PropertyReadOnly.php b/src/PropertyReadOnly.php index dfc7905..30bf8de 100644 --- a/src/PropertyReadOnly.php +++ b/src/PropertyReadOnly.php @@ -15,7 +15,7 @@ * * @link https://github.com/axypro/errors/blob/master/doc/classes/PropertyReadOnly.md documentation */ -class PropertyReadOnly extends Logic implements ReadOnly +class PropertyReadOnly extends Logic implements ReadOnlyException { /** * {@inheritdoc} diff --git a/src/ReadOnly.php b/src/ReadOnlyException.php similarity index 85% rename from src/ReadOnly.php rename to src/ReadOnlyException.php index 0ae526a..1a02d7f 100644 --- a/src/ReadOnly.php +++ b/src/ReadOnlyException.php @@ -13,6 +13,6 @@ * * @link https://github.com/axypro/errors/blob/master/doc/errors.md documentation */ -interface ReadOnly extends Forbidden +interface ReadOnlyException extends Forbidden { } diff --git a/tests/ContainerReadOnlyTest.php b/tests/ContainerReadOnlyTest.php index aecafb5..c93bb42 100644 --- a/tests/ContainerReadOnlyTest.php +++ b/tests/ContainerReadOnlyTest.php @@ -29,7 +29,7 @@ public function testCreate(): void $this->assertInstanceOf('axy\errors\Error', $e); $this->assertInstanceOf('axy\errors\Logic', $e); $this->assertInstanceOf('axy\errors\Forbidden', $e); - $this->assertInstanceOf('axy\errors\ReadOnly', $e); + $this->assertInstanceOf('axy\errors\ReadOnlyException', $e); $this->assertSame('Cont', $e->getContainer()); $this->assertSame($previous, $e->getPrevious()); $this->assertSame('Cont is read-only', $e->getMessage()); diff --git a/tests/PropertyReadOnlyTest.php b/tests/PropertyReadOnlyTest.php index 92f6c0b..9f3c252 100644 --- a/tests/PropertyReadOnlyTest.php +++ b/tests/PropertyReadOnlyTest.php @@ -30,7 +30,7 @@ public function testCreate(): void $this->assertInstanceOf('axy\errors\Error', $e); $this->assertInstanceOf('axy\errors\Logic', $e); $this->assertInstanceOf('axy\errors\Forbidden', $e); - $this->assertInstanceOf('axy\errors\ReadOnly', $e); + $this->assertInstanceOf('axy\errors\ReadOnlyException', $e); $this->assertSame('Cont', $e->getContainer()); $this->assertSame('prop', $e->getKey()); $this->assertSame($previous, $e->getPrevious()); diff --git a/tests/bootstrap.php b/tests/bootstrap.php deleted file mode 100644 index e5ee10b..0000000 --- a/tests/bootstrap.php +++ /dev/null @@ -1,11 +0,0 @@ - - */ - -declare(strict_types=1); - -namespace axy\errors\tests; - -require(__DIR__.'/../index.php'); diff --git a/unit.sh b/unit.sh old mode 100755 new mode 100644