Skip to content

Commit

Permalink
Merge pull request #3 from yKanazawa/cakephp4
Browse files Browse the repository at this point in the history
CakePHP4 Support
  • Loading branch information
o0h authored Jan 27, 2020
2 parents 8067ba1 + 8f4bcd5 commit c8daf2f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
language: php

php:
- 7.0
- 7.1
- 7.2
- 7.3
- 7.4snapshot
Expand Down
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"description": "Provides the features for multiple database connections as master/replica and switching.",
"type": "cakephp-plugin",
"require": {
"php": ">=7.0.0",
"cakephp/database": "^3.6"
"php": ">=7.2",
"cakephp/database": "^4.0"
},
"require-dev": {
"phpunit/phpunit": "^5.7.14|^6.0",
"cakephp/cakephp": "^3.6",
"cakephp/cakephp-codesniffer": "^3.0|^4.0@beta"
"phpunit/phpunit": "^8.5",
"cakephp/cakephp": "^4.0",
"cakephp/cakephp-codesniffer": "~4.0.0"
},
"license": "MIT",
"authors": [
Expand All @@ -32,6 +32,6 @@
"test": "phpunit",
"cs-check": "phpcs --colors -p ./src ./tests/TestCase",
"stan": "phpstan.phar analyse src/ tests/TestCase",
"stan-setup": "cp composer.json composer.backup && composer require --dev phpstan/phpstan-shim:^0.11 && mv composer.backup composer.json"
"stan-setup": "cp composer.json composer.backup && composer require --dev phpstan/phpstan:^0.12 && mv composer.backup composer.json"
}
}
5 changes: 3 additions & 2 deletions src/Database/Connection/MasterReplicaConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Cake\Database\Connection;
use Cake\Database\Driver;
use Cake\Database\DriverInterface;

/**
* Connection for handling multi connection(driver) to database.
Expand Down Expand Up @@ -64,9 +65,9 @@ public function switchRole(string $role): self
/**
* Get current role's driver
*
* @return \Cake\Database\Driver Current role's driver
* @return \Cake\Database\DriverInterface Current role's driver
*/
public function getDriver(): Driver
public function getDriver(): DriverInterface
{
return $this->drivers[$this->role];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class MasterReplicaConnectionTest extends TestCase
/**
* {@inheritdoc}
*/
public function setUp()
public function setUp(): void
{
parent::setUp();

Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/MasterReplicaConnectionIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class MasterReplicaConnectionIntegrationTest extends TestCase
/**
* {@inheritDoc}}
*/
public function tearDown()
public function tearDown(): void
{
$connection = ConnectionManager::get('test');
assert($connection instanceof MasterReplicaConnection);
Expand Down

0 comments on commit c8daf2f

Please sign in to comment.