From b12844cb77ddc1ceef37074f8d62c8087eff3a06 Mon Sep 17 00:00:00 2001 From: Syed Sirajul Islam Anik Date: Tue, 8 Feb 2022 12:53:09 +0600 Subject: [PATCH 1/4] uses Container contract instead of Application contract #2 --- src/AmqpFake.php | 4 ++-- src/AmqpManager.php | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/AmqpFake.php b/src/AmqpFake.php index 47fb5b2..9619b9f 100644 --- a/src/AmqpFake.php +++ b/src/AmqpFake.php @@ -6,7 +6,7 @@ use Anik\Amqp\Qos\Qos; use Anik\Amqp\Queues\Queue; use Anik\Laravel\Amqp\Exceptions\LaravelAmqpException; -use Illuminate\Contracts\Foundation\Application; +use Illuminate\Contracts\Container\Container; use Illuminate\Support\Arr; use Illuminate\Support\Collection; use PHPUnit\Framework\Assert; @@ -17,7 +17,7 @@ class AmqpFake extends AmqpManager implements AmqpPubSub protected $activeConnection; protected $connections; - public function __construct(Application $app) + public function __construct(Container $app) { parent::__construct($app); $this->messages = []; diff --git a/src/AmqpManager.php b/src/AmqpManager.php index 7591c69..83a9ae6 100644 --- a/src/AmqpManager.php +++ b/src/AmqpManager.php @@ -4,8 +4,11 @@ use Anik\Amqp\AmqpConnectionFactory; use Anik\Laravel\Amqp\Exceptions\LaravelAmqpException; -use Illuminate\Contracts\Foundation\Application; +use Illuminate\Config\Repository; +use Illuminate\Contracts\Container\Container; use PhpAmqpLib\Connection\AMQPLazySSLConnection; +use Psr\Container\ContainerExceptionInterface; +use Psr\Container\NotFoundExceptionInterface; class AmqpManager { @@ -13,7 +16,7 @@ class AmqpManager protected $connections; - public function __construct(Application $app) + public function __construct(Container $app) { $this->app = $app; } @@ -37,7 +40,13 @@ protected function getDefaultConnection(): string protected function config($key, $default = null) { - return $this->app['config'][$key] ?? $default; + try { + $repository = $this->app->get('config'); + } catch (NotFoundExceptionInterface | ContainerExceptionInterface $e) { + return $default; + } + + return $repository instanceof Repository ? $repository->get($key, $default) : $default; } protected function resolve(string $name): AmqpPubSub From 8a9da197c4894ea2eeefcd675c1cd2a9a8fa6eb7 Mon Sep 17 00:00:00 2001 From: Syed Sirajul Islam Anik Date: Tue, 8 Feb 2022 12:56:30 +0600 Subject: [PATCH 2/4] workflow update for dev branch --- .github/workflows/standard-test-coverage.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/standard-test-coverage.yml b/.github/workflows/standard-test-coverage.yml index ab5020b..b3a3e03 100644 --- a/.github/workflows/standard-test-coverage.yml +++ b/.github/workflows/standard-test-coverage.yml @@ -4,6 +4,7 @@ on: push: branches: - master + - dev jobs: coding-standard: From bb89ab26d8a760e34564d1157bb3a8a7076bd375 Mon Sep 17 00:00:00 2001 From: Syed Sirajul Islam Anik Date: Tue, 8 Feb 2022 13:01:34 +0600 Subject: [PATCH 3/4] workflow update with php 8.1 --- .github/workflows/standard-test-coverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/standard-test-coverage.yml b/.github/workflows/standard-test-coverage.yml index b3a3e03..9aaeaae 100644 --- a/.github/workflows/standard-test-coverage.yml +++ b/.github/workflows/standard-test-coverage.yml @@ -34,7 +34,7 @@ jobs: fail-fast: false matrix: os: [ ubuntu-latest ] - php: [ 7.2, 7.3, 7.4, 8.0 ] + php: [ 7.2, 7.3, 7.4, 8.0, 8.1 ] laravel: [ 6, 7, 8 ] exclude: - php: 7.2 From 185dbc4c9cb330acad4f2d38acc0cd5cb1da4a4b Mon Sep 17 00:00:00 2001 From: Syed Sirajul Islam Anik Date: Tue, 8 Feb 2022 13:03:33 +0600 Subject: [PATCH 4/4] workflow update --- .github/workflows/standard-test-coverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/standard-test-coverage.yml b/.github/workflows/standard-test-coverage.yml index 9aaeaae..b3a3e03 100644 --- a/.github/workflows/standard-test-coverage.yml +++ b/.github/workflows/standard-test-coverage.yml @@ -34,7 +34,7 @@ jobs: fail-fast: false matrix: os: [ ubuntu-latest ] - php: [ 7.2, 7.3, 7.4, 8.0, 8.1 ] + php: [ 7.2, 7.3, 7.4, 8.0 ] laravel: [ 6, 7, 8 ] exclude: - php: 7.2