Skip to content

Commit 58cf2b6

Browse files
authored
Fixed CS and make the build green (#73)
* Fixed CS * Use anyitsolutions * Fixed CS * Syntax fixes * psalm fixes
1 parent 5a79f88 commit 58cf2b6

File tree

15 files changed

+80
-158
lines changed

15 files changed

+80
-158
lines changed

.github/workflows/static.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,19 @@ jobs:
99
- name: Checkout code
1010
uses: actions/checkout@v2
1111

12+
- name: Set up PHP
13+
uses: shivammathur/[email protected]
14+
with:
15+
php-version: 7.4
16+
17+
- name: Download dependencies
18+
run: composer update --no-interaction --prefer-dist --optimize-autoloader --prefer-stable
19+
1220
- name: PHPStan
1321
uses: docker://oskarstark/phpstan-ga
1422
env:
15-
REQUIRE_DEV: true
23+
REQUIRE_DEV: false
24+
CHECK_PLATFORM_REQUIREMENTS: false
1625
with:
1726
args: analyze --no-progress
1827

@@ -35,3 +44,5 @@ jobs:
3544

3645
- name: Psalm
3746
uses: docker://vimeo/psalm-github-actions
47+
env:
48+
CHECK_PLATFORM_REQUIREMENTS: false

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@
44
/phpspec.yml
55
/phpunit.xml
66
/vendor/
7+
.php_cs.cache
8+
.phpunit.result.cache

.php_cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?php
22

3-
/*
4-
* In order to make it work, fabpot/php-cs-fixer and sllh/php-cs-fixer-styleci-bridge must be installed globally
5-
* with composer.
6-
*
7-
* @link https://github.com/Soullivaneuh/php-cs-fixer-styleci-bridge
8-
* @link https://github.com/FriendsOfPHP/PHP-CS-Fixer
9-
*/
3+
$finder = PhpCsFixer\Finder::create()
4+
->in(__DIR__.'/')
5+
->exclude(__DIR__.'/vendor')
6+
;
107

11-
use SLLH\StyleCIBridge\ConfigBridge;
12-
13-
return ConfigBridge::create();
8+
return PhpCsFixer\Config::create()
9+
->setRules([
10+
'@Symfony' => true,
11+
])
12+
->setFinder($finder)
13+
;

.styleci.yml

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

.travis.yml

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

Collector/Neo4jDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function __construct(QueryLogger $logger)
2626
/**
2727
* {@inheritdoc}
2828
*/
29-
public function collect(Request $request, Response $response, \Exception $exception = null)
29+
public function collect(Request $request, Response $response, \Throwable $exception = null)
3030
{
3131
$this->data['time'] = $this->queryLogger->getElapsedTime();
3232
$this->data['nb_queries'] = count($this->queryLogger);

Collector/QueryLogger.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ class QueryLogger implements \Countable
3030
*/
3131
private $statementsHash = [];
3232

33-
/**
34-
* @param StatementInterface $statement
35-
*/
3633
public function record(StatementInterface $statement)
3734
{
3835
$statementText = $statement->text();
@@ -63,9 +60,6 @@ public function record(StatementInterface $statement)
6360
$this->statementsHash[$statementText][$statementParams][$tag] = $idx;
6461
}
6562

66-
/**
67-
* @param StatementResultInterface $statementResult
68-
*/
6963
public function finish(StatementResultInterface $statementResult)
7064
{
7165
$scheme = 'Http';
@@ -103,9 +97,6 @@ public function reset()
10397
$this->statementsHash = [];
10498
}
10599

106-
/**
107-
* @param Neo4jExceptionInterface $exception
108-
*/
109100
public function logException(Neo4jExceptionInterface $exception)
110101
{
111102
$idx = $this->nbQueries - 1;

Collector/Twig/Neo4jResultExtension.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use GraphAware\Neo4j\Client\Formatter\Type\Node;
88
use Twig\Extension\AbstractExtension;
9+
use Twig\TwigFilter;
910

1011
/**
1112
* @author Tobias Nyholm <[email protected]>
@@ -20,14 +21,12 @@ class Neo4jResultExtension extends AbstractExtension
2021
public function getFilters()
2122
{
2223
return [
23-
new \Twig_SimpleFilter('neo4jResult', [$this, 'getType']),
24+
new TwigFilter('neo4jResult', [$this, 'getType']),
2425
];
2526
}
2627

2728
/**
2829
* @param mixed $object
29-
*
30-
* @return string
3130
*/
3231
public function getType($object): string
3332
{
@@ -41,9 +40,6 @@ public function getName(): string
4140

4241
/**
4342
* @param mixed $object
44-
* @param bool $recursive
45-
*
46-
* @return string
4743
*/
4844
private function doGetType($object, bool $recursive): string
4945
{

DependencyInjection/Neo4jExtension.php

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
use GraphAware\Bolt\Driver as BoltDriver;
88
use GraphAware\Neo4j\Client\ClientInterface;
99
use GraphAware\Neo4j\Client\Connection\Connection;
10-
use GraphAware\Neo4j\OGM\EntityManager;
1110
use GraphAware\Neo4j\Client\HttpDriver\Driver as HttpDriver;
11+
use GraphAware\Neo4j\OGM\EntityManager;
1212
use GraphAware\Neo4j\OGM\EntityManagerInterface;
1313
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
1414
use Symfony\Component\Config\FileLocator;
@@ -75,9 +75,6 @@ public function getAlias(): string
7575
}
7676

7777
/**
78-
* @param array $config
79-
* @param ContainerBuilder $container
80-
*
8178
* @return array with service ids
8279
*/
8380
private function handleClients(array &$config, ContainerBuilder $container): array
@@ -93,11 +90,7 @@ private function handleClients(array &$config, ContainerBuilder $container): arr
9390
$serviceIds[$name] = $serviceId = sprintf('neo4j.client.%s', $name);
9491
foreach ($data['connections'] as $connectionName) {
9592
if (empty($config['connections'][$connectionName])) {
96-
throw new InvalidConfigurationException(sprintf(
97-
'Client "%s" is configured to use connection named "%s" but there is no such connection',
98-
$name,
99-
$connectionName
100-
));
93+
throw new InvalidConfigurationException(sprintf('Client "%s" is configured to use connection named "%s" but there is no such connection', $name, $connectionName));
10194
}
10295
$connections[] = $connectionName;
10396
}
@@ -117,25 +110,14 @@ private function handleClients(array &$config, ContainerBuilder $container): arr
117110
return $serviceIds;
118111
}
119112

120-
/**
121-
* @param array $config
122-
* @param ContainerBuilder $container
123-
* @param array $clientServiceIds
124-
*
125-
* @return array
126-
*/
127113
private function handleEntityManagers(array &$config, ContainerBuilder $container, array $clientServiceIds): array
128114
{
129115
$serviceIds = [];
130116
foreach ($config['entity_managers'] as $name => $data) {
131117
$serviceIds[] = $serviceId = sprintf('neo4j.entity_manager.%s', $name);
132118
$clientName = $data['client'];
133119
if (empty($clientServiceIds[$clientName])) {
134-
throw new InvalidConfigurationException(sprintf(
135-
'EntityManager "%s" is configured to use client named "%s" but there is no such client',
136-
$name,
137-
$clientName
138-
));
120+
throw new InvalidConfigurationException(sprintf('EntityManager "%s" is configured to use client named "%s" but there is no such client', $name, $clientName));
139121
}
140122

141123
$definition = class_exists(ChildDefinition::class)
@@ -154,9 +136,6 @@ private function handleEntityManagers(array &$config, ContainerBuilder $containe
154136
}
155137

156138
/**
157-
* @param array $config
158-
* @param ContainerBuilder $container
159-
*
160139
* @return array with service ids
161140
*/
162141
private function handleConnections(array &$config, ContainerBuilder $container): array
@@ -191,10 +170,6 @@ private function handleConnections(array &$config, ContainerBuilder $container):
191170

192171
/**
193172
* Get URL form config.
194-
*
195-
* @param array $config
196-
*
197-
* @return string
198173
*/
199174
private function getUrl(array $config): string
200175
{
@@ -215,8 +190,6 @@ private function getUrl(array $config): string
215190
/**
216191
* Return the correct default port if not manually set.
217192
*
218-
* @param array $config
219-
*
220193
* @return int
221194
*/
222195
private function getPort(array $config)
@@ -246,9 +219,7 @@ private function validateEntityManagers(array &$config): bool
246219
// Add default entity manager if none set.
247220
$config['entity_managers']['default'] = ['client' => 'default'];
248221
} elseif (!$dependenciesInstalled && $entityManagersConfigured) {
249-
throw new \LogicException(
250-
'You need to install "graphaware/neo4j-php-ogm" to be able to use the EntityManager'
251-
);
222+
throw new \LogicException('You need to install "graphaware/neo4j-php-ogm" to be able to use the EntityManager');
252223
}
253224

254225
return $dependenciesInstalled;

EventSubscriber/LoggerSubscriber.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ class LoggerSubscriber implements EventSubscriberInterface
1818
*/
1919
private $queryLogger;
2020

21-
/**
22-
* @param QueryLogger $queryLogger
23-
*/
2421
public function __construct(QueryLogger $queryLogger)
2522
{
2623
$this->queryLogger = $queryLogger;
@@ -38,29 +35,20 @@ public static function getSubscribedEvents()
3835
];
3936
}
4037

41-
/**
42-
* @param PreRunEvent $event
43-
*/
4438
public function onPreRun(PreRunEvent $event)
4539
{
4640
foreach ($event->getStatements() as $statement) {
4741
$this->queryLogger->record($statement);
4842
}
4943
}
5044

51-
/**
52-
* @param PostRunEvent $event
53-
*/
5445
public function onPostRun(PostRunEvent $event)
5546
{
5647
foreach ($event->getResults() as $result) {
5748
$this->queryLogger->finish($result);
5849
}
5950
}
6051

61-
/**
62-
* @param FailureEvent $event
63-
*/
6452
public function onFailure(FailureEvent $event)
6553
{
6654
$this->queryLogger->logException($event->getException());

0 commit comments

Comments
 (0)