HTG
HTG

Reputation: 584

Declaration of GraphAware\Neo4j\Client\HttpDriver\Session::run() must be compatible with

I'm following the tutorial provided by graphaware, and I keep getting the following error while just trying to perform the basic usage tutorial:

Fatal error: Declaration of GraphAware\Neo4j\Client\HttpDriver\Session::run() must be compatible with GraphAware\Common\Driver\SessionInterface::run($statement, array $parameters = Array, $tag = NULL) in C:\ProgramData\ComposerSetup\bin\vendor\graphaware\neo4j-php-client\src\HttpDriver\Session.php on line 24

This is the code I'm executing:

<?php

require_once 'C:\ProgramData\ComposerSetup\bin\vendor\autoload.php';

use GraphAware\Neo4j\Client\ClientBuilder;

$client = ClientBuilder::create()
->addConnection('default', 'http://neo4j:password@localhost:7474') // Changed the login info back to default
->addConnection('bolt', 'bolt://neo4j:password@localhost:7687') // Changed the login info back to default
->build();

$result = $client->run("MATCH (n:User) RETURN n");

?>

I've tried removing and readding the Neo4J PHP client multiple times, but this does not fix it

I'm using Neo4J v3.0.6 and have had this same problem for days. Any help is appreciated.

EDIT: composer.json

{
"require": {
    "everyman/neo4jphp": "dev-master",
    "graphaware/neo4j-php-client": "4.0"
}
}

Upvotes: 1

Views: 495

Answers (2)

gaurang847
gaurang847

Reputation: 373

I had the same error. The problem was an outdated version of the neo4j-php-client (version 4.0.0). Here's what I did:

  1. Delete the vendor/ folder and composer.lock file from your source folder.

  2. Add a caret in front of the version number in your composer.json:

    "graphaware/neo4j-php-client": "^4.0"
    
  3. Then do a composer install in the source folder through the terminal.

It installed the latest version graphaware/neo4j-php-client (4.6.4) and solved the error.

Upvotes: 2

melo_vet
melo_vet

Reputation: 11

I had the same problem and "solved" it but with a suboptimal solution:

Directly (!) in GraphAware\Common\Driver\SessionInterface, I tried to replace

public function run($statement, array $parameters = Array, $tag = NULL);

by

public function run($statement, $parameters = array(), $tag = null);

which seems to be what is expected by Graphaware\Neo4j\Client\HttpDriver\Session

And it works... for now (until package update?)

Could that be a bug?

Upvotes: 1

Related Questions