Skip to content

Commit

Permalink
Add .github/workflows with fixes (#52)
Browse files Browse the repository at this point in the history
add .github/workflows with fixes
  • Loading branch information
asanikovich authored Oct 24, 2022
1 parent 3eb4fb7 commit 74536d6
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 44 deletions.
2 changes: 0 additions & 2 deletions .flintci.yml

This file was deleted.

38 changes: 38 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Static analysis

on:
push:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read

jobs:
phpstan:
name: PHPStan
runs-on: Ubuntu-20.04

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: pdo
ini-values: "memory_limit=-1"
coverage: none
tools: phpstan

- name: Install dependencies
run: |
composer config --no-plugins allow-plugins.dealerdirect/phpcodesniffer-composer-installer false
composer install --prefer-dist
- name: phpstan
run: phpstan analyse -l 5 src
48 changes: 48 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Tests

on:
push:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read

jobs:

tests:
name: Tests
runs-on: Ubuntu-20.04

strategy:
matrix:
php-versions: ['7.1', '7.4', '8.0', '8.1']
fail-fast: false

services:
clickhouse:
image: yandex/clickhouse-server
ports:
- 8123:8123

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: pdo
ini-values: "memory_limit=-1"
tools: composer
coverage: xdebug

- name: Install dependencies
run: composer install --prefer-dist

- name: Run tests
run: ./vendor/bin/phpunit --configuration ./phpunit.xml.dist --coverage-text
28 changes: 0 additions & 28 deletions .travis.yml

This file was deleted.

5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,10 @@
"psr-4": {
"FOD\\DBALClickHouse\\Tests\\": "tests/"
}
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
12 changes: 8 additions & 4 deletions src/ClickHouseStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,27 +241,31 @@ public function fetchColumn($columnIndex = 0)
/**
* {@inheritDoc}
*/
public function bindValue($param, $value, $type = null)
public function bindValue($param, $value, $type = null): bool
{
$this->values[$param] = $value;
$this->types[$param] = $type;

return true;
}

/**
* {@inheritDoc}
*/
public function bindParam($column, &$variable, $type = null, $length = null)
public function bindParam($column, &$variable, $type = null, $length = null): bool
{
$this->values[$column] = &$variable;
$this->types[$column] = $type;

return true;
}

public function errorCode() : void
public function errorCode() : int
{
throw new ClickHouseException('You need to implement ClickHouseStatement::' . __METHOD__ . '()');
}

public function errorInfo() : void
public function errorInfo() : array
{
throw new ClickHouseException('You need to implement ClickHouseStatement::' . __METHOD__ . '()');
}
Expand Down
20 changes: 10 additions & 10 deletions src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ public function executeUpdate($query, array $params = [], array $types = []) : i
/**
* @throws ClickHouseException
*/
public function delete($tableExpression, array $identifier, array $types = []) : void
public function delete($tableExpression, array $identifier, array $types = []) : int
{
throw ClickHouseException::notSupported(__METHOD__);
}

/**
* @throws ClickHouseException
*/
public function update($tableExpression, array $data, array $identifier, array $types = []) : void
public function update($tableExpression, array $data, array $identifier, array $types = []) : int
{
throw ClickHouseException::notSupported(__METHOD__);
}
Expand All @@ -60,23 +60,23 @@ public function update($tableExpression, array $data, array $identifier, array $
/**
* @throws ClickHouseException
*/
public function setTransactionIsolation($level) : void
public function setTransactionIsolation($level) : int
{
throw ClickHouseException::notSupported(__METHOD__);
}

/**
* @throws ClickHouseException
*/
public function getTransactionIsolation() : void
public function getTransactionIsolation() : int
{
throw ClickHouseException::notSupported(__METHOD__);
}

/**
* @throws ClickHouseException
*/
public function getTransactionNestingLevel() : void
public function getTransactionNestingLevel() : int
{
throw ClickHouseException::notSupported(__METHOD__);
}
Expand All @@ -100,31 +100,31 @@ public function setNestTransactionsWithSavepoints($nestTransactionsWithSavepoint
/**
* @throws ClickHouseException
*/
public function getNestTransactionsWithSavepoints() : void
public function getNestTransactionsWithSavepoints() : bool
{
throw ClickHouseException::notSupported(__METHOD__);
}

/**
* @throws ClickHouseException
*/
public function beginTransaction() : void
public function beginTransaction() : bool
{
throw ClickHouseException::notSupported(__METHOD__);
}

/**
* @throws ClickHouseException
*/
public function commit() : void
public function commit() : bool
{
throw ClickHouseException::notSupported(__METHOD__);
}

/**
* @throws ClickHouseException
*/
public function rollBack() : void
public function rollBack() : bool
{
throw ClickHouseException::notSupported(__METHOD__);
}
Expand Down Expand Up @@ -164,7 +164,7 @@ public function setRollbackOnly() : void
/**
* @throws ClickHouseException
*/
public function isRollbackOnly() : void
public function isRollbackOnly() : bool
{
throw ClickHouseException::notSupported(__METHOD__);
}
Expand Down

0 comments on commit 74536d6

Please sign in to comment.