diff --git a/src/Client.php b/src/Client.php index 43f27441..cb7eaa54 100644 --- a/src/Client.php +++ b/src/Client.php @@ -47,7 +47,7 @@ public function __construct(ConnectionManager $connectionManager, EventDispatche /** * Run a Cypher statement against the default database or the database specified. * - * @param $query + * @param string $query * @param null|array $parameters * @param null|string $tag * @param null|string $connectionAlias @@ -74,7 +74,7 @@ public function run($query, $parameters = null, $tag = null, $connectionAlias = throw $e; } - return; + return null; } return $result; diff --git a/src/ClientBuilder.php b/src/ClientBuilder.php index 8fad4011..d618f383 100644 --- a/src/ClientBuilder.php +++ b/src/ClientBuilder.php @@ -88,7 +88,7 @@ public function addConnection($alias, $uri, ConfigInterface $config = null) $this->config['connections'][$alias]['uri'] = $uri; if (null !== $config) { - if ($this->config['connections'][$alias]['config'] = $config); + $this->config['connections'][$alias]['config'] = $config; } return $this; diff --git a/src/ClientInterface.php b/src/ClientInterface.php index 420dc71c..4cf4c95c 100644 --- a/src/ClientInterface.php +++ b/src/ClientInterface.php @@ -27,7 +27,7 @@ interface ClientInterface /** * Run a Cypher statement against the default database or the database specified. * - * @param $query + * @param string $query * @param null|array $parameters * @param null|string $tag * @param null|string $connectionAlias diff --git a/src/Connection/Connection.php b/src/Connection/Connection.php index 89479dd0..7a363d63 100644 --- a/src/Connection/Connection.php +++ b/src/Connection/Connection.php @@ -174,7 +174,7 @@ private function buildDriver() $port = isset($params['port']) ? (int) $params['port'] : BoltDriver::DEFAULT_TCP_PORT; $uri = sprintf('%s://%s:%d', $params['scheme'], $params['host'], $port); $config = null; - if (isset($params['user']) && isset($params['pass'])) { + if (isset($params['user'], $params['pass'])) { $config = BoltConfiguration::create()->withCredentials($params['user'], $params['pass']); } $this->driver = BoltGraphDB::driver($uri, $config); diff --git a/src/Exception/Neo4jException.php b/src/Exception/Neo4jException.php index 82ecb76c..b5efc832 100644 --- a/src/Exception/Neo4jException.php +++ b/src/Exception/Neo4jException.php @@ -54,7 +54,7 @@ public function classification() { $parts = explode('.', $this->statusCode); if (!isset($parts[1])) { - throw new \InvalidArgumentException(sprintf('Could not parse exception classification "%"', $this->statusCode)); + throw new \InvalidArgumentException(sprintf('Could not parse exception classification "%s"', $this->statusCode)); } return $parts[1]; diff --git a/src/Formatter/RecordView.php b/src/Formatter/RecordView.php index d0f713fb..371145a5 100644 --- a/src/Formatter/RecordView.php +++ b/src/Formatter/RecordView.php @@ -64,6 +64,7 @@ public function hasValues() } /** + * @deprecated Use get() instead * @param string $key * * @return \GraphAware\Neo4j\Client\Formatter\Type\Node|\GraphAware\Neo4j\Client\Formatter\Type\Relationship diff --git a/src/Formatter/Response.php b/src/Formatter/Response.php index d419d018..3f899a92 100644 --- a/src/Formatter/Response.php +++ b/src/Formatter/Response.php @@ -34,11 +34,8 @@ class Response public function setRawResponse($rawResponse) { $this->rawResponse = $rawResponse; - - if (isset($rawResponse['errors'])) { - if (!empty($rawResponse['errors'])) { - $this->errors = $rawResponse['errors'][0]; - } + if (!empty($rawResponse['errors'])) { + $this->errors = $rawResponse['errors'][0]; } } diff --git a/src/Formatter/Result.php b/src/Formatter/Result.php index f7fa7bbe..061db3de 100644 --- a/src/Formatter/Result.php +++ b/src/Formatter/Result.php @@ -13,7 +13,6 @@ use GraphAware\Common\Cypher\StatementInterface; use GraphAware\Common\Result\AbstractRecordCursor; -use GraphAware\Common\Result\Record; use GraphAware\Neo4j\Client\Formatter\Type\Node; use GraphAware\Neo4j\Client\Formatter\Type\Path; use GraphAware\Neo4j\Client\Formatter\Type\Relationship; @@ -22,11 +21,6 @@ class Result extends AbstractRecordCursor { - /** - * @var RecordView[] - */ - protected $records = []; - /** * @var string[] */ @@ -103,10 +97,10 @@ public function setGraph(array $graph) } /** - * @param $data - * @param $graph + * @param array $data + * @param array $graph */ - public function pushRecord($data, $graph) + public function pushRecord(array $data, array $graph) { $mapped = $this->array_map_deep($data, $graph); $this->records[] = new RecordView($this->fields, $mapped); diff --git a/src/HttpDriver/Configuration.php b/src/HttpDriver/Configuration.php index 3890d816..aa4848ba 100644 --- a/src/HttpDriver/Configuration.php +++ b/src/HttpDriver/Configuration.php @@ -36,6 +36,8 @@ class Configuration extends BaseConfiguration implements ConfigInterface protected $curlInterface; /** + * @param HttpClient|null $httpClient + * @param RequestFactory|null $requestFactory * @return Configuration */ public static function create(HttpClient $httpClient = null, RequestFactory $requestFactory = null) diff --git a/src/HttpDriver/Driver.php b/src/HttpDriver/Driver.php index 8aa34ba9..dbbe21af 100644 --- a/src/HttpDriver/Driver.php +++ b/src/HttpDriver/Driver.php @@ -36,10 +36,6 @@ class Driver implements DriverInterface */ public function __construct($uri, ConfigInterface $config = null) { - if (null !== $config && !$config instanceof BaseConfiguration) { - throw new \RuntimeException(sprintf('Second argument to "%s" must be null or "%s"', __CLASS__, BaseConfiguration::class)); - } - $this->uri = $uri; $this->config = null !== $config ? $config : Configuration::create(); } diff --git a/src/HttpDriver/Result/ResultSummary.php b/src/HttpDriver/Result/ResultSummary.php index 16984c21..fddc7689 100644 --- a/src/HttpDriver/Result/ResultSummary.php +++ b/src/HttpDriver/Result/ResultSummary.php @@ -26,6 +26,9 @@ class ResultSummary implements ResultSummaryInterface */ protected $updateStatistics; + /** + * @var array + */ protected $notifications; protected $type; diff --git a/src/HttpDriver/Result/StatementStatistics.php b/src/HttpDriver/Result/StatementStatistics.php index c72aa103..be4acba7 100644 --- a/src/HttpDriver/Result/StatementStatistics.php +++ b/src/HttpDriver/Result/StatementStatistics.php @@ -192,7 +192,7 @@ public function constraintsRemoved() } /** - * @param $key + * @param string $key * * @return string */ diff --git a/src/HttpDriver/Session.php b/src/HttpDriver/Session.php index 25026c4d..cacfbf0d 100644 --- a/src/HttpDriver/Session.php +++ b/src/HttpDriver/Session.php @@ -66,7 +66,7 @@ class Session implements SessionInterface public function __construct($uri, $httpClient, ConfigInterface $config) { if ($httpClient instanceof GuzzleClient) { - @trigger_error('Passing a Guzzle client to Session is deprecrated. Will be removed in 5.0. Use a HTTPlug client'); + @trigger_error('Passing a Guzzle client to Session is deprecated. Will be removed in 5.0. Use a HTTPlug client', E_USER_DEPRECATED); $httpClient = new Client($httpClient); } elseif (!$httpClient instanceof HttpClient) { throw new \RuntimeException('Second argument to Session::__construct must be an instance of Http\Client\HttpClient.'); diff --git a/src/Stack.php b/src/Stack.php index 3e5b71b9..bc7787f7 100644 --- a/src/Stack.php +++ b/src/Stack.php @@ -41,12 +41,14 @@ class Stack implements StackInterface protected $hasWrites = false; /** - * @param null $tag + * @param null|string $tag * @param null|string $connectionAlias */ public function __construct($tag = null, $connectionAlias = null) { - $this->tag = null !== $tag ? (string) $tag : null; + if (null !== $tag) { + $this->tag = (string)$tag; + } $this->connectionAlias = $connectionAlias; } @@ -85,7 +87,7 @@ public function pushWrite($query, $parameters = null, $tag = null) } /** - * @param $query + * @param string $query * @param array|null $parameters * @param array|null $tag */ diff --git a/src/StackInterface.php b/src/StackInterface.php index db591c38..8dc8cb7d 100644 --- a/src/StackInterface.php +++ b/src/StackInterface.php @@ -41,7 +41,7 @@ public function push($query, $parameters = null, $tag = null); public function pushWrite($query, $parameters = null, $tag = null); /** - * @param $query + * @param string $query * @param array|null $parameters * @param array|null $tag */