diff --git a/.coveralls.yml b/.coveralls.yml new file mode 100644 index 0000000..75aefc8 --- /dev/null +++ b/.coveralls.yml @@ -0,0 +1,3 @@ +# for php-coveralls +service_name: travis-ci +coverage_clover: build/logs/clover.xml diff --git a/.docheader b/.docheader new file mode 100644 index 0000000..cccd265 --- /dev/null +++ b/.docheader @@ -0,0 +1,5 @@ +This file is part of `%package%`. +(c) 2015-%year% Sascha-Oliver Prolic + +For the full copyright and license information, please view the LICENSE +file that was distributed with this source code. diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..50e4939 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,8 @@ +/docs export-ignore +/tests export-ignore +.coveralls.yml export-ignore +.docheader export-ignore +.gitignore export-ignore +.php_cs export-ignore +.travis.yml export-ignore +phpunit.xml.dist export-ignore diff --git a/.php_cs b/.php_cs index 1ae7995..363296d 100644 --- a/.php_cs +++ b/.php_cs @@ -1,21 +1,10 @@ setRules([ - '@PSR2' => true, -]); +$config = new Prooph\CS\Config\Prooph(); +$config->getFinder()->in(__DIR__); -$finder = PhpCsFixer\Finder::create(); +$cacheDir = getenv('TRAVIS') ? getenv('HOME') . '/.php-cs-fixer' : __DIR__; -/* - * You can set manually these paths: - */ -$finder->in([ - 'bin', - 'src', - 'tests' -]); - -$config->setFinder($finder); +$config->setCacheFile($cacheDir . '/.php_cs.cache'); return $config; diff --git a/.travis.yml b/.travis.yml index 402be70..d77e379 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,10 +3,7 @@ language: php sudo: false php: - - 7.0 - - 7.1 - - 7.2 - - 7.3 + - 7.4 env: matrix: @@ -16,6 +13,8 @@ env: cache: directories: - $HOME/.composer/cache + - $HOME/.php-cs-fixer + - $HOME/.local before_script: - phpenv config-rm xdebug.ini diff --git a/LICENSE.txt b/LICENSE.txt index 7b268ce..715de03 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2014-2016 Sascha-Oliver Prolic +Copyright (c) 2015-2020 Sascha-Oliver Prolic Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation diff --git a/README.md b/README.md index 8a8ae2f..ad05206 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Humus AMQP Module ## About The Humus AMQP Module incorporates messaging in your zf2 application via RabbitMQ using [HumusAmqp](https://github.com/prolic/HumusAmqp>), -a PHP 7 AMQP libray supporting multiple drivers and providing full-featured Consumer, Producer, and JSON-RPC Client / Server implementations. +a PHP 7.4 AMQP libray supporting multiple drivers and providing full-featured Consumer, Producer, and JSON-RPC Client / Server implementations. The JSON-RPC part implements JSON-RPC 2.0 Specification. @@ -25,7 +25,7 @@ Documentation can be found here: [humusamqp.readthedocs.io](https://humusamqp.re ## Installation -You can install prolic/humus-amqp-module via composer by adding "prolic/humus-amqp-module": "^1.0" as requirement to your composer.json. +You can install prolic/humus-amqp-module via composer by adding "prolic/humus-amqp-module": "^2.0" as requirement to your composer.json. You can then enable the module in your config/application.config.php by adding 'HumusAmqpModule' to the 'modules' section. @@ -41,4 +41,4 @@ To establish a consistent code quality, please provide unit tests for all your c ## License -Released under the [MIT](LICENSE.txt). \ No newline at end of file +Released under the [MIT](LICENSE.txt). diff --git a/bin/humus-amqp-module.php b/bin/humus-amqp-module.php index 0d4767a..7da4aa9 100644 --- a/bin/humus-amqp-module.php +++ b/bin/humus-amqp-module.php @@ -1,6 +1,16 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); /** - * Copyright (c) 2016. Sascha-Oliver Prolic + * Copyright (c) 2015-2020. Sascha-Oliver Prolic * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT @@ -20,13 +30,13 @@ use Zend\Mvc\Application; -ini_set('display_errors', true); -chdir(__DIR__); +\ini_set('display_errors', true); +\chdir(__DIR__); $previousDir = '.'; -while (!file_exists('config/application.config.php')) { - $dir = dirname(getcwd()); +while (! \file_exists('config/application.config.php')) { + $dir = \dirname(\getcwd()); if ($previousDir === $dir) { throw new RuntimeException( @@ -36,15 +46,14 @@ } $previousDir = $dir; - chdir($dir); + \chdir($dir); } - -if (is_readable('init_autoloader.php')) { +if (\is_readable('init_autoloader.php')) { include_once 'init_autoloader.php'; -} elseif (file_exists(__DIR__ . '/../vendor/autoload.php')) { +} elseif (\file_exists(__DIR__ . '/../vendor/autoload.php')) { include_once __DIR__ . '/../vendor/autoload.php'; -} elseif (file_exists(__DIR__ . '/../../../autoload.php')) { +} elseif (\file_exists(__DIR__ . '/../../../autoload.php')) { include_once __DIR__ . '/../../../autoload.php'; } else { throw new RuntimeException('Error: vendor/autoload.php could not be found. Did you run php composer.phar install?'); diff --git a/composer.json b/composer.json index 6f355c3..403366e 100644 --- a/composer.json +++ b/composer.json @@ -12,16 +12,18 @@ } ], "require": { - "php": "^7.0", - "prolic/humus-amqp" : "^1.0", - "container-interop/container-interop": "^1.1", + "php": "^7.4", + "prolic/humus-amqp" : "^2.0", + "psr/container": "^1.0", "sandrokeil/interop-config": "^1.0 || ^2.0", - "symfony/console": "^3.0|^4.0", - "zendframework/zend-modulemanager": "^2.7" + "symfony/console": "^4.3|^5.0", + "zendframework/zend-modulemanager": "^2.8.4", + "zendframework/zend-mvc": "^2.7.15" }, "require-dev": { - "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0", - "friendsofphp/php-cs-fixer": "^2.14", + "friendsofphp/php-cs-fixer": "^2.16.1", + "phpunit/phpunit": "^9.0", + "prooph/php-cs-fixer-config": "^0.3", "php-coveralls/php-coveralls": "^2.1" }, "autoload": { diff --git a/config/module.config.php b/config/module.config.php index c384150..e0a69c5 100644 --- a/config/module.config.php +++ b/config/module.config.php @@ -1,35 +1,25 @@ - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * This file is part of `prolic/humus-amqp-module`. + * (c) 2015-2020 Sascha-Oliver Prolic * - * This software consists of voluntary contributions made by many individuals - * and is licensed under the MIT license. + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. */ -declare (strict_types=1); +declare(strict_types=1); namespace HumusAmqpModule; -use Humus\Amqp\Driver\Driver; use Humus\Amqp\Container\DriverFactory; +use Humus\Amqp\Driver\Driver; return [ 'service_manager' => [ 'factories' => [ 'humus_amqp_cli' => Container\CliFactory::class, Driver::class => DriverFactory::class, - ] + ], ], ]; diff --git a/docs/index.rst b/docs/index.rst index 1065c48..e803177 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -6,7 +6,7 @@ The documentation moved `here `_. Overview -------- -PHP 7 AMQP libray supporting multiple drivers and providing full-featured Consumer, Producer, and JSON-RPC Client / Server implementations. +PHP 7.4 AMQP libray supporting multiple drivers and providing full-featured Consumer, Producer, and JSON-RPC Client / Server implementations. The JSON-RPC part implements `JSON-RPC 2.0 Specification `_. diff --git a/docs/make.bat b/docs/make.bat index 0e4dc5f..93b3479 100644 --- a/docs/make.bat +++ b/docs/make.bat @@ -1,3 +1,4 @@ + @ECHO OFF REM Command file for Sphinx documentation diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 8a0d104..83010f4 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,17 +1,31 @@ - + + + + - - ./tests + stopOnFailure="false" + failOnWarning="true" + failOnRisky="true" +> + + ./tests + ./src diff --git a/src/Container/CliFactory.php b/src/Container/CliFactory.php index a890152..7c20a4e 100644 --- a/src/Container/CliFactory.php +++ b/src/Container/CliFactory.php @@ -1,21 +1,11 @@ - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * This file is part of `prolic/humus-amqp-module`. + * (c) 2015-2020 Sascha-Oliver Prolic * - * This software consists of voluntary contributions made by many individuals - * and is licensed under the MIT license. + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. */ declare(strict_types=1); @@ -23,20 +13,12 @@ namespace HumusAmqpModule\Container; use Humus\Amqp\Console\ConsoleRunner; -use Interop\Container\ContainerInterface; +use Psr\Container\ContainerInterface; use Symfony\Component\Console\Application; -/** - * Class CliFactory - * @package HumusAmqpModule\Container - */ final class CliFactory { - /** - * @param ContainerInterface $container - * @return Application - */ - public function __invoke(ContainerInterface $container) + public function __invoke(ContainerInterface $container): Application { return ConsoleRunner::createApplication(ConsoleRunner::createHelperSet($container)); } diff --git a/src/Module.php b/src/Module.php index 3306aca..f9f6149 100644 --- a/src/Module.php +++ b/src/Module.php @@ -1,21 +1,11 @@ - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * This file is part of `prolic/humus-amqp-module`. + * (c) 2015-2020 Sascha-Oliver Prolic * - * This software consists of voluntary contributions made by many individuals - * and is licensed under the MIT license. + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. */ declare(strict_types=1); @@ -24,10 +14,6 @@ use Zend\ModuleManager\Feature\ConfigProviderInterface; -/** - * Class Module - * @package HumusAmqpModule - */ class Module implements ConfigProviderInterface { /** diff --git a/tests/Container/CliFactoryTest.php b/tests/Container/CliFactoryTest.php index 5cbb0e8..6d18254 100644 --- a/tests/Container/CliFactoryTest.php +++ b/tests/Container/CliFactoryTest.php @@ -1,21 +1,11 @@ - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * This file is part of `prolic/humus-amqp-module`. + * (c) 2015-2020 Sascha-Oliver Prolic * - * This software consists of voluntary contributions made by many individuals - * and is licensed under the MIT license. + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. */ declare(strict_types=1); @@ -23,20 +13,16 @@ namespace HumusAmqpModuleTest\Container; use HumusAmqpModule\Container\CliFactory; -use Interop\Container\ContainerInterface; use PHPUnit\Framework\TestCase; +use Psr\Container\ContainerInterface; use Symfony\Component\Console\Application; -/** - * Class CliFactoryTest - * @package HumusAmqpModuleTest\Container - */ class CliFactoryTest extends TestCase { /** * @test */ - public function it_creates_console_runner() + public function it_creates_console_runner(): void { $container = $this->prophesize(ContainerInterface::class); diff --git a/tests/ModuleTest.php b/tests/ModuleTest.php index 7265d0d..02a25fa 100644 --- a/tests/ModuleTest.php +++ b/tests/ModuleTest.php @@ -1,21 +1,11 @@ - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * This file is part of `prolic/humus-amqp-module`. + * (c) 2015-2020 Sascha-Oliver Prolic * - * This software consists of voluntary contributions made by many individuals - * and is licensed under the MIT license. + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. */ declare(strict_types=1); @@ -25,25 +15,22 @@ use HumusAmqpModule\Module; use PHPUnit\Framework\TestCase; -/** - * Class ModuleTest - * @package HumusAmqpModuleTest - */ class ModuleTest extends TestCase { /** * @test */ - public function it_gets_config() + public function it_gets_config(): void { $module = new Module(); $config = $module->getConfig(); + if (\method_exists($this, 'assertIsArray')) { $this->assertIsArray($config); } else { $this->assertInternalType('array', $config); } - $this->assertSame($config, unserialize(serialize($config))); + $this->assertSame($config, \unserialize(\serialize($config))); } }