Skip to content

Commit

Permalink
types correction
Browse files Browse the repository at this point in the history
  • Loading branch information
Masiukevich Maksim committed Feb 13, 2021
1 parent 4fff187 commit 5f8617d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ jobs:
run: composer update --no-ansi --no-interaction --no-progress

- name: Run tests with phpunit
run: XDEBUG_MODE=coverage php ./vendor/bin/phpunit --configuration ./phpunit.xml --coverage-clover=coverage.xml
run: XDEBUG_MODE=coverage php ./vendor/bin/phpunit --configuration ./phpunit.xml --debug --coverage-clover=coverage.xml

- name: Send code coverage report to Codecov.io
uses: codecov/codecov-action@v1
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"require-dev": {
"php-service-bus/code-style-config": "v1.3.*",
"phpunit/phpunit": "v9.5.*",
"vimeo/psalm": "v4.3.*",
"vimeo/psalm": "v4.5.*",
"phpstan/phpstan": "v0.12.*",
"amphp/amp": "v2.5.*"
},
Expand All @@ -62,10 +62,10 @@
"scripts": {
"psalm": "./vendor/bin/psalm --config=psalm.xml",
"phpstan": "./vendor/bin/phpstan analyse src --level 7",
"tests": "./vendor/bin/phpunit --configuration phpunit.xml --verbose",
"coverage": "./vendor/bin/phpunit --configuration phpunit.xml --coverage-html ./coverage --verbose",
"cs-check": "PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix --allow-risky=yes --dry-run",
"cs-fix": "PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix --allow-risky=yes",
"tests": "./vendor/bin/phpunit --configuration phpunit.xml --debug --verbose --debug",
"coverage": "XDEBUG_MODE=coverage ./vendor/bin/phpunit --configuration phpunit.xml --coverage-html ./coverage --debug --verbose --debug",
"cs-check": "./vendor/bin/php-cs-fixer fix --allow-risky=yes --dry-run",
"cs-fix": "./vendor/bin/php-cs-fixer fix --allow-risky=yes",
"pre-commit": "PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix --allow-risky=yes && ./vendor/bin/psalm --config=psalm.xml && ./vendor/bin/phpstan analyse src --level 7 && ./vendor/bin/phpunit --configuration phpunit.xml --verbose"
},
"config": {
Expand Down
7 changes: 3 additions & 4 deletions src/Sql/AmpPosgreSQL/AmpPostgreSQLAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@

namespace ServiceBus\Storage\Sql\AmpPosgreSQL;

use Amp\Postgres\PgSqlCommandResult;
use Amp\Iterator;
use Amp\Postgres\PooledResultSet;
use Amp\Postgres\PqCommandResult;
use Amp\Sql\ResultSet as AmpResultSet;
use Amp\Sql\CommandResult;
use function Amp\call;
use function Amp\Postgres\pool;
use Amp\Coroutine;
Expand Down Expand Up @@ -81,7 +80,7 @@ function () use ($queryString, $parameters) : \Generator
{
$this->logger->debug($queryString, $parameters);

/** @var AmpResultSet|PgSqlCommandResult|PooledResultSet|PqCommandResult $resultSet */
/** @var Iterator|CommandResult|PooledResultSet $resultSet */
$resultSet = yield $this->pool()->execute($queryString, $parameters);

return new AmpPostgreSQLResultSet($resultSet);
Expand Down
21 changes: 11 additions & 10 deletions src/Sql/AmpPosgreSQL/AmpPostgreSQLResultSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@

namespace ServiceBus\Storage\Sql\AmpPosgreSQL;

use Amp\Iterator;
use Amp\Sql\CommandResult;
use function Amp\call;
use Amp\Postgres\PgSqlCommandResult;
use Amp\Postgres\PooledResultSet;
use Amp\Postgres\PqCommandResult;
use Amp\Promise;
use Amp\Sql\ResultSet as AmpResultSet;
use Amp\Success;
use ServiceBus\Storage\Common\Exceptions\ResultSetIterationFailed;
use ServiceBus\Storage\Common\ResultSet;
Expand All @@ -28,7 +29,7 @@
class AmpPostgreSQLResultSet implements ResultSet
{
/**
* @var AmpResultSet|PgSqlCommandResult|PooledResultSet|PqCommandResult
* @var Iterator|CommandResult|PooledResultSet
*/
private $originalResultSet;

Expand All @@ -38,9 +39,9 @@ class AmpPostgreSQLResultSet implements ResultSet
private $advanceCalled = false;

/**
* @param AmpResultSet|PgSqlCommandResult|PooledResultSet|PqCommandResult $originalResultSet
* @param Iterator|CommandResult|PooledResultSet $originalResultSet
*/
public function __construct(object $originalResultSet)
public function __construct(Iterator|CommandResult|PooledResultSet $originalResultSet)
{
$this->originalResultSet = $originalResultSet;
}
Expand All @@ -51,7 +52,7 @@ public function advance(): Promise

try
{
if ($this->originalResultSet instanceof AmpResultSet)
if ($this->originalResultSet instanceof Iterator)
{
return $this->originalResultSet->advance();
}
Expand All @@ -70,14 +71,14 @@ public function getCurrent(): ?array
{
try
{
if (
$this->originalResultSet instanceof PgSqlCommandResult ||
$this->originalResultSet instanceof PqCommandResult
) {
if ($this->originalResultSet instanceof CommandResult)
{
return null;
}

/** @var array<string, float|int|resource|string|null>|null $data */
/**
* @var array<string, float|int|resource|string|null>|null $data
*/
$data = $this->originalResultSet->getCurrent();

return $data;
Expand Down

0 comments on commit 5f8617d

Please sign in to comment.