Skip to content

Commit cf7b37c

Browse files
Merge pull request #89 from neo4j-php/88-increase-php-version
implemented minor changes by newer php versions
2 parents 46be213 + 7a3ef07 commit cf7b37c

28 files changed

+118
-268
lines changed

.github/workflows/db-tests.yml renamed to .github/workflows/db-test-php-7.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ on:
99
jobs:
1010
tests:
1111
runs-on: ubuntu-18.04
12-
name: "Running Integration tests for PHP 7.1 on Neo4j ${{ matrix.neo4j-version }}"
12+
name: "Running Integration tests for PHP ${{ matrix.php-version }} on Neo4j ${{ matrix.neo4j-version }}"
1313
strategy:
1414
fail-fast: false
1515
matrix:
1616
neo4j-version: ["3.5", "4.2", "4.3", "4.4"]
17+
php-version: ['7.4']
1718

1819
services:
1920
neo4j:
@@ -34,7 +35,7 @@ jobs:
3435
- name: Setup PHP
3536
uses: shivammathur/setup-php@v2
3637
with:
37-
php-version: '7.1'
38+
php-version: ${{ matrix.php-version }}
3839
extensions: mbstring, sockets
3940
coverage: xdebug
4041
ini-values: max_execution_time=0
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Tests with a database
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
tests:
11+
runs-on: ubuntu-20.04
12+
name: "Running Integration tests for PHP ${{ matrix.php-version }} on Neo4j ${{ matrix.neo4j-version }}"
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
neo4j-version: ["3.5", "4.2", "4.3", "4.4"]
17+
php-version: ['8.0', '8.1']
18+
19+
services:
20+
neo4j:
21+
image: neo4j:${{ matrix.neo4j-version }}
22+
env:
23+
NEO4J_AUTH: neo4j/nothing
24+
NEO4JLABS_PLUGINS: '["apoc"]'
25+
ports:
26+
- 7687:7687
27+
- 7474:7474
28+
options: >-
29+
--health-cmd "wget http://localhost:7474 || exit 1"
30+
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v3
34+
35+
- name: Setup PHP
36+
uses: shivammathur/setup-php@v2
37+
with:
38+
php-version: ${{ matrix.php-version }}
39+
extensions: mbstring, sockets
40+
coverage: xdebug
41+
ini-values: max_execution_time=0
42+
43+
- name: Install dependencies
44+
run: composer install --no-progress
45+
46+
- name: Test with phpunit
47+
run: vendor/bin/phpunit --configuration phpunit.xml --testsuite "Database"

.github/workflows/no-db-test-php-7.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
php-version: ['7.1', '7.2', '7.3', '7.4']
16+
php-version: ['7.4']
1717

1818
steps:
1919
- name: Checkout

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
"license": "MIT",
99
"minimum-stability": "stable",
1010
"require": {
11-
"php": ">=7.1.0",
11+
"php": ">=7.4",
1212
"ext-mbstring": "*"
1313
},
1414
"require-dev": {
15-
"phpunit/phpunit": ">=7.5.0"
15+
"phpunit/phpunit": ">=9"
1616
},
1717
"support": {
1818
"issues": "https://github.com/neo4j-php/Bolt/issues",
@@ -43,7 +43,7 @@
4343
},
4444
"suggest": {
4545
"laudis/neo4j-php-client": "Neo4j-PHP-Client is the most advanced PHP Client for Neo4j",
46-
"ext-sockets": "Needed when using the Bolt\\connection\\Socket",
46+
"ext-sockets": "Needed when using Socket connection class",
4747
"ext-openssl": "Needed when using StreamSocket connection class with SSL"
4848
},
4949
"scripts": {

src/Bolt.php

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,31 +19,11 @@
1919
*/
2020
final class Bolt
2121
{
22-
/**
23-
* @var IPacker
24-
*/
25-
private $packer;
26-
27-
/**
28-
* @var IUnpacker
29-
*/
30-
private $unpacker;
31-
32-
/**
33-
* @var IConnection
34-
*/
35-
private $connection;
36-
37-
/**
38-
* @var array
39-
*/
40-
private $versions = [4.4, 4.3, 4.2, 3];
41-
42-
/**
43-
* Print debug info
44-
* @var bool
45-
*/
46-
public static $debug = false;
22+
private IPacker $packer;
23+
private IUnpacker $unpacker;
24+
private IConnection $connection;
25+
private array $versions = [4.4, 4.3, 4.2, 3];
26+
public static bool $debug = false;
4727

4828
/**
4929
* Bolt constructor

src/PackStream/v1/Packer.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,9 @@ class Packer implements IPacker
3232
private const LARGE = 65536;
3333
private const HUGE = 4294967295;
3434

35-
/**
36-
* @var bool
37-
*/
38-
private $littleEndian;
35+
private bool $littleEndian;
3936

40-
private $structuresLt = [
37+
private array $structuresLt = [
4138
Date::class => [0x44, 'days' => 'packInteger'],
4239
Time::class => [0x54, 'nanoseconds' => 'packInteger', 'tz_offset_seconds' => 'packInteger'],
4340
LocalTime::class => [0x74, 'nanoseconds' => 'packInteger'],

src/PackStream/v1/Unpacker.php

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,12 @@
3030
*/
3131
class Unpacker implements IUnpacker
3232
{
33-
/**
34-
* @var string
35-
*/
36-
private $message;
37-
38-
/**
39-
* @var int
40-
*/
41-
private $offset;
42-
43-
/**
44-
* @var bool
45-
*/
46-
private $littleEndian;
47-
48-
/**
49-
* @var int
50-
*/
51-
private $signature;
33+
private string $message;
34+
private int $offset;
35+
private bool $littleEndian;
36+
private int $signature;
5237

53-
private $structuresLt = [
38+
private array $structuresLt = [
5439
0x4E => [Node::class, 'unpackInteger', 'unpackList', 'unpackMap'],
5540
0x52 => [Relationship::class, 'unpackInteger', 'unpackInteger', 'unpackInteger', 'unpackString', 'unpackMap'],
5641
0x72 => [UnboundRelationship::class, 'unpackInteger', 'unpackString', 'unpackMap'],

src/connection/AConnection.php

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,14 @@
1111
*/
1212
abstract class AConnection implements IConnection
1313
{
14+
protected string $ip;
15+
protected int $port;
16+
protected float $timeout;
1417

1518
/**
16-
* @var string
19+
* @inheritDoc
1720
*/
18-
protected $ip;
19-
20-
/**
21-
* @var int
22-
*/
23-
protected $port;
24-
25-
/**
26-
* @var int
27-
*/
28-
protected $timeout;
29-
30-
/**
31-
* AConnection constructor.
32-
* @param string $ip
33-
* @param int $port
34-
* @param int|float $timeout
35-
*/
36-
public function __construct(string $ip = '127.0.0.1', int $port = 7687, $timeout = 15)
21+
public function __construct(string $ip = '127.0.0.1', int $port = 7687, float $timeout = 15)
3722
{
3823
$this->ip = $ip;
3924
$this->port = $port;

src/connection/IConnection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ interface IConnection
1414
/**
1515
* @param string $ip
1616
* @param int $port
17-
* @param int|float $timeout
17+
* @param float $timeout
1818
*/
19-
public function __construct(string $ip = '127.0.0.1', int $port = 7687, $timeout = 15);
19+
public function __construct(string $ip = '127.0.0.1', int $port = 7687, float $timeout = 15);
2020

2121
public function connect(): bool;
2222

src/connection/Socket.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616
class Socket extends AConnection
1717
{
18-
1918
/**
2019
* @var resource|object|bool
2120
*/

0 commit comments

Comments
 (0)