Skip to content

Commit bc077bc

Browse files
authored
Merge pull request #100 from opis/php8-support
Php8 support
2 parents 5f6839e + 4f2138e commit bc077bc

File tree

7 files changed

+36
-8
lines changed

7 files changed

+36
-8
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
fail-fast: true
1414
matrix:
15-
php: [7.0, 7.1, 7.2, 7.3, 7.4]
15+
php: [7.1, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3]
1616

1717
name: PHP ${{ matrix.php }}
1818

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

5+
## v4.3.0 - 2024-09-29
6+
7+
### Added
8+
9+
- Support for PHP 8
10+
511
## v4.2.1 - 2021-04-14
612

713
### Fixed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ The full documentation for this library can be found [here][documentation]
2727

2828
## Requirements
2929

30-
* PHP 7.0.* or higher
30+
* PHP 7 or higher
3131
* PDO
3232

3333
## Installation

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
"test": "vendor/bin/phpunit"
1919
},
2020
"require": {
21-
"php": "^7.0",
21+
"php": "^7.0 || ^8.0",
2222
"ext-pdo": "*"
2323
},
2424
"require-dev": {
25-
"phpunit/phpunit": "^6.5 || ^7.0",
25+
"phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0",
2626
"symfony/yaml": "^3.4"
2727
},
2828
"autoload": {

src/Connection.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,4 +633,26 @@ public function unserialize($data)
633633
$this->{$key} = $value;
634634
}
635635
}
636+
637+
public function __serialize()
638+
{
639+
return [
640+
'username' => $this->username,
641+
'password' => $this->password,
642+
'logQueries' => $this->logQueries,
643+
'options' => $this->options,
644+
'commands' => $this->commands,
645+
'dsn' => $this->dsn,
646+
];
647+
}
648+
649+
public function __unserialize(array $data)
650+
{
651+
$this->username = $data['username'];
652+
$this->password = $data['password'];
653+
$this->logQueries = $data['logQueries'];
654+
$this->options = $data['options'];
655+
$this->commands = $data['commands'];
656+
$this->dsn = $data['dsn'];
657+
}
636658
}

tests/SQL/BaseClass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ class BaseClass extends TestCase
2828
/** @var Database */
2929
protected $db;
3030

31-
public static function setUpBeforeClass()
31+
public static function setUpBeforeClass(): void
3232
{
3333
static::$database = new Database(new Connection(''));
3434
}
3535

36-
public function setUp()
36+
public function setUp(): void
3737
{
3838
$this->db = static::$database;
3939
}

tests/Schema/BaseClass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class BaseClass extends TestCase
3737
/** @var Schema */
3838
protected $schema;
3939

40-
public static function setUpBeforeClass()
40+
public static function setUpBeforeClass(): void
4141
{
4242
$name = static::$schema_name;
4343

@@ -50,7 +50,7 @@ public static function setUpBeforeClass()
5050
static::$db_schema = new Schema(new Connection($name));
5151
}
5252

53-
public function setUp()
53+
public function setUp(): void
5454
{
5555
$this->schema = static::$db_schema;
5656
}

0 commit comments

Comments
 (0)