diff --git a/src/Authentication/AuthenticateInterface.php b/src/Authentication/AuthenticateInterface.php index 1fb5b74d..ce53aeec 100644 --- a/src/Authentication/AuthenticateInterface.php +++ b/src/Authentication/AuthenticateInterface.php @@ -4,9 +4,6 @@ use Psr\Http\Message\RequestInterface; -/** - * @api - */ interface AuthenticateInterface { public function getHeader(): string; diff --git a/src/Authentication/BasicAuthentication.php b/src/Authentication/BasicAuthentication.php index fd48302a..9b91803b 100644 --- a/src/Authentication/BasicAuthentication.php +++ b/src/Authentication/BasicAuthentication.php @@ -4,10 +4,7 @@ use Psr\Http\Message\RequestInterface; -/** - * @api - */ -class BasicAuthentication implements AuthenticateInterface +final class BasicAuthentication implements AuthenticateInterface { private string $username; private string $password; diff --git a/src/Authentication/BearerAuthentication.php b/src/Authentication/BearerAuthentication.php index 29c86bd3..a36471af 100644 --- a/src/Authentication/BearerAuthentication.php +++ b/src/Authentication/BearerAuthentication.php @@ -4,10 +4,7 @@ use Psr\Http\Message\RequestInterface; -/** - * @api - */ -class BearerAuthentication implements AuthenticateInterface +final class BearerAuthentication implements AuthenticateInterface { public function __construct(private string $token) { diff --git a/src/Authentication/NoAuth.php b/src/Authentication/NoAuth.php index 7da1d470..4b1000bb 100644 --- a/src/Authentication/NoAuth.php +++ b/src/Authentication/NoAuth.php @@ -4,10 +4,7 @@ use Psr\Http\Message\RequestInterface; -/** - * @api - */ -class NoAuth implements AuthenticateInterface +final class NoAuth implements AuthenticateInterface { #[\Override] public function getHeader(): string diff --git a/src/Exception/Neo4jException.php b/src/Exception/Neo4jException.php index bd4ba314..9b8aed92 100644 --- a/src/Exception/Neo4jException.php +++ b/src/Exception/Neo4jException.php @@ -4,15 +4,12 @@ use Exception; -/** - * @api - */ -class Neo4jException extends Exception +final class Neo4jException extends Exception { - private readonly string $errorCode; - private readonly ?string $errorType; - private readonly ?string $errorSubType; - private readonly ?string $errorName; + public readonly string $errorCode; + public readonly ?string $errorType; + public readonly ?string $errorSubType; + public readonly ?string $errorName; public function __construct( array $errorDetails = [], @@ -31,7 +28,6 @@ public function __construct( /** * Create a Neo4jException instance from a Neo4j error response array. - * * @param array $response The error response from Neo4j. * @param \Throwable|null $exception Optional previous exception for chaining. * @return self @@ -44,23 +40,4 @@ public static function fromNeo4jResponse(array $response, ?\Throwable $exception return new self($errorDetails, previous: $exception); } - public function getErrorCode(): string - { - return $this->errorCode; - } - - public function getType(): ?string - { - return $this->errorType; - } - - public function getSubType(): ?string - { - return $this->errorSubType; - } - - public function getName(): ?string - { - return $this->errorName; - } } diff --git a/src/Neo4jQueryAPI.php b/src/Neo4jQueryAPI.php index 1df98680..765ebe78 100644 --- a/src/Neo4jQueryAPI.php +++ b/src/Neo4jQueryAPI.php @@ -22,9 +22,6 @@ public function __construct( ) { } - /** - * @api - */ public static function login(string $address, AuthenticateInterface $auth = null): self { $client = Psr18ClientDiscovery::find(); diff --git a/src/Neo4jRequestFactory.php b/src/Neo4jRequestFactory.php index 3003af26..600427db 100644 --- a/src/Neo4jRequestFactory.php +++ b/src/Neo4jRequestFactory.php @@ -8,10 +8,7 @@ use Psr\Http\Message\RequestInterface; use Psr\Http\Message\StreamFactoryInterface; -/** - * @api - */ -class Neo4jRequestFactory +final class Neo4jRequestFactory { public function __construct( private RequestFactoryInterface $psr17Factory, diff --git a/src/OGM.php b/src/OGM.php index 65517fd7..b9200826 100644 --- a/src/OGM.php +++ b/src/OGM.php @@ -8,10 +8,7 @@ use Neo4j\QueryAPI\Objects\Path; use InvalidArgumentException; -/** - * @api - */ -class OGM +final class OGM { /** * @param array $data @@ -57,44 +54,18 @@ private function mapNode(array $nodeData): Node { return new Node( labels: $nodeData['_labels'] ?? [], - properties: $this->mapProperties($nodeData['_properties'] ?? []) // ✅ Fix: Ensure properties exist + properties: $this->mapProperties($nodeData['_properties'] ?? []) ); } private function mapRelationship(array $relationshipData): Relationship { return new Relationship( - type: $relationshipData['_type'] ?? 'UNKNOWN', // ✅ Fix: Default to 'UNKNOWN' + type: $relationshipData['_type'] ?? 'UNKNOWN', properties: $this->mapProperties($relationshipData['_properties'] ?? []) ); } - - public static function parseWKT(string $wkt): Point - { - $sridPos = strpos($wkt, ';'); - if ($sridPos === false) { - throw new \InvalidArgumentException("Invalid WKT format: missing ';'"); - } - $sridPart = substr($wkt, 0, $sridPos); - $srid = (int)str_replace('SRID=', '', $sridPart); - - $pointPos = strpos($wkt, 'POINT'); - if ($pointPos === false) { - throw new \InvalidArgumentException("Invalid WKT format: missing 'POINT'"); - } - $pointPart = substr($wkt, $pointPos + 6); - - $pointPart = str_replace('Z', '', $pointPart); - $pointPart = trim($pointPart, ' ()'); - $coordinates = explode(' ', $pointPart); - - [$x, $y, $z] = array_pad(array_map('floatval', $coordinates), 3, 0.0); - - return new Point($x, $y, $z, $srid); - } - - private function mapPath(array $pathData): Path { $nodes = []; diff --git a/src/Objects/Authentication.php b/src/Objects/Authentication.php index 166c7468..710d988d 100644 --- a/src/Objects/Authentication.php +++ b/src/Objects/Authentication.php @@ -7,10 +7,7 @@ use Neo4j\QueryAPI\Authentication\BearerAuthentication; use Neo4j\QueryAPI\Authentication\NoAuth; -/** - * @api - */ -class Authentication +final class Authentication { public static function basic(string $username, string $password): AuthenticateInterface { diff --git a/src/Objects/Bookmarks.php b/src/Objects/Bookmarks.php index a79215a5..d158552c 100644 --- a/src/Objects/Bookmarks.php +++ b/src/Objects/Bookmarks.php @@ -4,10 +4,7 @@ use JsonSerializable; -/** - * @api - */ -class Bookmarks implements \Countable, JsonSerializable +final class Bookmarks implements \Countable, JsonSerializable { public function __construct(private array $bookmarks) { diff --git a/src/Objects/Node.php b/src/Objects/Node.php index 4fe6e844..5648f47c 100644 --- a/src/Objects/Node.php +++ b/src/Objects/Node.php @@ -6,9 +6,6 @@ * Represents a Neo4j Node with labels and properties. */ -/** - * @api - */ class Node { /** @@ -35,7 +32,6 @@ public function __construct(array $labels, array $properties) /** * Get the labels of the node. - * @api * @return string[] Array of labels. */ public function getLabels(): array @@ -45,7 +41,6 @@ public function getLabels(): array /** * Get the properties of the node. - * @api * @return array Associative array of properties. */ public function getProperties(): array @@ -55,7 +50,6 @@ public function getProperties(): array /** * Convert the Node object to an array representation. - * @api * @return array Node data as an array. */ public function toArray(): array diff --git a/src/Objects/Path.php b/src/Objects/Path.php index 2d15c2af..90f064a3 100644 --- a/src/Objects/Path.php +++ b/src/Objects/Path.php @@ -6,10 +6,8 @@ * Represents a path in a Neo4j graph, consisting of nodes and relationships. */ -/** - * @api - */ -class Path + +final class Path { /** * @var Node[] Array of nodes in the path. @@ -35,7 +33,6 @@ public function __construct(array $nodes, array $relationships) /** * Get the nodes in the path. - * @api * @return Node[] Array of nodes. */ public function getNodes(): array @@ -45,7 +42,6 @@ public function getNodes(): array /** * Get the relationships in the path. - * @api * @return Relationship[] Array of relationships. */ public function getRelationships(): array diff --git a/src/Objects/Person.php b/src/Objects/Person.php index b1f04313..a6156b09 100644 --- a/src/Objects/Person.php +++ b/src/Objects/Person.php @@ -6,10 +6,7 @@ * @psalm-suppress UnusedClass * Represents a Person node in the Neo4j graph. */ -/** - * @api - */ -class Person extends Node +final class Person extends Node { /** * Person constructor. diff --git a/src/Objects/Point.php b/src/Objects/Point.php index 721abe4a..d6191576 100644 --- a/src/Objects/Point.php +++ b/src/Objects/Point.php @@ -5,11 +5,9 @@ /** * Represents a point with x, y, z coordinates, and SRID (Spatial Reference System Identifier). */ -/** - * @api - */ -class Point + +final class Point { /** * @param float $x The x coordinate of the point. @@ -27,7 +25,6 @@ public function __construct( /** * Get the x coordinate of the point. - * @api * @return float x coordinate value. */ public function getX(): float @@ -37,7 +34,6 @@ public function getX(): float /** * Get the y coordinate of the point. - * @api * @return float y coordinate value. */ public function getY(): float @@ -47,7 +43,6 @@ public function getY(): float /** * Get the z coordinate of the point. - * @api * @return float|null z coordinate value, or null if not applicable. */ public function getZ(): float|null @@ -57,7 +52,6 @@ public function getZ(): float|null /** * Get the SRID (Spatial Reference System Identifier) of the point. - * @api * @return int SRID value. */ public function getSrid(): int @@ -67,7 +61,6 @@ public function getSrid(): int /** * Convert the Point object to a string representation. - * * @return string String representation in the format: "SRID=;POINT ( )". */ public function __toString(): string diff --git a/src/Objects/ProfiledQueryPlanArguments.php b/src/Objects/ProfiledQueryPlanArguments.php index 889c49ab..a56cfd2f 100644 --- a/src/Objects/ProfiledQueryPlanArguments.php +++ b/src/Objects/ProfiledQueryPlanArguments.php @@ -2,10 +2,7 @@ namespace Neo4j\QueryAPI\Objects; -/** - * @api - */ -class ProfiledQueryPlanArguments +final class ProfiledQueryPlanArguments { public function __construct( public readonly ?int $globalMemory = null, diff --git a/src/Objects/Relationship.php b/src/Objects/Relationship.php index 156e3116..7ab3d953 100644 --- a/src/Objects/Relationship.php +++ b/src/Objects/Relationship.php @@ -6,10 +6,7 @@ * Represents a relationship in a Neo4j graph, with a type and associated properties. */ -/** - * @api - */ -class Relationship +final class Relationship { /** * @var string The type of the relationship (e.g., "FRIENDS_WITH", "WORKS_FOR"). @@ -22,8 +19,7 @@ class Relationship private array $properties; /** - * Relationship constructor. - * + * Relationship constructor * @param string $type The type of the relationship. * @param array $properties Associative array of properties for the relationship. */ @@ -34,8 +30,7 @@ public function __construct(string $type, array $properties = []) } /** - * Get the type of the relationship. - * @api + * Get the type of the relationship * @return string The type of the relationship. */ public function getType(): string @@ -45,7 +40,6 @@ public function getType(): string /** * Get the properties of the relationship. - * @api * @return array Associative array of properties. */ public function getProperties(): array diff --git a/src/Objects/ResultCounters.php b/src/Objects/ResultCounters.php index d041e1cf..7deb0b71 100644 --- a/src/Objects/ResultCounters.php +++ b/src/Objects/ResultCounters.php @@ -2,102 +2,24 @@ namespace Neo4j\QueryAPI\Objects; -/** - * @api - */ -class ResultCounters +final class ResultCounters { public function __construct( - private readonly bool $containsUpdates = false, - private readonly int $nodesCreated = 0, - private readonly int $nodesDeleted = 0, - private readonly int $propertiesSet = 0, - private readonly int $relationshipsCreated = 0, - private readonly int $relationshipsDeleted = 0, - private readonly int $labelsAdded = 0, - private readonly int $labelsRemoved = 0, - private readonly int $indexesAdded = 0, - private readonly int $indexesRemoved = 0, - private readonly int $constraintsAdded = 0, - private readonly int $constraintsRemoved = 0, - private readonly bool $containsSystemUpdates = false, - private readonly int $systemUpdates = 0 + public readonly bool $containsUpdates = false, + public readonly int $nodesCreated = 0, + public readonly int $nodesDeleted = 0, + public readonly int $propertiesSet = 0, + public readonly int $relationshipsCreated = 0, + public readonly int $relationshipsDeleted = 0, + public readonly int $labelsAdded = 0, + public readonly int $labelsRemoved = 0, + public readonly int $indexesAdded = 0, + public readonly int $indexesRemoved = 0, + public readonly int $constraintsAdded = 0, + public readonly int $constraintsRemoved = 0, + public readonly bool $containsSystemUpdates = false, + public readonly int $systemUpdates = 0 ) { } - - - - public function ContainsSystemUpdates(): bool - { - return $this->containsSystemUpdates; - } - - - public function containsUpdates(): bool - { - return $this->containsUpdates; - } - - public function getNodesCreated(): int - { - return $this->nodesCreated; - } - - - public function getNodesDeleted(): int - { - return $this->nodesDeleted; - } - - - public function getPropertiesSet(): int - { - return $this->propertiesSet; - } - - public function getRelationshipsCreated(): int - { - return $this->relationshipsCreated; - } - - public function getRelationshipsDeleted(): int - { - return $this->relationshipsDeleted; - } - - public function getLabelsAdded(): int - { - return $this->labelsAdded; - } - - public function getIndexesAdded(): int - { - return $this->indexesAdded; - } - - public function getIndexesRemoved(): int - { - return $this->indexesRemoved; - } - - public function getConstraintsAdded(): int - { - return $this->constraintsAdded; - } - - public function getConstraintsRemoved(): int - { - return $this->constraintsRemoved; - } - - public function getSystemUpdates(): int - { - return $this->systemUpdates; - } - - public function getLabelsRemoved(): int - { - return $this->labelsRemoved; - } } diff --git a/src/ResponseParser.php b/src/ResponseParser.php index 4bc440bc..78d006fa 100644 --- a/src/ResponseParser.php +++ b/src/ResponseParser.php @@ -12,7 +12,6 @@ use Neo4j\QueryAPI\Results\ResultRow; use RuntimeException; use Neo4j\QueryAPI\Objects\ProfiledQueryPlan; -use Neo4j\QueryAPI\Objects\Point; final class ResponseParser { diff --git a/src/Results/ResultSet.php b/src/Results/ResultSet.php index 63be9b18..b9aa74c9 100644 --- a/src/Results/ResultSet.php +++ b/src/Results/ResultSet.php @@ -12,11 +12,10 @@ use Traversable; /** - * @api * @template TValue * @implements IteratorAggregate */ -class ResultSet implements IteratorAggregate, Countable +final class ResultSet implements IteratorAggregate, Countable { /** * @param list $rows @@ -49,9 +48,6 @@ public function getProfiledQueryPlan(): ?ProfiledQueryPlan return $this->profiledQueryPlan; } - /** - * @api - */ #[\Override] public function count(): int { diff --git a/src/Transaction.php b/src/Transaction.php index 0e85c5f9..5636a949 100644 --- a/src/Transaction.php +++ b/src/Transaction.php @@ -7,12 +7,8 @@ use Psr\Http\Client\ClientInterface; use Psr\Http\Client\RequestExceptionInterface; use Psr\Http\Message\ResponseInterface; -use stdClass; -/** - * @api - */ -class Transaction +final class Transaction { public function __construct( private ClientInterface $client, @@ -25,7 +21,6 @@ public function __construct( /** * Execute a Cypher query within the transaction. - * @api * @param string $query The Cypher query to be executed. * @param array $parameters Parameters for the query. * @return ResultSet The result rows in ResultSet format. @@ -35,7 +30,7 @@ public function run(string $query, array $parameters): ResultSet { $request = $this->requestFactory->buildTransactionRunRequest($query, $parameters, $this->transactionId, $this->clusterAffinity); - $response = null; // ✅ Ensures response is always defined + $response = null; try { $response = $this->client->sendRequest($request); @@ -50,18 +45,12 @@ public function run(string $query, array $parameters): ResultSet return $this->responseParser->parseRunQueryResponse($response); } - /** - * @api - */ public function commit(): void { $request = $this->requestFactory->buildCommitRequest($this->transactionId, $this->clusterAffinity); $this->client->sendRequest($request); } - /** - * @api - */ public function rollback(): void { $request = $this->requestFactory->buildRollbackRequest($this->transactionId, $this->clusterAffinity); @@ -75,7 +64,6 @@ public function rollback(): void */ private function handleRequestException(RequestExceptionInterface $e): void { - // ✅ Corrected: Check if exception has a response $response = method_exists($e, 'getResponse') ? $e->getResponse() : null; if ($response instanceof ResponseInterface) { diff --git a/tests/Integration/Neo4jOGMTest.php b/tests/Integration/Neo4jOGMTest.php index de6dc0be..0ad24fb9 100644 --- a/tests/Integration/Neo4jOGMTest.php +++ b/tests/Integration/Neo4jOGMTest.php @@ -5,12 +5,8 @@ use Neo4j\QueryAPI\OGM; use PHPUnit\Framework\TestCase; -/** - * @api - */ -class Neo4jOGMTest extends TestCase +final class Neo4jOGMTest extends TestCase { - /** @psalm-suppress PropertyNotSetInConstructor */ private OGM $ogm; #[\Override] @@ -36,7 +32,6 @@ public function testWithNode(): void $this->assertEquals('Ayush', $node->getProperties()['name']['_value']); } - // Example of using $ogm in another test public function testWithSimpleRelationship(): void { // Mapping the Relationship @@ -51,8 +46,6 @@ public function testWithSimpleRelationship(): void $relationship = $this->ogm->map($relationshipData); $this->assertEquals('FRIENDS', $relationship->getType()); } - - // More tests... public function testWithPath(): void { $pathData = [ @@ -63,7 +56,7 @@ public function testWithPath(): void '_value' => [ '_labels' => ['Person'], '_properties' => [ - 'name' => ['_value' => 'A'], // ✅ Now correctly wrapped + 'name' => ['_value' => 'A'], ], ], ], @@ -79,7 +72,7 @@ public function testWithPath(): void '_value' => [ '_labels' => ['Person'], '_properties' => [ - 'name' => ['_value' => 'B'], // ✅ Now correctly wrapped + 'name' => ['_value' => 'B'], ], ], ], diff --git a/tests/Integration/Neo4jQueryAPIIntegrationTest.php b/tests/Integration/Neo4jQueryAPIIntegrationTest.php index ba7a74de..ff79ac41 100644 --- a/tests/Integration/Neo4jQueryAPIIntegrationTest.php +++ b/tests/Integration/Neo4jQueryAPIIntegrationTest.php @@ -2,9 +2,9 @@ namespace Neo4j\QueryAPI\Tests\Integration; -use GuzzleHttp\Client; use GuzzleHttp\Handler\MockHandler; use GuzzleHttp\HandlerStack; +use GuzzleHttp\Client; use Neo4j\QueryAPI\Exception\Neo4jException; use Neo4j\QueryAPI\Neo4jQueryAPI; use Neo4j\QueryAPI\Neo4jRequestFactory; @@ -86,7 +86,7 @@ public function testCounters(): void $queryCounters = $result->getQueryCounters(); $this->assertNotNull($queryCounters); - $this->assertEquals(1, $queryCounters->getNodesCreated()); + $this->assertEquals(1, $queryCounters->nodesCreated); } public function testCreateBookmarks(): void @@ -397,7 +397,7 @@ public function testInvalidQueryException(): void ]); } catch (\Throwable $e) { $this->assertInstanceOf(Neo4jException::class, $e); - $this->assertEquals('Neo.ClientError.Statement.ParameterMissing', $e->getErrorCode()); + $this->assertEquals('Neo.ClientError.Statement.ParameterMissing', $e->errorCode); $this->assertEquals('Expected parameter(s): invalidParam', $e->getMessage()); } } diff --git a/tests/Integration/Neo4jTransactionIntegrationTest.php b/tests/Integration/Neo4jTransactionIntegrationTest.php index a4e70871..d2b0f96c 100644 --- a/tests/Integration/Neo4jTransactionIntegrationTest.php +++ b/tests/Integration/Neo4jTransactionIntegrationTest.php @@ -9,12 +9,8 @@ use PHPUnit\Framework\TestCase; use RuntimeException; -/** - * @api - */ -class Neo4jTransactionIntegrationTest extends TestCase +final class Neo4jTransactionIntegrationTest extends TestCase { - /** @psalm-suppress PropertyNotSetInConstructor */ private Neo4jQueryAPI $api; /** diff --git a/tests/Unit/AuthenticationTest.php b/tests/Unit/AuthenticationTest.php index 07fdab5e..eacea488 100644 --- a/tests/Unit/AuthenticationTest.php +++ b/tests/Unit/AuthenticationTest.php @@ -5,10 +5,7 @@ use Neo4j\QueryAPI\Objects\Authentication; use PHPUnit\Framework\TestCase; -/** - * @api - */ -class AuthenticationTest extends TestCase +final class AuthenticationTest extends TestCase { public function testBearerToken(): void { diff --git a/tests/Unit/Neo4jExceptionUnitTest.php b/tests/Unit/Neo4jExceptionUnitTest.php index caa0bee3..5975203b 100644 --- a/tests/Unit/Neo4jExceptionUnitTest.php +++ b/tests/Unit/Neo4jExceptionUnitTest.php @@ -6,10 +6,7 @@ use PHPUnit\Framework\TestCase; use Neo4j\QueryAPI\Exception\Neo4jException; -/** - * @api - */ -class Neo4jExceptionUnitTest extends TestCase +final class Neo4jExceptionUnitTest extends TestCase { /** * Test the constructor and property initialization. @@ -24,10 +21,10 @@ public function testConstructor(): void $exception = new Neo4jException($errorDetails); - $this->assertSame('Neo.ClientError.Statement.SyntaxError', $exception->getErrorCode()); - $this->assertSame('ClientError', $exception->getType()); - $this->assertSame('Statement', $exception->getSubType()); - $this->assertSame('SyntaxError', $exception->getName()); + $this->assertSame('Neo.ClientError.Statement.SyntaxError', $exception->errorCode); + $this->assertSame('ClientError', $exception->errorType); + $this->assertSame('Statement', $exception->errorSubType); + $this->assertSame('SyntaxError', $exception->errorName); $this->assertSame('Invalid syntax near ...', $exception->getMessage()); $this->assertSame(0, $exception->getCode()); } @@ -39,10 +36,10 @@ public function testConstructorWithMissingErrorDetails(): void { $exception = new Neo4jException([]); - $this->assertSame('Neo.UnknownError', $exception->getErrorCode()); - $this->assertSame('UnknownError', $exception->getType()); - $this->assertNull($exception->getSubType()); - $this->assertNull($exception->getName()); + $this->assertSame('Neo.UnknownError', $exception->errorCode); + $this->assertSame('UnknownError', $exception->errorType); + $this->assertNull($exception->errorSubType); + $this->assertNull($exception->errorName); $this->assertSame('An unknown error occurred.', $exception->getMessage()); $this->assertSame(0, $exception->getCode()); } @@ -64,10 +61,10 @@ public function testFromNeo4jResponse(): void $exception = Neo4jException::fromNeo4jResponse($response); - $this->assertSame('Neo.ClientError.Transaction.InvalidRequest', $exception->getErrorCode()); - $this->assertSame('ClientError', $exception->getType()); - $this->assertSame('Transaction', $exception->getSubType()); - $this->assertSame('InvalidRequest', $exception->getName()); + $this->assertSame('Neo.ClientError.Transaction.InvalidRequest', $exception->errorCode); + $this->assertSame('ClientError', $exception->errorType); + $this->assertSame('Transaction', $exception->errorSubType); + $this->assertSame('InvalidRequest', $exception->errorName); $this->assertSame('Transaction error occurred.', $exception->getMessage()); $this->assertSame(0, $exception->getCode()); } @@ -81,10 +78,10 @@ public function testFromNeo4jResponseWithMissingDetails(): void $exception = Neo4jException::fromNeo4jResponse($response); - $this->assertSame('Neo.UnknownError', $exception->getErrorCode()); - $this->assertSame('UnknownError', $exception->getType()); - $this->assertNull($exception->getSubType()); - $this->assertNull($exception->getName()); + $this->assertSame('Neo.UnknownError', $exception->errorCode); + $this->assertSame('UnknownError', $exception->errorType); + $this->assertNull($exception->errorSubType); + $this->assertNull($exception->errorName); $this->assertSame(0, $exception->getCode()); } @@ -97,10 +94,10 @@ public function testFromNeo4jResponseWithNullResponse(): void $exception = Neo4jException::fromNeo4jResponse($response); - $this->assertSame('Neo.UnknownError', $exception->getErrorCode()); - $this->assertSame('UnknownError', $exception->getType()); - $this->assertNull($exception->getSubType(), "Expected 'getSubType()' to return null for null response"); - $this->assertNull($exception->getName(), "Expected 'getName()' to return null for null response"); + $this->assertSame('Neo.UnknownError', $exception->errorCode); + $this->assertSame('UnknownError', $exception->errorType); + $this->assertNull($exception->errorSubType, "Expected 'getSubType()' to return null for null response"); + $this->assertNull($exception->errorName, "Expected 'getName()' to return null for null response"); $this->assertSame(0, $exception->getCode()); } @@ -120,6 +117,6 @@ public function testExceptionChaining(): void $exception = new Neo4jException($errorDetails, $errorDetails['statusCode'], $previousException); $this->assertSame($previousException, $exception->getPrevious()); - $this->assertSame('Unauthorized', $exception->getName()); + $this->assertSame('Unauthorized', $exception->errorName); } } diff --git a/tests/Unit/Neo4jQueryAPIUnitTest.php b/tests/Unit/Neo4jQueryAPIUnitTest.php index 5dae33db..390f6727 100644 --- a/tests/Unit/Neo4jQueryAPIUnitTest.php +++ b/tests/Unit/Neo4jQueryAPIUnitTest.php @@ -4,7 +4,6 @@ use GuzzleHttp\Handler\MockHandler; use GuzzleHttp\HandlerStack; -use http\Client; use Http\Discovery\Psr17FactoryDiscovery; use Neo4j\QueryAPI\Neo4jQueryAPI; use Neo4j\QueryAPI\Neo4jRequestFactory; @@ -21,18 +20,12 @@ use Neo4j\QueryAPI\Configuration; use Nyholm\Psr7\Response; -/** - * @api - */ -class Neo4jQueryAPIUnitTest extends TestCase +final class Neo4jQueryAPIUnitTest extends TestCase { - /** @psalm-suppress PropertyNotSetInConstructor */ private OGM $ogm; - /** @psalm-suppress PropertyNotSetInConstructor */ protected string $address; - /** @psalm-suppress PropertyNotSetInConstructor */ protected ResponseParser $parser; #[\Override] diff --git a/tests/Unit/Neo4jRequestFactoryTest.php b/tests/Unit/Neo4jRequestFactoryTest.php index 08050db0..e3dc22b1 100644 --- a/tests/Unit/Neo4jRequestFactoryTest.php +++ b/tests/Unit/Neo4jRequestFactoryTest.php @@ -15,15 +15,9 @@ use Neo4j\QueryAPI\Objects\Authentication; use RuntimeException; -/** - * @api - */ -class Neo4jRequestFactoryTest extends TestCase +final class Neo4jRequestFactoryTest extends TestCase { - /** @psalm-suppress PropertyNotSetInConstructor */ private RequestFactoryInterface&\PHPUnit\Framework\MockObject\MockObject $psr17Factory; - - /** @psalm-suppress PropertyNotSetInConstructor */ private StreamFactoryInterface&\PHPUnit\Framework\MockObject\MockObject $streamFactory; diff --git a/tests/Unit/ResultRowTest.php b/tests/Unit/ResultRowTest.php index 0fc9ade5..087e8b8c 100644 --- a/tests/Unit/ResultRowTest.php +++ b/tests/Unit/ResultRowTest.php @@ -7,10 +7,7 @@ use BadMethodCallException; use PHPUnit\Framework\TestCase; -/** - * @api - */ -class ResultRowTest extends TestCase +final class ResultRowTest extends TestCase { public function testArrayAccessGet(): void { diff --git a/tests/Unit/TransactionUnitTest.php b/tests/Unit/TransactionUnitTest.php index 5fac4a1c..4abbb654 100644 --- a/tests/Unit/TransactionUnitTest.php +++ b/tests/Unit/TransactionUnitTest.php @@ -12,10 +12,7 @@ use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; -/** - * @api - */ -class TransactionUnitTest extends TestCase +final class TransactionUnitTest extends TestCase { private MockObject $client; private MockObject $requestFactory;