Skip to content
This repository was archived by the owner on Dec 1, 2021. It is now read-only.

Commit c7bdef1

Browse files
committed
fix code style and static analysis warnings
1 parent 8f73160 commit c7bdef1

15 files changed

+25
-30
lines changed

src/Client.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function __construct(ConnectionManager $connectionManager, EventDispatche
4747
/**
4848
* Run a Cypher statement against the default database or the database specified.
4949
*
50-
* @param $query
50+
* @param string $query
5151
* @param null|array $parameters
5252
* @param null|string $tag
5353
* @param null|string $connectionAlias
@@ -74,7 +74,7 @@ public function run($query, $parameters = null, $tag = null, $connectionAlias =
7474
throw $e;
7575
}
7676

77-
return;
77+
return null;
7878
}
7979

8080
return $result;

src/ClientBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function addConnection($alias, $uri, ConfigInterface $config = null)
8888
$this->config['connections'][$alias]['uri'] = $uri;
8989

9090
if (null !== $config) {
91-
if ($this->config['connections'][$alias]['config'] = $config);
91+
$this->config['connections'][$alias]['config'] = $config;
9292
}
9393

9494
return $this;

src/ClientInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ interface ClientInterface
2727
/**
2828
* Run a Cypher statement against the default database or the database specified.
2929
*
30-
* @param $query
30+
* @param string $query
3131
* @param null|array $parameters
3232
* @param null|string $tag
3333
* @param null|string $connectionAlias

src/Connection/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ private function buildDriver()
174174
$port = isset($params['port']) ? (int) $params['port'] : BoltDriver::DEFAULT_TCP_PORT;
175175
$uri = sprintf('%s://%s:%d', $params['scheme'], $params['host'], $port);
176176
$config = null;
177-
if (isset($params['user']) && isset($params['pass'])) {
177+
if (isset($params['user'], $params['pass'])) {
178178
$config = BoltConfiguration::create()->withCredentials($params['user'], $params['pass']);
179179
}
180180
$this->driver = BoltGraphDB::driver($uri, $config);

src/Exception/Neo4jException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function classification()
5454
{
5555
$parts = explode('.', $this->statusCode);
5656
if (!isset($parts[1])) {
57-
throw new \InvalidArgumentException(sprintf('Could not parse exception classification "%"', $this->statusCode));
57+
throw new \InvalidArgumentException(sprintf('Could not parse exception classification "%s"', $this->statusCode));
5858
}
5959

6060
return $parts[1];

src/Formatter/RecordView.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public function hasValues()
6464
}
6565

6666
/**
67+
* @deprecated Use <code>get()</code> instead
6768
* @param string $key
6869
*
6970
* @return \GraphAware\Neo4j\Client\Formatter\Type\Node|\GraphAware\Neo4j\Client\Formatter\Type\Relationship

src/Formatter/Response.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,8 @@ class Response
3434
public function setRawResponse($rawResponse)
3535
{
3636
$this->rawResponse = $rawResponse;
37-
38-
if (isset($rawResponse['errors'])) {
39-
if (!empty($rawResponse['errors'])) {
40-
$this->errors = $rawResponse['errors'][0];
41-
}
37+
if (!empty($rawResponse['errors'])) {
38+
$this->errors = $rawResponse['errors'][0];
4239
}
4340
}
4441

src/Formatter/Result.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
use GraphAware\Common\Cypher\StatementInterface;
1515
use GraphAware\Common\Result\AbstractRecordCursor;
16-
use GraphAware\Common\Result\Record;
1716
use GraphAware\Neo4j\Client\Formatter\Type\Node;
1817
use GraphAware\Neo4j\Client\Formatter\Type\Path;
1918
use GraphAware\Neo4j\Client\Formatter\Type\Relationship;
@@ -22,11 +21,6 @@
2221

2322
class Result extends AbstractRecordCursor
2423
{
25-
/**
26-
* @var RecordView[]
27-
*/
28-
protected $records = [];
29-
3024
/**
3125
* @var string[]
3226
*/
@@ -103,10 +97,10 @@ public function setGraph(array $graph)
10397
}
10498

10599
/**
106-
* @param $data
107-
* @param $graph
100+
* @param array $data
101+
* @param array $graph
108102
*/
109-
public function pushRecord($data, $graph)
103+
public function pushRecord(array $data, array $graph)
110104
{
111105
$mapped = $this->array_map_deep($data, $graph);
112106
$this->records[] = new RecordView($this->fields, $mapped);

src/HttpDriver/Configuration.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ class Configuration extends BaseConfiguration implements ConfigInterface
3636
protected $curlInterface;
3737

3838
/**
39+
* @param HttpClient|null $httpClient
40+
* @param RequestFactory|null $requestFactory
3941
* @return Configuration
4042
*/
4143
public static function create(HttpClient $httpClient = null, RequestFactory $requestFactory = null)

src/HttpDriver/Driver.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ class Driver implements DriverInterface
3636
*/
3737
public function __construct($uri, ConfigInterface $config = null)
3838
{
39-
if (null !== $config && !$config instanceof BaseConfiguration) {
40-
throw new \RuntimeException(sprintf('Second argument to "%s" must be null or "%s"', __CLASS__, BaseConfiguration::class));
41-
}
42-
4339
$this->uri = $uri;
4440
$this->config = null !== $config ? $config : Configuration::create();
4541
}

src/HttpDriver/Result/ResultSummary.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ class ResultSummary implements ResultSummaryInterface
2626
*/
2727
protected $updateStatistics;
2828

29+
/**
30+
* @var array
31+
*/
2932
protected $notifications;
3033

3134
protected $type;

src/HttpDriver/Result/StatementStatistics.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public function constraintsRemoved()
192192
}
193193

194194
/**
195-
* @param $key
195+
* @param string $key
196196
*
197197
* @return string
198198
*/

src/HttpDriver/Session.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class Session implements SessionInterface
6666
public function __construct($uri, $httpClient, ConfigInterface $config)
6767
{
6868
if ($httpClient instanceof GuzzleClient) {
69-
@trigger_error('Passing a Guzzle client to Session is deprecrated. Will be removed in 5.0. Use a HTTPlug client');
69+
@trigger_error('Passing a Guzzle client to Session is deprecated. Will be removed in 5.0. Use a HTTPlug client', E_USER_DEPRECATED);
7070
$httpClient = new Client($httpClient);
7171
} elseif (!$httpClient instanceof HttpClient) {
7272
throw new \RuntimeException('Second argument to Session::__construct must be an instance of Http\Client\HttpClient.');

src/Stack.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,14 @@ class Stack implements StackInterface
4141
protected $hasWrites = false;
4242

4343
/**
44-
* @param null $tag
44+
* @param null|string $tag
4545
* @param null|string $connectionAlias
4646
*/
4747
public function __construct($tag = null, $connectionAlias = null)
4848
{
49-
$this->tag = null !== $tag ? (string) $tag : null;
49+
if (null !== $tag) {
50+
$this->tag = (string)$tag;
51+
}
5052
$this->connectionAlias = $connectionAlias;
5153
}
5254

@@ -85,7 +87,7 @@ public function pushWrite($query, $parameters = null, $tag = null)
8587
}
8688

8789
/**
88-
* @param $query
90+
* @param string $query
8991
* @param array|null $parameters
9092
* @param array|null $tag
9193
*/

src/StackInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function push($query, $parameters = null, $tag = null);
4141
public function pushWrite($query, $parameters = null, $tag = null);
4242

4343
/**
44-
* @param $query
44+
* @param string $query
4545
* @param array|null $parameters
4646
* @param array|null $tag
4747
*/

0 commit comments

Comments
 (0)