Skip to content

Commit b94e710

Browse files
authored
Merge pull request #79 from neo4j-php/rework
Rework
2 parents 0abe5c3 + a9eb0e9 commit b94e710

40 files changed

+547
-518
lines changed

.github/workflows/static-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ jobs:
1919
php_version: 8.0
2020
version: 2
2121
- name: "PHP-CS-Fixer"
22-
run: vendor/bin/php-cs-fixer fix --dry-run
22+
run: composer check-cs
2323
- name: "PSalm"
24-
run: ./console debug:config && vendor/bin/psalm --show-info=true
24+
run: composer psalm

.github/workflows/tests.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,8 @@ jobs:
1515
max-parallel: 10
1616
matrix:
1717
php: [ '8.0', '8.1', '8.2']
18-
sf_version: [ '5.4.*', '6.2.*', '6.3.*' ]
18+
sf_version: [ '5.4.*', '6.0.*', '6.3.*' ]
1919
exclude:
20-
- php: 7.4
21-
sf_version: 6.2.*
22-
- php: 8.0
23-
sf_version: 6.2.*
24-
- php: 7.4
25-
sf_version: 6.3.*
2620
- php: 8.0
2721
sf_version: 6.3.*
2822

@@ -39,5 +33,4 @@ jobs:
3933
php_version: ${{ matrix.php }}
4034
memory_limit: 1024M
4135
version: 9
42-
testsuite: Unit
4336
bootstrap: vendor/autoload.php

.php-cs-fixer.dist.php

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
try {
2525
$finder = PhpCsFixer\Finder::create()
2626
->in(__DIR__.'/src')
27+
->in(__DIR__.'/config')
2728
->in(__DIR__.'/tests');
2829
} catch (Throwable $e) {
2930
echo $e->getMessage()."\n";
@@ -35,28 +36,6 @@
3536
->setRiskyAllowed(true)
3637
->setRules([
3738
'@Symfony' => true,
38-
39-
'array_syntax' => ['syntax' => 'short'],
40-
'linebreak_after_opening_tag' => true,
41-
'ordered_imports' => true,
42-
'phpdoc_order' => true,
43-
'phpdoc_to_comment' => false,
44-
'yoda_style' => false,
45-
'declare_strict_types' => true,
46-
'global_namespace_import' => [
47-
'import_classes' => true,
48-
'import_constants' => true,
49-
'import_functions' => true,
50-
],
51-
ConstructorEmptyBracesFixer::name() => true,
52-
IssetToArrayKeyExistsFixer::name() => true,
53-
MultilineCommentOpeningClosingAloneFixer::name() => true,
54-
MultilinePromotedPropertiesFixer::name() => true,
55-
PhpUnitAssertArgumentsOrderFixer::name() => true,
56-
PhpdocNoSuperfluousParamFixer::name() => true,
57-
PhpdocParamOrderFixer::name() => true,
58-
StringableInterfaceFixer::name() => true,
5939
])
6040
->setFinder($finder)
61-
->registerCustomFixers(new PhpCsFixerCustomFixers\Fixers())
6241
;

Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM php:8.1-cli
2+
RUN apt-get update \
3+
&& apt-get install -y \
4+
libzip-dev \
5+
unzip \
6+
git \
7+
wget \
8+
&& docker-php-ext-install -j$(nproc) bcmath sockets \
9+
&& pecl install xdebug \
10+
&& docker-php-ext-enable xdebug && \
11+
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
12+
13+
WORKDIR /opt/project
14+
15+
16+

bin/console.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
use Neo4j\Neo4jBundle\Tests\App\TestKernel;
4+
use Symfony\Bundle\FrameworkBundle\Console\Application;
5+
6+
require __DIR__ . '/../vendor/autoload.php';
7+
8+
$console = new Application(new TestKernel('test', true));
9+
10+
$console->run();

composer.json

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,21 @@
22
"name": "neo4j/neo4j-bundle",
33
"description": "Symfony integration for Neo4j",
44
"type": "symfony-bundle",
5-
"keywords": ["neo4j"],
5+
"keywords": ["neo4j", "symfony", "bundle", "graph", "database", "cypher"],
66
"license": "MIT",
77
"authors": [
8-
{
9-
"name": "Tobias Nyholm",
10-
"email": "[email protected]"
11-
},
12-
{
13-
"name": "Xavier Coureau",
14-
"email": "[email protected]"
15-
},
168
{
179
"name": "Ghlen Nagels",
1810
"email": "[email protected]"
1911
}
2012
],
2113
"require": {
2214
"php": ">=8.0",
23-
"laudis/neo4j-php-client": "dev-main",
15+
"laudis/neo4j-php-client": "^3.0.5",
2416
"twig/twig": "^3.0",
2517
"ext-json": "*",
2618
"symfony/dependency-injection": "^5.4 || ^6.0",
27-
"symfony/config": "^6.0"
19+
"symfony/config": "^5.4 || ^6.0"
2820
},
2921
"require-dev": {
3022
"matthiasnoback/symfony-dependency-injection-test": "^4.3",
@@ -35,9 +27,9 @@
3527
"symfony/http-kernel": "^5.4 || ^6.0",
3628
"symfony/test-pack": "^1.1",
3729
"symfony/yaml": "^5.4 || ^6.0",
38-
"vimeo/psalm": "^5.12",
30+
"vimeo/psalm": "^5.15.0",
3931
"kubawerlos/php-cs-fixer-custom-fixers": "^3.0",
40-
"friendsofphp/php-cs-fixer": "^3.0",
32+
"friendsofphp/php-cs-fixer": "^3.30",
4133
"psalm/plugin-phpunit": "^0.18"
4234
},
4335
"autoload": {
@@ -55,5 +47,10 @@
5547
"allow-plugins": {
5648
"php-http/discovery": false
5749
}
50+
},
51+
"scripts": {
52+
"psalm": "php bin/console.php cache:warmup && vendor/bin/psalm --show-info=true",
53+
"fix-cs": "vendor/bin/php-cs-fixer fix",
54+
"check-cs": "vendor/bin/php-cs-fixer fix --dry-run"
5855
}
5956
}

config/data-collector.xml

Lines changed: 0 additions & 25 deletions
This file was deleted.

config/services.php

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
3+
use Laudis\Neo4j\Basic\Driver;
4+
use Laudis\Neo4j\Basic\Session;
5+
use Laudis\Neo4j\Contracts\ClientInterface;
6+
use Laudis\Neo4j\Contracts\DriverInterface;
7+
use Laudis\Neo4j\Contracts\SessionInterface;
8+
use Laudis\Neo4j\Contracts\TransactionInterface;
9+
use Neo4j\Neo4jBundle\ClientFactory;
10+
use Neo4j\Neo4jBundle\EventHandler;
11+
use Neo4j\Neo4jBundle\EventListener\Neo4jProfileListener;
12+
use Neo4j\Neo4jBundle\SymfonyClient;
13+
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
14+
15+
use function Symfony\Component\DependencyInjection\Loader\Configurator\service;
16+
17+
return static function (ContainerConfigurator $configurator) {
18+
$services = $configurator->services();
19+
20+
$services->set('neo4j.event_handler', EventHandler::class)
21+
->autowire()
22+
->autoconfigure();
23+
24+
$services->set('neo4j.client_factory', ClientFactory::class)
25+
->args([
26+
service('neo4j.event_handler'),
27+
]);
28+
29+
$services->set('neo4j.client', SymfonyClient::class)
30+
->factory([service('neo4j.client_factory'), 'create'])
31+
->public();
32+
33+
$services->set('neo4j.driver', Driver::class)
34+
->factory([service('neo4j.client'), 'getDriver'])
35+
->public();
36+
37+
$services->set('neo4j.session', Session::class)
38+
->factory([service('neo4j.driver'), 'createSession'])
39+
->share(false)
40+
->public();
41+
42+
$services->set('neo4j.transaction', TransactionInterface::class)
43+
->factory([service('neo4j.session'), 'beginTransaction'])
44+
->share(false)
45+
->public();
46+
47+
$services->alias(ClientInterface::class, 'neo4j.client');
48+
$services->alias(DriverInterface::class, 'neo4j.driver');
49+
$services->alias(SessionInterface::class, 'neo4j.session');
50+
$services->alias(TransactionInterface::class, 'neo4j.transaction');
51+
52+
$services->set('neo4j.subscriber', Neo4jProfileListener::class)
53+
->tag('kernel.event_subscriber');
54+
};

config/services.xml

Lines changed: 0 additions & 22 deletions
This file was deleted.

docker-compose.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
version: '3.7'
2+
networks:
3+
neo4j-symfony:
4+
5+
services:
6+
app:
7+
user: ${UID-1000}:${GID-1000}
8+
build:
9+
context: .
10+
ports:
11+
- ${DOCKER_HOST_APP_PORT:-8000}:80
12+
volumes:
13+
- ./:/opt/project
14+
environment:
15+
- NEO4J_HOST=neo4j
16+
- NEO4J_DATABASE=neo4j
17+
- NEO4J_PORT=7687
18+
- NEO4J_USER=neo4j
19+
- NEO4J_PASSWORD=testtest
20+
working_dir: /opt/project
21+
networks:
22+
- neo4j-symfony
23+
24+
neo4j:
25+
environment:
26+
- NEO4J_AUTH=neo4j/testtest
27+
image: neo4j:5
28+
ports:
29+
- ${DOCKER_HOST_NEO4J_HTTP_PORT:-7474}:7474
30+
- ${DOCKER_HOST_NEO4J_BOLT_PORT:-7687}:7687
31+
networks:
32+
- neo4j-symfony
33+

0 commit comments

Comments
 (0)