Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

require PHP 7.1+ #130

Merged
merged 12 commits into from
Jan 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/qa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']

name: PHP ${{ matrix.php }}

Expand Down Expand Up @@ -59,8 +59,6 @@ jobs:

- name: Prepare Env
run: |
PHP_DIR=$(php -r 'echo dirname(php_ini_loaded_file());')
cat $PHP_DIR/php.ini $PHP_DIR/conf.d/*.ini > ./tests/php.ini
cp ./tests/drivers.sample.ini ./tests/drivers.ini
composer install --no-interaction --no-progress

Expand Down
6 changes: 3 additions & 3 deletions composer.bridgeless.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"require-dev": {
"nette/tester": "~1.7",
"mockery/mockery": "~0.9"
"nette/tester": "~2.3",
"mockery/mockery": "~1.3.0"
},
"autoload": {
"psr-4": { "Nextras\\Migrations\\": "src/" },
"classmap": ["src/exceptions.php", "src/deprecated"]
"classmap": ["src/exceptions.php"]
},
"autoload-dev": {
"classmap": ["tests/inc"]
Expand Down
18 changes: 9 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@
"type": "library",
"license": "BSD-3-Clause",
"require": {
"php": ">=5.4"
"php": ">=7.1"
},
"require-dev": {
"dibi/dibi": "~3.0 | ~4.0",
"doctrine/cache": "~1.5",
"doctrine/cache": "~1.11 | ~2.0",
"doctrine/dbal": "~2.5 | ~3.0",
"doctrine/orm": "~2.5",
"mockery/mockery": "~0.9 | ~1.0",
"nette/database": "~2.2",
"nette/di": "~2.3.12 | ~2.4",
"nette/tester": "~1.7 | ~2.0",
"nette/utils": "~2.3",
"mockery/mockery": "~1.3",
"nette/database": "~2.4 | ~3.0",
"nette/di": "~2.4.10 | ~3.0",
"nette/tester": "~2.3",
"nette/utils": "~2.3 | ~3.0 | ~4.0",
"nextras/dbal": "~1.0 | ~2.0 | ~3.0 | ~4.0 | ~5.0@dev",
"symfony/config": "~2.6 | ~3.0 | ~4.0 | ~5.0 | ~6.0",
"symfony/console": "~2.6 | ~3.0 | ~4.0 | ~5.0 | ~6.0",
"symfony/dependency-injection": "~2.6 | ~3.0 | ~4.0 | ~5.0 | ~6.0",
"symfony/framework-bundle": "~2.6 | ~3.0 | ~4.0 | ~5.0 | ~6.0",
"symfony/http-kernel": "~2.6 | ~3.0 | ~4.0 | ~5.0 | ~6.0",
"tracy/tracy": "^2.2",
"tracy/tracy": "~2.6",
"ext-openssl": "*"
},
"suggest": {
Expand All @@ -40,7 +40,7 @@
},
"autoload": {
"psr-4": { "Nextras\\Migrations\\": "src/" },
"classmap": ["src/exceptions.php", "src/deprecated"]
"classmap": ["src/exceptions.php"]
},
"autoload-dev": {
"classmap": ["tests/inc"]
Expand Down
73 changes: 0 additions & 73 deletions src/Bridges/Dibi/Dibi2Adapter.php

This file was deleted.

27 changes: 14 additions & 13 deletions src/Bridges/Dibi/Dibi3Adapter.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types = 1);

/**
* This file is part of the Nextras community extensions of Nette Framework
Expand All @@ -9,7 +9,7 @@

namespace Nextras\Migrations\Bridges\Dibi;

use DateTime;
use DateTimeInterface;
use Dibi;
use Nextras\Migrations\IDbal;

Expand All @@ -26,45 +26,46 @@ public function __construct(Dibi\Connection $dibi)
}


public function query($sql)
public function query(string $sql): array
{
$result = $this->conn->nativeQuery($sql);
$result->setRowClass(NULL);
$result->setRowClass(null);
return $result->fetchAll();
}


public function exec($sql)
public function exec(string $sql): int
{
return $this->conn->nativeQuery($sql);
$this->conn->nativeQuery($sql);
return $this->conn->getAffectedRows();
}


public function escapeString($value)
public function escapeString(string $value): string
{
return $this->conn->getDriver()->escapeText($value);
}


public function escapeInt($value)
public function escapeInt(int $value): string
{
return (string) (int) $value;
return (string) $value;
}


public function escapeBool($value)
public function escapeBool(bool $value): string
{
return $this->conn->getDriver()->escapeBool($value);
return (string) $this->conn->getDriver()->escapeBool($value);
}


public function escapeDateTime(DateTime $value)
public function escapeDateTime(DateTimeInterface $value): string
{
return $this->conn->getDriver()->escapeDateTime($value);
}


public function escapeIdentifier($value)
public function escapeIdentifier(string $value): string
{
return $this->conn->getDriver()->escapeIdentifier($value);
}
Expand Down
24 changes: 11 additions & 13 deletions src/Bridges/Dibi/DibiAdapter.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types = 1);

/**
* This file is part of the Nextras community extensions of Nette Framework
Expand All @@ -9,8 +9,9 @@

namespace Nextras\Migrations\Bridges\Dibi;

use DateTime;
use DateTimeInterface;
use dibi;
use Dibi\Connection;
use LogicException;
use Nextras\Migrations\IDbal;

Expand All @@ -21,57 +22,54 @@ class DibiAdapter implements IDbal
private $innerAdapter;


public function __construct($conn)
public function __construct(Connection $conn)
{
if (version_compare(dibi::VERSION, '3.0.0', '>=')) {
$this->innerAdapter = new Dibi3Adapter($conn);

} elseif (version_compare(dibi::VERSION, '2.0.0', '>=')) {
$this->innerAdapter = new Dibi2Adapter($conn);

} else {
throw new LogicException('Unsupported dibi version');
}
}


public function query($sql)
public function query(string $sql): array
{
return $this->innerAdapter->query($sql);
}


public function exec($sql)
public function exec(string $sql): int
{
return $this->innerAdapter->exec($sql);
}


public function escapeString($value)
public function escapeString(string $value): string
{
return $this->innerAdapter->escapeString($value);
}


public function escapeInt($value)
public function escapeInt(int $value): string
{
return $this->innerAdapter->escapeInt($value);
}


public function escapeBool($value)
public function escapeBool(bool $value): string
{
return $this->innerAdapter->escapeBool($value);
}


public function escapeDateTime(DateTime $value)
public function escapeDateTime(DateTimeInterface $value): string
{
return $this->innerAdapter->escapeDateTime($value);
}


public function escapeIdentifier($value)
public function escapeIdentifier(string $value): string
{
return $this->innerAdapter->escapeIdentifier($value);
}
Expand Down
19 changes: 9 additions & 10 deletions src/Bridges/DoctrineDbal/DoctrineAdapter.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types = 1);

/**
* This file is part of the Nextras community extensions of Nette Framework
Expand All @@ -9,7 +9,7 @@

namespace Nextras\Migrations\Bridges\DoctrineDbal;

use DateTime;
use DateTimeInterface;
use Doctrine;
use Nextras\Migrations\IDbal;

Expand All @@ -26,49 +26,48 @@ public function __construct(Doctrine\DBAL\Connection $conn)
}


public function query($sql)
public function query(string $sql): array
{
return method_exists($this->conn, 'fetchAllAssociative')
? $this->conn->fetchAllAssociative($sql)
: $this->conn->fetchAll($sql);
}


public function exec($sql)
public function exec(string $sql): int
{
return method_exists($this->conn, 'executeStatement')
? $this->conn->executeStatement($sql)
: $this->conn->exec($sql);
}


public function escapeString($value)
public function escapeString(string $value): string
{
return $this->conn->quote($value, 'string');
}


public function escapeInt($value)
public function escapeInt(int $value): string
{
return $this->conn->quote($value, 'integer');
}


public function escapeBool($value)
public function escapeBool(bool $value): string
{
return $this->conn->quote($value, 'boolean');
}


public function escapeDateTime(DateTime $value)
public function escapeDateTime(DateTimeInterface $value): string
{
return $this->conn->quote($value, 'datetime');
}


public function escapeIdentifier($value)
public function escapeIdentifier(string $value): string
{
return $this->conn->quoteIdentifier($value);
}

}
Loading
Loading