Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/4.0.x' into 4.0.x
Browse files Browse the repository at this point in the history
  • Loading branch information
greg0ire committed Dec 1, 2021
2 parents e8acdb9 + 1b3b035 commit 844c575
Show file tree
Hide file tree
Showing 109 changed files with 352 additions and 855 deletions.
22 changes: 11 additions & 11 deletions .appveyor.yml
Expand Up @@ -20,11 +20,11 @@ environment:
- db: mssql
driver: sqlsrv
db_version: sql2017
php: 7.4
php: 8.0
- db: mssql
driver: pdo_sqlsrv
db_version: sql2017
php: 7.4
php: 8.0

init:
- SET PATH=C:\Program Files\OpenSSL;c:\tools\php;C:\tools\composer;%PATH%
Expand Down Expand Up @@ -58,19 +58,19 @@ install:
Add-Content php.ini "`n extension=php_curl.dll"
Add-Content php.ini "`n curl.cainfo=C:\tools\cacert\bundle.pem"
# Use a preview version of the extension that supports PHP 7.4
$DLLVersion = "5.7.1preview"
# Get and install the latest stable sqlsrv DLL's
$DLLVersion = (Invoke-WebRequest "https://pecl.php.net/rest/r/sqlsrv/stable.txt").Content
cd c:\tools\php\ext
$source = "https://windows.php.net/downloads/pecl/releases/sqlsrv/$($DLLVersion)/php_sqlsrv-$($DLLVersion)-$($env:php)-nts-vc15-x64.zip"
$destination = "c:\tools\php\ext\php_sqlsrv-$($DLLVersion)-$($env:php)-nts-vc15-x64.zip"
$source = "https://windows.php.net/downloads/pecl/releases/sqlsrv/$($DLLVersion)/php_sqlsrv-$($DLLVersion)-$($env:php)-nts-vs16-x64.zip"
$destination = "c:\tools\php\ext\php_sqlsrv-$($DLLVersion)-$($env:php)-nts-vs16-x64.zip"
Invoke-WebRequest $source -OutFile $destination
7z x -y php_sqlsrv-$($DLLVersion)-$($env:php)-nts-vc15-x64.zip > $null
$source = "https://windows.php.net/downloads/pecl/releases/pdo_sqlsrv/$($DLLVersion)/php_pdo_sqlsrv-$($DLLVersion)-$($env:php)-nts-vc15-x64.zip"
$destination = "c:\tools\php\ext\php_pdo_sqlsrv-$($DLLVersion)-$($env:php)-nts-vc15-x64.zip"
7z x -y php_sqlsrv-$($DLLVersion)-$($env:php)-nts-vs16-x64.zip > $null
$source = "https://windows.php.net/downloads/pecl/releases/pdo_sqlsrv/$($DLLVersion)/php_pdo_sqlsrv-$($DLLVersion)-$($env:php)-nts-vs16-x64.zip"
$destination = "c:\tools\php\ext\php_pdo_sqlsrv-$($DLLVersion)-$($env:php)-nts-vs16-x64.zip"
Invoke-WebRequest $source -OutFile $destination
7z x -y php_pdo_sqlsrv-$($DLLVersion)-$($env:php)-nts-vc15-x64.zip > $null
7z x -y php_pdo_sqlsrv-$($DLLVersion)-$($env:php)-nts-vs16-x64.zip > $null
$DLLVersion = (Invoke-WebRequest "https://pecl.php.net/rest/r/pcov/stable.txt").Content
Invoke-WebRequest https://windows.php.net/downloads/pecl/releases/pcov/$($DLLVersion)/php_pcov-$($DLLVersion)-7.4-nts-vc15-$($env:platform).zip -OutFile pcov.zip
Invoke-WebRequest https://windows.php.net/downloads/pecl/releases/pcov/$($DLLVersion)/php_pcov-$($DLLVersion)-$($env:php)-nts-vs16-$($env:platform).zip -OutFile pcov.zip
7z x -y pcov.zip > $null
Remove-Item c:\tools\php\* -include .zip
cd c:\tools\php
Expand Down
25 changes: 10 additions & 15 deletions .github/workflows/continuous-integration.yml
Expand Up @@ -22,14 +22,13 @@ jobs:
strategy:
matrix:
php-version:
- "7.4"
- "8.0"
- "8.1"
dependencies:
- "highest"
include:
- dependencies: "lowest"
php-version: "7.4"
php-version: "8.0"

steps:
- name: "Checkout"
Expand Down Expand Up @@ -70,7 +69,6 @@ jobs:
strategy:
matrix:
php-version:
- "7.4"
- "8.1"

services:
Expand Down Expand Up @@ -117,7 +115,6 @@ jobs:
strategy:
matrix:
php-version:
- "7.4"
- "8.1"

services:
Expand Down Expand Up @@ -164,7 +161,7 @@ jobs:
strategy:
matrix:
php-version:
- "7.4"
- "8.0"
postgres-version:
- "9.4"
- "13"
Expand Down Expand Up @@ -222,7 +219,7 @@ jobs:
strategy:
matrix:
php-version:
- "7.4"
- "8.0"
mariadb-version:
- "10.0"
- "10.2"
Expand Down Expand Up @@ -289,7 +286,6 @@ jobs:
strategy:
matrix:
php-version:
- "7.4"
- "8.0"
mysql-version:
- "5.7"
Expand All @@ -300,12 +296,12 @@ jobs:
config-file-suffix:
- ""
include:
- php-version: "7.4"
- php-version: "8.0"
mysql-version: "8.0"
extension: "mysqli"
custom-entrypoint: >-
--entrypoint sh mysql:8 -c "exec docker-entrypoint.sh mysqld --default-authentication-plugin=mysql_native_password"
- php-version: "7.4"
- php-version: "8.0"
mysql-version: "8.0"
extension: "pdo_mysql"
custom-entrypoint: >-
Expand All @@ -316,7 +312,7 @@ jobs:
custom-entrypoint: >-
--entrypoint sh mysql:8 -c "exec docker-entrypoint.sh mysqld --default-authentication-plugin=mysql_native_password"
- config-file-suffix: "-tls"
php-version: "7.4"
php-version: "8.0"
mysql-version: "8.0"
extension: "mysqli"
- php-version: "8.1"
Expand Down Expand Up @@ -385,7 +381,6 @@ jobs:
strategy:
matrix:
php-version:
- "7.4"
- "8.1"
extension:
- "sqlsrv"
Expand All @@ -394,10 +389,10 @@ jobs:
- "Latin1_General_100_CI_AS_SC_UTF8"
include:
- collation: "Latin1_General_100_CS_AS_SC_UTF8"
php-version: "7.4"
php-version: "8.0"
extension: "sqlsrv"
- collation: "Latin1_General_100_CS_AS_SC_UTF8"
php-version: "7.4"
php-version: "8.0"
extension: "pdo_sqlsrv"

services:
Expand Down Expand Up @@ -453,7 +448,7 @@ jobs:
strategy:
matrix:
php-version:
- "7.4"
- "8.0"

services:
ibm_db2:
Expand Down Expand Up @@ -513,7 +508,7 @@ jobs:
strategy:
matrix:
php-version:
- "7.4"
- "8.0"

steps:
- name: "Checkout"
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -31,7 +31,7 @@
{"name": "Jonathan Wage", "email": "jonwage@gmail.com"}
],
"require": {
"php": "^7.4 || ^8.0",
"php": "^8.0",
"composer/package-versions-deprecated": "^1.11.99",
"doctrine/deprecations": "^0.5.3",
"doctrine/event-manager": "^1.0",
Expand Down
2 changes: 1 addition & 1 deletion phpcs.xml.dist
Expand Up @@ -12,7 +12,7 @@
<!-- Show progress of the run and show sniff names -->
<arg value="ps"/>

<config name="php_version" value="70400"/>
<config name="php_version" value="80000"/>

<file>bin</file>
<file>src</file>
Expand Down
7 changes: 0 additions & 7 deletions psalm.xml.dist
Expand Up @@ -211,13 +211,6 @@
<file name="tests/Functional/Driver/AbstractDriverTest.php"/>
</errorLevel>
</RedundantConditionGivenDocblockType>
<!-- Workaround for https://github.com/vimeo/psalm/issues/7026 -->
<ReservedWord>
<errorLevel type="suppress">
<directory name="src"/>
<directory name="tests"/>
</errorLevel>
</ReservedWord>
<TypeDoesNotContainNull>
<errorLevel type="suppress">
<!-- See https://github.com/psalm/psalm-plugin-phpunit/issues/107 -->
Expand Down
20 changes: 4 additions & 16 deletions src/Cache/ArrayResult.php
Expand Up @@ -36,10 +36,7 @@ public function __construct(array $data)
$this->columnCount = count($data[0]);
}

/**
* {@inheritdoc}
*/
public function fetchNumeric()
public function fetchNumeric(): array|false
{
$row = $this->fetch();

Expand All @@ -50,18 +47,12 @@ public function fetchNumeric()
return array_values($row);
}

/**
* {@inheritdoc}
*/
public function fetchAssociative()
public function fetchAssociative(): array|false
{
return $this->fetch();
}

/**
* {@inheritdoc}
*/
public function fetchOne()
public function fetchOne(): mixed
{
$row = $this->fetch();

Expand Down Expand Up @@ -111,10 +102,7 @@ public function free(): void
$this->data = [];
}

/**
* @return mixed|false
*/
private function fetch()
private function fetch(): mixed
{
if (! isset($this->data[$this->num])) {
return false;
Expand Down
14 changes: 7 additions & 7 deletions src/Connection.php
Expand Up @@ -387,7 +387,7 @@ public function setAutoCommit(bool $autoCommit): void
*
* @throws Exception
*/
public function fetchAssociative(string $query, array $params = [], array $types = [])
public function fetchAssociative(string $query, array $params = [], array $types = []): array|false
{
return $this->executeQuery($query, $params, $types)->fetchAssociative();
}
Expand Down Expand Up @@ -419,7 +419,7 @@ public function fetchNumeric(string $query, array $params = [], array $types = [
*
* @throws Exception
*/
public function fetchOne(string $query, array $params = [], array $types = [])
public function fetchOne(string $query, array $params = [], array $types = []): mixed
{
return $this->executeQuery($query, $params, $types)->fetchOne();
}
Expand Down Expand Up @@ -994,7 +994,7 @@ public function getTransactionNestingLevel(): int
*
* @throws Exception
*/
public function lastInsertId()
public function lastInsertId(): int|string
{
try {
return $this->connect()->lastInsertId();
Expand All @@ -1017,7 +1017,7 @@ public function lastInsertId()
*
* @throws Throwable
*/
public function transactional(Closure $func)
public function transactional(Closure $func): mixed
{
$this->beginTransaction();
try {
Expand Down Expand Up @@ -1300,7 +1300,7 @@ public function isRollbackOnly(): bool
*
* @throws Exception
*/
public function convertToDatabaseValue($value, string $type)
public function convertToDatabaseValue(mixed $value, string $type): mixed
{
return Type::getType($type)->convertToDatabaseValue($value, $this->getDatabasePlatform());
}
Expand All @@ -1316,7 +1316,7 @@ public function convertToDatabaseValue($value, string $type)
*
* @throws Exception
*/
public function convertToPHPValue($value, string $type)
public function convertToPHPValue(mixed $value, string $type): mixed
{
return Type::getType($type)->convertToPHPValue($value, $this->getDatabasePlatform());
}
Expand Down Expand Up @@ -1372,7 +1372,7 @@ private function _bindTypedValues(DriverStatement $stmt, array $params, array $t
*
* @throws Exception
*/
private function getBindingInfo($value, $type): array
private function getBindingInfo(mixed $value, int|string|Type|null $type): array
{
if (is_string($type)) {
$type = Type::getType($type);
Expand Down
5 changes: 1 addition & 4 deletions src/Driver/AbstractOracleDriver/EasyConnectString.php
Expand Up @@ -106,10 +106,7 @@ private static function renderParams(array $params): string
return implode('', $chunks);
}

/**
* @param mixed $value
*/
private static function renderValue($value): string
private static function renderValue(mixed $value): string
{
if (is_array($value)) {
return self::renderParams($value);
Expand Down
2 changes: 1 addition & 1 deletion src/Driver/Connection.php
Expand Up @@ -59,7 +59,7 @@ public function exec(string $sql): int;
*
* @throws Exception
*/
public function lastInsertId();
public function lastInsertId(): int|string;

/**
* Initiates a transaction.
Expand Down
5 changes: 1 addition & 4 deletions src/Driver/Exception/UnknownParameterType.php
Expand Up @@ -15,10 +15,7 @@
*/
final class UnknownParameterType extends AbstractException
{
/**
* @param mixed $type
*/
public static function new($type): self
public static function new(int $type): self
{
return new self(sprintf('Unknown parameter type, %d given.', $type));
}
Expand Down
4 changes: 1 addition & 3 deletions src/Driver/FetchUtils.php
Expand Up @@ -10,11 +10,9 @@
final class FetchUtils
{
/**
* @return mixed|false
*
* @throws Exception
*/
public static function fetchOne(Result $result)
public static function fetchOne(Result $result): mixed
{
$row = $result->fetchNumeric();

Expand Down
5 changes: 1 addition & 4 deletions src/Driver/IBMDB2/Connection.php
Expand Up @@ -81,10 +81,7 @@ public function exec(string $sql): int
return db2_num_rows($stmt);
}

/**
* {@inheritDoc}
*/
public function lastInsertId()
public function lastInsertId(): int|string
{
$lastInsertId = db2_last_insert_id($this->connection);

Expand Down
15 changes: 3 additions & 12 deletions src/Driver/IBMDB2/Result.php
Expand Up @@ -30,10 +30,7 @@ public function __construct($statement)
$this->statement = $statement;
}

/**
* {@inheritDoc}
*/
public function fetchNumeric()
public function fetchNumeric(): array|false
{
$row = @db2_fetch_array($this->statement);

Expand All @@ -44,10 +41,7 @@ public function fetchNumeric()
return $row;
}

/**
* {@inheritDoc}
*/
public function fetchAssociative()
public function fetchAssociative(): array|false
{
$row = @db2_fetch_assoc($this->statement);

Expand All @@ -58,10 +52,7 @@ public function fetchAssociative()
return $row;
}

/**
* {@inheritDoc}
*/
public function fetchOne()
public function fetchOne(): mixed
{
return FetchUtils::fetchOne($this);
}
Expand Down

0 comments on commit 844c575

Please sign in to comment.