diff --git a/.gitattributes b/.gitattributes index 094a0ff..a84d38d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -23,3 +23,9 @@ phpunit.xml.dist export-ignore .travis.yml export-ignore .codeclimate.yml export-ignore .styleci.yml export-ignore + +# Ignore Github files +CODE_OF_CONDUCT.md export-ignore +CONTRIBUTING.md export-ignore +ISSUE_TEMPLATE.md export-ignore +PULL_REQUEST_TEMPLATE.md export-ignore diff --git a/.travis.yml b/.travis.yml index 40af35e..c7f0baa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,10 +5,11 @@ language: php matrix: fast_finish: true include: - - php: 7.0 + - php: 7.1 env: - EXECUTE_COVERAGE=true - - php: 7.1 + - php: 7.2 + - php: 7.3 notifications: email: false diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 37f5757..d76659d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -34,7 +34,6 @@ $ phpunit * [PSR-1: Basic Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md) * [PSR-2: Coding Style Guide](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) * [PSR-4: Autoloading Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md) - * [PSR-5: PHPDoc (draft)](https://github.com/phpDocumentor/fig-standards/blob/master/proposed/phpdoc.md) * Keep the order of class elements: static properties, instance properties, constructor (or setUp for PHPUnit), destructor (or tearDown for PHPUnit), static methods, instance methods, magic static methods, magic instance methods. diff --git a/README.md b/README.md index 668ed97..ee01c7d 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ because often the message and the code are not enough to debug. Using [Composer](https://getcomposer.org): ```bash -composer require z-ee/exceptions +composer require zeeproject/exceptions ``` ## Usage @@ -29,27 +29,18 @@ throw new InvalidArgumentException('Something went wrong', [ ]); ~~~ -Now you can handle this exception, i.q. your error handler may log error details: +Now you can handle this exception, e.q. your error handler may log error details: ~~~php -class ErrorHandler +final class ErrorHandler { - /** - * @var LoggerInterface - */ private $logger; - /** - * @param LoggerInterface $logger - */ - public function __construct(LoggerInterface $logger) + public function __construct(Psr\Log\LoggerInterface $logger) { $this->logger = $logger; } - /** - * @param Exception $exception - */ public function handleException(Exception $exception) { if ($exception instanceof Zee\Exceptions\Throwable) { @@ -64,11 +55,6 @@ class ErrorHandler ## Testing ```bash -# install required files -composer self-update -composer install - -# run the test (from project root) phpunit ``` @@ -83,15 +69,15 @@ Contributions are welcome and will be fully credited. Please see [CONTRIBUTING]( ## License -The BSD 2-Clause License. Please see [LICENSE][link-license] for more information. +It's [BSD 2-Clause][link-license]. -[ico-version]: https://img.shields.io/packagist/v/z-ee/exceptions.svg?style=flat-square +[ico-version]: https://img.shields.io/packagist/v/zeeproject/exceptions.svg?style=flat-square [ico-license]: https://img.shields.io/badge/License-BSD%202--Clause-blue.svg?style=flat-square [ico-travis]: https://img.shields.io/travis/zee/exceptions/master.svg?style=flat-square [ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/zee/exceptions.svg?style=flat-square [ico-code-quality]: https://img.shields.io/scrutinizer/g/zee/exceptions.svg?style=flat-square -[link-packagist]: https://packagist.org/packages/z-ee/exceptions +[link-packagist]: https://packagist.org/packages/zeeproject/exceptions [link-license]: LICENSE [link-travis]: https://travis-ci.org/zee/exceptions [link-scrutinizer]: https://scrutinizer-ci.com/g/zee/exceptions/code-structure diff --git a/build/.gitignore b/build/.gitignore deleted file mode 100644 index d6b7ef3..0000000 --- a/build/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore diff --git a/composer.json b/composer.json index 0361267..6b73b8c 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "z-ee/exceptions", + "name": "zeeproject/exceptions", "description": "Set of the base exceptions", "license": "BSD-2-Clause", "keywords": [ @@ -13,12 +13,11 @@ } ], "require": { - "php": "^7.0", - "ext-json": "*" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^6.0", - "scrutinizer/ocular": "~1.1" + "phpunit/phpunit": "^7.5", + "scrutinizer/ocular": "~1.5" }, "autoload": { "psr-4": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 541e9d0..2079816 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,6 +1,6 @@ - diff --git a/src/BadFunctionCallException.php b/src/BadFunctionCallException.php index 127b53f..d519e91 100644 --- a/src/BadFunctionCallException.php +++ b/src/BadFunctionCallException.php @@ -1,21 +1,11 @@ context = $context; } - /** - * @return array - */ public function getContext() : array { return $this->context; diff --git a/src/UnderflowException.php b/src/UnderflowException.php index 1abc2a4..7fcb23f 100644 --- a/src/UnderflowException.php +++ b/src/UnderflowException.php @@ -1,21 +1,11 @@ 'bar']; - + $exception = new $exceptionClass($message, $context, $code); - + if ($exception instanceof Exceptions\Throwable) { self::assertSame($message, $exception->getMessage()); self::assertSame($context, $exception->getContext()); @@ -41,7 +31,7 @@ public function exceptionObjectShouldContainContext(string $exceptionClass) } } - public function provideExceptionClasses() + public function provideExceptionClasses(): array { return [ [Exceptions\LogicException::class],