Skip to content

Commit 84e01ba

Browse files
authored
updates for php8 (#77)
1 parent 0f13faa commit 84e01ba

File tree

12 files changed

+35
-25
lines changed

12 files changed

+35
-25
lines changed

.circleci/config.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ defaults: &defaults
4343

4444
version: 2
4545
jobs:
46-
build-php71:
46+
build-php72:
4747
<<: *defaults
4848
docker:
49-
- image: php:7.1-alpine
49+
- image: php:7.2-alpine
5050
environment:
5151
ADD_PACKAGES: "php7-apcu php7-memcached"
5252
ADD_MODULES: "mysqli pdo pdo_mysql"
@@ -58,10 +58,10 @@ jobs:
5858
MYSQL_ALLOW_EMPTY_PASSWORD: yes
5959
MYSQL_ROOT_HOST: "%"
6060
- image: memcached:1.4
61-
build-php72:
61+
build-php73:
6262
<<: *defaults
6363
docker:
64-
- image: php:7.2-alpine
64+
- image: php:7.3-alpine
6565
environment:
6666
ADD_PACKAGES: "php7-apcu php7-memcached"
6767
ADD_MODULES: "mysqli pdo pdo_mysql"
@@ -73,10 +73,10 @@ jobs:
7373
MYSQL_ALLOW_EMPTY_PASSWORD: yes
7474
MYSQL_ROOT_HOST: "%"
7575
- image: memcached:1.4
76-
build-php73:
76+
build-php74:
7777
<<: *defaults
7878
docker:
79-
- image: php:7.3-alpine
79+
- image: php:7.4-alpine
8080
environment:
8181
ADD_PACKAGES: "php7-apcu php7-memcached"
8282
ADD_MODULES: "mysqli pdo pdo_mysql"
@@ -88,10 +88,10 @@ jobs:
8888
MYSQL_ALLOW_EMPTY_PASSWORD: yes
8989
MYSQL_ROOT_HOST: "%"
9090
- image: memcached:1.4
91-
build-php74:
91+
build-php80:
9292
<<: *defaults
9393
docker:
94-
- image: php:7.4-alpine
94+
- image: php:8.0-alpine
9595
environment:
9696
ADD_PACKAGES: "php7-apcu php7-memcached"
9797
ADD_MODULES: "mysqli pdo pdo_mysql"
@@ -108,7 +108,7 @@ workflows:
108108
version: 2
109109
build:
110110
jobs:
111-
- build-php71
112111
- build-php72
113112
- build-php73
114113
- build-php74
114+
- build-php80

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616
"packaged/log": "~1.0",
1717
"packaged/querybuilder": "~0.21",
1818
"packaged/config": "~1.1",
19-
"packaged/cassandrathrift": "~22",
19+
"packaged/cassandrathrift": "^20.1.0",
2020
"doctrine/inflector": "~1.0"
2121
},
2222
"suggest": {
2323
"ext-apcu": "*"
2424
},
2525
"require-dev": {
26-
"phpunit/phpunit": "~7"
26+
"phpunit/phpunit": "~8"
2727
},
2828
"autoload": {
2929
"psr-4": {

src/DataTypes/Counter.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@ public function calculated()
3838

3939
public function increment($by = 1)
4040
{
41+
$by = floatval($by);
4142
$this->_adjust += abs($by);
4243
$this->_adjusted = abs($by) > 0;
4344
return $this;
4445
}
4546

4647
public function decrement($by = 1)
4748
{
49+
$by = floatval($by);
4850
$this->_adjust -= abs($by);
4951
$this->_adjusted = abs($by) > 0;
5052
return $this;
@@ -62,7 +64,7 @@ public function isDecrement()
6264

6365
public function isFixedValue()
6466
{
65-
return $this->_adjusted && $this->_adjust === 0;
67+
return $this->_adjusted && $this->_adjust == 0;
6668
}
6769

6870
public function hasChanged()

src/Ql/Cql/CqlDataStore.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ protected function _getCounterValue(QlDao $dao, $field, $value)
5959
{
6060
$value = DecrementExpression::create($field, $newValue->getDecrement());
6161
}
62-
else if($newValue->isFixedValue() && $newValue->hasChanged())
62+
else if($newValue->isFixedValue())
6363
{
64-
if($newValue->current() === null && $newValue->calculated() === 0)
64+
if($newValue->current() === null && $newValue->calculated() == 0)
6565
{
6666
//Allow counter row initialisation
6767
$value = [

src/Ql/Cql/DalSocket.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,15 @@ public function close()
2828
{
2929
$persist = $this->persist_;
3030
$this->persist_ = false;
31-
parent::close();
31+
32+
if(is_resource($this->handle_))
33+
{
34+
parent::close();
35+
}
36+
else
37+
{
38+
$this->handle_ = null;
39+
}
3240
$this->persist_ = $persist;
3341
}
3442

src/Ql/PdoConnection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ protected function _isRecoverableException(\Exception $e)
250250

251251
$code = $e->getCode();
252252
$p = $e->getPrevious();
253-
if(($code === 0) || Strings::startsWith($code, 42)
253+
if(($code == 0) || Strings::startsWith($code, 42)
254254
|| ($p && Strings::startsWith($p->getCode(), 42)))
255255
{
256256
return false;

tests/Cache/Apc/ApcConnectionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
class ApcConnectionTest extends TestCase
1010
{
11-
protected function setUp()
11+
protected function setUp(): void
1212
{
1313
if(!((extension_loaded('apc') || extension_loaded('apcu'))
1414
&& ini_get('apc.enabled'))

tests/Exceptions/Connection/CqlExceptionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ public function testExceptions($exception, $code, $contains)
3131
{
3232
foreach($contains as $contain)
3333
{
34-
$this->assertContains($contain, $formed->getMessage());
34+
$this->assertStringContainsString($contain, $formed->getMessage());
3535
}
3636
}
3737
else
3838
{
39-
$this->assertContains($contains, $formed->getMessage());
39+
$this->assertStringContainsString($contains, $formed->getMessage());
4040
}
4141
$this->assertSame($exception, $formed->getPrevious());
4242
}

tests/Exceptions/Connection/PdoExceptionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ public function testExceptions($exception, $code, $contains)
2525
{
2626
foreach($contains as $contain)
2727
{
28-
$this->assertContains($contain, $formed->getMessage());
28+
$this->assertStringContainsString($contain, $formed->getMessage());
2929
}
3030
}
3131
else
3232
{
33-
$this->assertContains($contains, $formed->getMessage());
33+
$this->assertStringContainsString($contains, $formed->getMessage());
3434
}
3535
$this->assertSame($exception, $formed->getPrevious());
3636
}

tests/FileSystem/FileSystemDataStoreTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ protected function _getResourceLocation($filename)
1919
return Path::system(dirname(__DIR__), 'resources', 'FileSystem', $filename);
2020
}
2121

22-
protected function setUp()
22+
protected function setUp(): void
2323
{
2424
$resolver = new DalResolver();
2525
$resolver->boot();
2626
}
2727

28-
protected function tearDown()
28+
protected function tearDown(): void
2929
{
3030
Dao::unsetDalResolver();
3131
}

0 commit comments

Comments
 (0)