diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 48aeb75..77140a9 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -17,7 +17,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: 8.0 + php-version: 8.3 extensions: mbstring, intl ini-values: post_max_size=256M, short_open_tag=On coverage: xdebug @@ -27,6 +27,6 @@ jobs: - name: Test coverage run: | - vendor/bin/phpunit --coverage-clover clover.xml --whitelist src + vendor/bin/phpunit --coverage-clover clover.xml --coverage-filter src echo "Upload results to Scrutinizer-ci" vendor/bin/ocular code-coverage:upload --format=php-clover clover.xml diff --git a/.github/workflows/fix-code-style.yml b/.github/workflows/fix-code-style.yml index 892c6b6..55f8c4b 100644 --- a/.github/workflows/fix-code-style.yml +++ b/.github/workflows/fix-code-style.yml @@ -12,10 +12,6 @@ jobs: uses: actions/checkout@v4 with: ref: ${{ github.head_ref }} - - - name: Checkout - uses: actions/checkout@v4 - - name: Cache dependencies uses: actions/cache@v3 with: @@ -41,6 +37,6 @@ jobs: "${GITHUB_WORKSPACE}/vendor/bin/pint" - name: Commit changes - uses: stefanzweifel/git-auto-commit-action@v4 + uses: stefanzweifel/git-auto-commit-action@v5 with: commit_message: Fix styling diff --git a/.github/workflows/quality-assurance.yml b/.github/workflows/quality-assurance.yml index 0b10065..b040f9d 100644 --- a/.github/workflows/quality-assurance.yml +++ b/.github/workflows/quality-assurance.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php: [8.0, 8.1, 8.2] + php: [8.3] name: Quality checks P${{ matrix.php }} steps: diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 5940219..459244a 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -9,7 +9,7 @@ jobs: fail-fast: true matrix: os: [ubuntu-latest] - php: [8.0, 8.1, 8.2] + php: [8.1, 8.2, 8.3] stability: [prefer-stable] name: P${{ matrix.php }} - ${{ matrix.stability }} diff --git a/.github/workflows/update-changelog.yml b/.github/workflows/update-changelog.yml index 40f15c3..7e7eb96 100644 --- a/.github/workflows/update-changelog.yml +++ b/.github/workflows/update-changelog.yml @@ -21,7 +21,7 @@ jobs: release-notes: ${{ github.event.release.body }} - name: Commit updated CHANGELOG - uses: stefanzweifel/git-auto-commit-action@v4 + uses: stefanzweifel/git-auto-commit-action@v5 with: branch: next commit_message: Update CHANGELOG diff --git a/composer.json b/composer.json index b617c53..7d25d37 100644 --- a/composer.json +++ b/composer.json @@ -18,20 +18,19 @@ "minimum-stability": "dev", "prefer-stable" : true, "require": { - "php": "^8.0", + "php": "^8.1", "ext-json": "*", "spatie/ray": "^1.34" }, "require-dev": { "ergebnis/composer-normalize": "^2.6", - "laravel/pint": "^1.2.1", + "laravel/pint": "^1.13", "mockery/mockery": "^1.4", "nikic/php-parser": "^4.2@dev", "phpmd/phpmd": "^2.9", "phpstan/phpstan": "^1.2", - "phpunit/phpunit": "^9.5", - "scrutinizer/ocular": "^1.8", - "sebastian/phpcpd": "^6.0" + "phpunit/phpunit": "^10.5", + "scrutinizer/ocular": "^1.8" }, "autoload": { "psr-4": { diff --git a/phpunit.xml b/phpunit.xml index 026f190..5d1a958 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,19 +1,19 @@ - - - - tests/ - - - \ No newline at end of file + + + tests/ + + + diff --git a/pint.json b/pint.json new file mode 100644 index 0000000..ca123d5 --- /dev/null +++ b/pint.json @@ -0,0 +1,3 @@ +{ + "preset": "per" +} \ No newline at end of file diff --git a/src/AQL/HasArangoSearchFunctions.php b/src/AQL/HasArangoSearchFunctions.php index 8af7063..7e51d4f 100644 --- a/src/AQL/HasArangoSearchFunctions.php +++ b/src/AQL/HasArangoSearchFunctions.php @@ -28,7 +28,7 @@ public function analyzer(): FunctionExpression $analyzer = array_pop($arguments); $predicates = $arguments; - if (! is_array($predicates[0])) { + if (!is_array($predicates[0])) { $predicates = [[ ...$predicates, ]]; @@ -54,7 +54,7 @@ public function boost(): FunctionExpression $boost = array_pop($arguments); $predicates = $arguments; - if (! is_array($predicates[0])) { + if (!is_array($predicates[0])) { $predicates = [[ ...$predicates, ]]; @@ -110,14 +110,10 @@ public function tfidf( * Match documents where the attribute at path is present and is of the specified data type. * * https://www.arangodb.com/docs/stable/aql/functions-arangosearch.html#exists - * - * @param Expression|QueryBuilder|string $path - * @param Expression|QueryBuilder|null|string $type - * @return FunctionExpression */ public function exists( Expression|QueryBuilder|string $path, - Expression|null|string|QueryBuilder $type = null + Expression|string|QueryBuilder $type = null ): FunctionExpression { $arguments = [ $path, @@ -132,13 +128,6 @@ public function exists( * Match documents where the attribute at path is present and is of the specified data type. * * https://www.arangodb.com/docs/stable/aql/functions-arangosearch.html#in_range - * - * @param string|Expression $path - * @param int|float|string|Expression|QueryBuilder $low - * @param int|float|string|Expression|QueryBuilder $high - * @param bool|Expression|QueryBuilder|null $includeLow - * @param bool|Expression|QueryBuilder|null $includeHigh - * @return FunctionExpression */ public function inRange( string|Expression $path, @@ -171,7 +160,6 @@ public function inRange( * @param null|bool|object $transpositions * @param null|int|object $maxTerms * @param null|string|object $prefix - * @return FunctionExpression */ public function levenshteinMatch( mixed $path, @@ -221,7 +209,6 @@ public function like( * @param string|object $target * @param null|int|float|object $threshold * @param null|string|object $analyzer - * @return FunctionExpression */ public function nGramMatch( mixed $path, diff --git a/src/AQL/HasArrayFunctions.php b/src/AQL/HasArrayFunctions.php index dea2a82..1dcd1fa 100644 --- a/src/AQL/HasArrayFunctions.php +++ b/src/AQL/HasArrayFunctions.php @@ -21,9 +21,6 @@ trait HasArrayFunctions * @link https://www.arangodb.com/docs/stable/aql/functions-array.html#append * * @param array|object $array - * @param mixed $values - * @param bool|null $unique - * @return FunctionExpression */ public function append(mixed $array, mixed $values, bool $unique = null): FunctionExpression { @@ -44,7 +41,6 @@ public function append(mixed $array, mixed $values, bool $unique = null): Functi * @link https://www.arangodb.com/docs/stable/aql/functions-array.html#length * * @param mixed $value - * @return FunctionExpression */ public function count($value): FunctionExpression { @@ -57,7 +53,6 @@ public function count($value): FunctionExpression * @link https://www.arangodb.com/docs/stable/aql/functions-array.html#count_distinct * * @param mixed $value - * @return FunctionExpression */ public function countDistinct($value): FunctionExpression { @@ -70,7 +65,6 @@ public function countDistinct($value): FunctionExpression * @link https://www.arangodb.com/docs/stable/aql/functions-array.html#first * * @param mixed $value - * @return FunctionExpression */ public function first($value): FunctionExpression { @@ -84,7 +78,6 @@ public function first($value): FunctionExpression * * @param array|object $array * @param int|object $depth - * @return FunctionExpression */ public function flatten(mixed $array, mixed $depth = 1): FunctionExpression { @@ -102,7 +95,6 @@ public function flatten(mixed $array, mixed $depth = 1): FunctionExpression * @link https://www.arangodb.com/docs/stable/aql/functions-array.html#intersection * * @param array ...$arrays - * @return FunctionExpression */ public function intersection(array ...$arrays): FunctionExpression { @@ -115,7 +107,6 @@ public function intersection(array ...$arrays): FunctionExpression * @link https://www.arangodb.com/docs/stable/aql/functions-array.html#last * * @param mixed $value - * @return FunctionExpression */ public function last($value): FunctionExpression { @@ -124,9 +115,6 @@ public function last($value): FunctionExpression /** * @link https://www.arangodb.com/docs/stable/aql/functions-array.html#length - * - * @param mixed $value - * @return FunctionExpression */ public function length(mixed $value): FunctionExpression { @@ -139,7 +127,6 @@ public function length(mixed $value): FunctionExpression * @link https://www.arangodb.com/docs/stable/aql/functions-array.html#shift * * @param array|object $array - * @return FunctionExpression */ public function shift(mixed $array): FunctionExpression { @@ -152,7 +139,6 @@ public function shift(mixed $array): FunctionExpression * @link https://www.arangodb.com/docs/stable/aql/functions-array.html#union * * @param array|Expression|QueryBuilder $arrays - * @return FunctionExpression */ public function union( array|Expression|QueryBuilder ...$arrays @@ -166,7 +152,6 @@ public function union( * @link https://www.arangodb.com/docs/stable/aql/functions-array.html#union_distinct * * @param array|Expression|QueryBuilder $arrays - * @return FunctionExpression */ public function unionDistinct( array|Expression|QueryBuilder ...$arrays @@ -180,7 +165,6 @@ public function unionDistinct( * @link https://www.arangodb.com/docs/stable/aql/functions-array.html#unique * * @param array|object $array - * @return FunctionExpression */ public function unique(mixed $array): FunctionExpression { diff --git a/src/AQL/HasDateFunctions.php b/src/AQL/HasDateFunctions.php index dbf963d..4ce8c03 100644 --- a/src/AQL/HasDateFunctions.php +++ b/src/AQL/HasDateFunctions.php @@ -202,7 +202,7 @@ public function dateRound( public function dateUtcToLocal( int|string|object $date, string|object $timezone, - null|array|object $zoneInfo = null + array|object $zoneInfo = null ): FunctionExpression { $arguments = [ 'date' => $date, @@ -225,7 +225,7 @@ public function dateUtcToLocal( public function dateLocalToUtc( int|string|object $date, string|object $timezone, - null|array|object $zoneInfo = null + array|object $zoneInfo = null ): FunctionExpression { $arguments = [ 'date' => $date, diff --git a/src/AQL/HasDocumentFunctions.php b/src/AQL/HasDocumentFunctions.php index cae73af..9f31960 100644 --- a/src/AQL/HasDocumentFunctions.php +++ b/src/AQL/HasDocumentFunctions.php @@ -47,7 +47,7 @@ public function keepAttributes( string|array|object $document, string|array|object $attributes ): FunctionExpression { - if (! is_array($attributes)) { + if (!is_array($attributes)) { $attributes = [$attributes]; } @@ -68,8 +68,6 @@ public function keepAttributes( * * @param array|object $document * @param array|object $examples - * @param bool|QueryBuilder|Expression $returnIndex - * @return FunctionExpression */ public function matches( array|object $document, @@ -91,7 +89,6 @@ public function matches( * @link https://www.arangodb.com/docs/stable/aql/functions-document.html#merge * * @param array|string|Expression $documents - * @return FunctionExpression */ public function merge(string|array|Expression ...$documents): FunctionExpression { @@ -104,7 +101,6 @@ public function merge(string|array|Expression ...$documents): FunctionExpression * @link https://www.arangodb.com/docs/stable/aql/functions-document.html#parse_identifier * * @param string|object $documentHandle - * @return FunctionExpression */ public function parseIdentifier(mixed $documentHandle): FunctionExpression { @@ -122,7 +118,7 @@ public function unset( string|object $document, string|array|object $attributes ): FunctionExpression { - if (! is_array($attributes)) { + if (!is_array($attributes)) { $attributes = [$attributes]; } diff --git a/src/AQL/HasGeoFunctions.php b/src/AQL/HasGeoFunctions.php index f10344d..9a1684f 100644 --- a/src/AQL/HasGeoFunctions.php +++ b/src/AQL/HasGeoFunctions.php @@ -24,7 +24,6 @@ trait HasGeoFunctions * @param mixed $longitude1 * @param mixed $latitude2 * @param mixed $longitude2 - * @return FunctionExpression */ public function distance($latitude1, $longitude1, $latitude2, $longitude2): FunctionExpression { @@ -83,7 +82,6 @@ public function geoDistance( * * @param string|array|object $geoJsonA * @param string|array|object $geoJsonB - * @return FunctionExpression */ public function geoEquals( string|array|object $geoJsonA, @@ -99,7 +97,6 @@ public function geoEquals( * * @param string|array|object|object $geoJsonA * @param string|array|object|object $geoJsonB - * @return FunctionExpression */ public function geoIntersects(mixed $geoJsonA, mixed $geoJsonB): FunctionExpression { @@ -142,7 +139,6 @@ public function geoInRange( * @link https://www.arangodb.com/docs/stable/aql/functions-geo.html#geo_linestring * * @param array|object $points - * @return FunctionExpression */ public function geoLineString(mixed $points): FunctionExpression { @@ -156,7 +152,6 @@ public function geoLineString(mixed $points): FunctionExpression * @link https://www.arangodb.com/docs/stable/aql/functions-geo.html#geo_multilinestring * * @param array|object $points - * @return FunctionExpression */ public function geoMultiLineString(mixed $points): FunctionExpression { @@ -181,7 +176,6 @@ public function geoPoint( * @link https://www.arangodb.com/docs/stable/aql/functions-geo.html#geo_multipoint * * @param array|object $points - * @return FunctionExpression */ public function geoMultiPoint(mixed $points): FunctionExpression { @@ -194,7 +188,6 @@ public function geoMultiPoint(mixed $points): FunctionExpression * @link https://www.arangodb.com/docs/stable/aql/functions-geo.html#geo_polygon * * @param array|object $points - * @return FunctionExpression */ public function geoPolygon(mixed $points): FunctionExpression { @@ -207,7 +200,6 @@ public function geoPolygon(mixed $points): FunctionExpression * @link https://www.arangodb.com/docs/stable/aql/functions-geo.html#geo_polygon * * @param array|object $points - * @return FunctionExpression */ public function geoMultiPolygon(mixed $points): FunctionExpression { diff --git a/src/AQL/HasGraphClauses.php b/src/AQL/HasGraphClauses.php index b27bd54..84bb60a 100644 --- a/src/AQL/HasGraphClauses.php +++ b/src/AQL/HasGraphClauses.php @@ -142,12 +142,12 @@ public function edgeCollections(): self public function prune( object|array|string|int|float|bool|null $leftOperand, string|QueryBuilder|Expression $comparisonOperator = null, - object|array|string|int|float|bool|null $rightOperand = null, + object|array|string|int|float|bool $rightOperand = null, string|QueryBuilder|Expression $logicalOperator = null, string $pruneVariable = null ): self { $predicates = $leftOperand; - if (! is_array($predicates)) { + if (!is_array($predicates)) { $predicates = [[$leftOperand, $comparisonOperator, $rightOperand, $logicalOperator]]; } diff --git a/src/AQL/HasMiscellaneousFunctions.php b/src/AQL/HasMiscellaneousFunctions.php index 373c0b3..b3c6cb1 100644 --- a/src/AQL/HasMiscellaneousFunctions.php +++ b/src/AQL/HasMiscellaneousFunctions.php @@ -30,7 +30,7 @@ public function assert(): FunctionExpression $errorMessage = array_pop($arguments); $predicates = $arguments; - if (! is_array($predicates[0])) { + if (!is_array($predicates[0])) { $predicates = [[ ...$predicates, ]]; @@ -108,7 +108,7 @@ public function warn(): FunctionExpression $errorMessage = array_pop($arguments); $predicates = $arguments; - if (! is_array($predicates[0])) { + if (!is_array($predicates[0])) { $predicates = [[ ...$predicates, ]]; diff --git a/src/AQL/HasQueryClauses.php b/src/AQL/HasQueryClauses.php index 3a5540e..62740e3 100644 --- a/src/AQL/HasQueryClauses.php +++ b/src/AQL/HasQueryClauses.php @@ -40,7 +40,7 @@ public function for( string|array|Expression $variableName, string|array|QueryBuilder|Expression $in = null ): self { - if (! is_array($variableName)) { + if (!is_array($variableName)) { $variableName = [$variableName]; } @@ -60,11 +60,11 @@ public function for( public function filter( object|array|string|int|float|bool|null $leftOperand, string $comparisonOperator = null, - object|array|string|int|float|bool|null $rightOperand = null, + object|array|string|int|float|bool $rightOperand = null, string $logicalOperator = null ): self { $predicates = $leftOperand; - if (! is_array($predicates)) { + if (!is_array($predicates)) { $predicates = [[$leftOperand, $comparisonOperator, $rightOperand, $logicalOperator]]; } @@ -84,11 +84,11 @@ public function filter( public function search( object|array|string|int|float|bool|null $leftOperand, string $comparisonOperator = null, - object|array|string|int|float|bool|null $rightOperand = null, + object|array|string|int|float|bool $rightOperand = null, string $logicalOperator = null ): self { $predicates = $leftOperand; - if (! is_array($predicates)) { + if (!is_array($predicates)) { $predicates = [$predicates]; } if (is_string($comparisonOperator)) { diff --git a/src/AQL/HasStringFunctions.php b/src/AQL/HasStringFunctions.php index 37d0edc..61dce68 100644 --- a/src/AQL/HasStringFunctions.php +++ b/src/AQL/HasStringFunctions.php @@ -31,9 +31,7 @@ public function concat( * * @link https://www.arangodb.com/docs/stable/aql/functions-string.html#concat_separator * - * @param string|Expression|QueryBuilder $separator * @param array|Expression|QueryBuilder> ...$values - * @return FunctionExpression */ public function concatSeparator( string|Expression|QueryBuilder $separator, @@ -139,7 +137,7 @@ public function lower( */ public function ltrim( string|object $value, - null|string|object $char = null + string|object $char = null ): FunctionExpression { $arguments = [ 'value' => $value, @@ -227,7 +225,7 @@ public function regexTest( */ public function rtrim( string|object $value, - null|string|object $char = null + string|object $char = null ): FunctionExpression { $arguments = [ 'value' => $value, @@ -339,7 +337,7 @@ public function tokens( */ public function trim( string|object $value, - null|string|int|object $type = null + string|int|object $type = null ): FunctionExpression { $arguments = [ 'value' => $value, diff --git a/src/Clauses/AggregateClause.php b/src/Clauses/AggregateClause.php index 9bd72cd..7358db1 100644 --- a/src/Clauses/AggregateClause.php +++ b/src/Clauses/AggregateClause.php @@ -32,7 +32,7 @@ public function compile(QueryBuilder $queryBuilder): string ['Reference', 'Function', 'Query', 'Bind'] ); - return "AGGREGATE {$this->variableName->compile($queryBuilder)} ". + return "AGGREGATE {$this->variableName->compile($queryBuilder)} " . "= {$this->aggregateExpression->compile($queryBuilder)}"; } } diff --git a/src/Clauses/Clause.php b/src/Clauses/Clause.php index 7ffd793..3600c5b 100644 --- a/src/Clauses/Clause.php +++ b/src/Clauses/Clause.php @@ -15,7 +15,5 @@ */ abstract class Clause extends QueryElement { - public function __construct() - { - } + public function __construct() {} } diff --git a/src/Clauses/CollectClause.php b/src/Clauses/CollectClause.php index 2c78966..1473b11 100644 --- a/src/Clauses/CollectClause.php +++ b/src/Clauses/CollectClause.php @@ -52,11 +52,11 @@ public function compile(QueryBuilder $queryBuilder): string if ($groupOutput !== '') { $groupOutput .= ','; } - $groupOutput .= ' '.$group[0]->compile($queryBuilder); + $groupOutput .= ' ' . $group[0]->compile($queryBuilder); /** @psalm-suppress PossiblyUndefinedArrayOffset */ - $groupOutput .= ' = '.$group[1]->compile($queryBuilder); + $groupOutput .= ' = ' . $group[1]->compile($queryBuilder); } - return $output.$groupOutput; + return $output . $groupOutput; } } diff --git a/src/Clauses/EdgeCollectionsClause.php b/src/Clauses/EdgeCollectionsClause.php index 63b196c..68fbc74 100644 --- a/src/Clauses/EdgeCollectionsClause.php +++ b/src/Clauses/EdgeCollectionsClause.php @@ -35,7 +35,7 @@ public function compile(QueryBuilder $queryBuilder): string { /** @var array $edgeCollections */ $edgeCollections = array_map(function ($edgeCollection) use ($queryBuilder) { - if (! $queryBuilder->grammar->isGraphDirection($edgeCollection)) { + if (!$queryBuilder->grammar->isGraphDirection($edgeCollection)) { return $queryBuilder->normalizeArgument($edgeCollection, ['Collection', 'Query', 'Bind']); } @@ -45,11 +45,11 @@ public function compile(QueryBuilder $queryBuilder): string $output = ''; foreach ($edgeCollections as $value) { if ($value instanceof ExpressionInterface) { - $output .= $value->compile($queryBuilder).', '; + $output .= $value->compile($queryBuilder) . ', '; } if (is_string($value)) { - $output .= $value.' '; + $output .= $value . ' '; } } diff --git a/src/Clauses/FilterClause.php b/src/Clauses/FilterClause.php index 77aa968..de77da9 100644 --- a/src/Clauses/FilterClause.php +++ b/src/Clauses/FilterClause.php @@ -35,7 +35,7 @@ public function compile(QueryBuilder $queryBuilder): string $compiledPredicates = $queryBuilder->compilePredicates($this->predicates); - return 'FILTER '.rtrim($compiledPredicates); + return 'FILTER ' . rtrim($compiledPredicates); } /** diff --git a/src/Clauses/GraphClause.php b/src/Clauses/GraphClause.php index 69b7d6b..735f593 100644 --- a/src/Clauses/GraphClause.php +++ b/src/Clauses/GraphClause.php @@ -20,6 +20,6 @@ public function compile(QueryBuilder $queryBuilder): string { $this->graphName = $queryBuilder->normalizeArgument($this->graphName, 'Graph'); - return 'GRAPH '.$this->graphName->compile($queryBuilder); + return 'GRAPH ' . $this->graphName->compile($queryBuilder); } } diff --git a/src/Clauses/IntoClause.php b/src/Clauses/IntoClause.php index a301e6f..8800f4c 100644 --- a/src/Clauses/IntoClause.php +++ b/src/Clauses/IntoClause.php @@ -34,9 +34,9 @@ public function compile(QueryBuilder $queryBuilder): string ); } - $output = 'INTO '.$this->groupsVariable->compile($queryBuilder); + $output = 'INTO ' . $this->groupsVariable->compile($queryBuilder); if ($this->projectionExpression !== null) { - $output .= ' = '.$this->projectionExpression->compile($queryBuilder); + $output .= ' = ' . $this->projectionExpression->compile($queryBuilder); } return $output; diff --git a/src/Clauses/KeepClause.php b/src/Clauses/KeepClause.php index 220b2bb..e7471fa 100644 --- a/src/Clauses/KeepClause.php +++ b/src/Clauses/KeepClause.php @@ -21,6 +21,6 @@ public function compile(QueryBuilder $queryBuilder): string $this->keepVariable = $queryBuilder->normalizeArgument($this->keepVariable, 'Variable'); $queryBuilder->registerVariable($this->keepVariable); - return 'KEEP '.$this->keepVariable->compile($queryBuilder); + return 'KEEP ' . $this->keepVariable->compile($queryBuilder); } } diff --git a/src/Clauses/LimitClause.php b/src/Clauses/LimitClause.php index bd70fee..f76847b 100644 --- a/src/Clauses/LimitClause.php +++ b/src/Clauses/LimitClause.php @@ -34,9 +34,9 @@ public function compile(QueryBuilder $queryBuilder): string if ($this->offset !== null) { $this->offset = $queryBuilder->normalizeArgument($this->offset, ['Number', 'Reference', 'Query', 'Bind']); - $output .= $this->offset->compile($queryBuilder).', '; + $output .= $this->offset->compile($queryBuilder) . ', '; } - return $output.$this->count->compile($queryBuilder); + return $output . $this->count->compile($queryBuilder); } } diff --git a/src/Clauses/OptionsClause.php b/src/Clauses/OptionsClause.php index 544889f..2c0d922 100644 --- a/src/Clauses/OptionsClause.php +++ b/src/Clauses/OptionsClause.php @@ -25,6 +25,6 @@ public function compile(QueryBuilder $queryBuilder): string { $this->options = $queryBuilder->normalizeArgument($this->options, 'Object'); - return 'OPTIONS '.$this->options->compile($queryBuilder); + return 'OPTIONS ' . $this->options->compile($queryBuilder); } } diff --git a/src/Clauses/PruneClause.php b/src/Clauses/PruneClause.php index f3403a2..f96348d 100644 --- a/src/Clauses/PruneClause.php +++ b/src/Clauses/PruneClause.php @@ -31,13 +31,13 @@ public function compile(QueryBuilder $queryBuilder): string if (isset($this->pruneVariable)) { $pruneVariable = $queryBuilder->normalizeArgument($this->pruneVariable, 'Variable'); - $aql .= $pruneVariable->compile($queryBuilder).' = '; + $aql .= $pruneVariable->compile($queryBuilder) . ' = '; } $this->predicates = $queryBuilder->normalizePredicates($this->predicates); $compiledPredicates = $queryBuilder->compilePredicates($this->predicates); - return $aql.rtrim($compiledPredicates); + return $aql . rtrim($compiledPredicates); } } diff --git a/src/Clauses/ReplaceClause.php b/src/Clauses/ReplaceClause.php index dc1a33d..259f7df 100644 --- a/src/Clauses/ReplaceClause.php +++ b/src/Clauses/ReplaceClause.php @@ -49,8 +49,8 @@ public function compile(QueryBuilder $queryBuilder): string $this->collection = $queryBuilder->normalizeArgument($this->collection, ['Collection', 'Bind']); $queryBuilder->registerCollections($this->collection->compile($queryBuilder)); - return "REPLACE {$this->document->compile($queryBuilder)} ". - "WITH {$this->with->compile($queryBuilder)} ". + return "REPLACE {$this->document->compile($queryBuilder)} " . + "WITH {$this->with->compile($queryBuilder)} " . "IN {$this->collection->compile($queryBuilder)}"; } } diff --git a/src/Clauses/ReturnClause.php b/src/Clauses/ReturnClause.php index 142319f..a1575fa 100644 --- a/src/Clauses/ReturnClause.php +++ b/src/Clauses/ReturnClause.php @@ -39,6 +39,6 @@ public function compile(QueryBuilder $queryBuilder): string $output .= ' DISTINCT'; } - return $output.' '.$this->expression->compile($queryBuilder); + return $output . ' ' . $this->expression->compile($queryBuilder); } } diff --git a/src/Clauses/SearchClause.php b/src/Clauses/SearchClause.php index 9ebf33c..affc5c9 100644 --- a/src/Clauses/SearchClause.php +++ b/src/Clauses/SearchClause.php @@ -22,6 +22,6 @@ public function compile(QueryBuilder $queryBuilder): string $compiledPredicates = $queryBuilder->compilePredicates($this->predicates); - return 'SEARCH '.rtrim($compiledPredicates); + return 'SEARCH ' . rtrim($compiledPredicates); } } diff --git a/src/Clauses/SortClause.php b/src/Clauses/SortClause.php index 20a6d8e..240b9b7 100644 --- a/src/Clauses/SortClause.php +++ b/src/Clauses/SortClause.php @@ -34,7 +34,7 @@ public function compile(QueryBuilder $queryBuilder): string /** @var array $references */ $references = array_map(function ($reference) use ($queryBuilder) { - if (! $queryBuilder->grammar->isSortDirection($reference)) { + if (!$queryBuilder->grammar->isSortDirection($reference)) { return $queryBuilder->normalizeArgument($reference, ['Reference', 'Null', 'Query', 'Bind']); } @@ -44,13 +44,13 @@ public function compile(QueryBuilder $queryBuilder): string $output = ''; foreach ($references as $value) { if ($value instanceof ExpressionInterface) { - $output .= ', '.$value->compile($queryBuilder); + $output .= ', ' . $value->compile($queryBuilder); } if (is_string($value)) { - $output .= ' '.$value; + $output .= ' ' . $value; } } - return 'SORT '.ltrim($output, ', '); + return 'SORT ' . ltrim($output, ', '); } } diff --git a/src/Clauses/TraverseClause.php b/src/Clauses/TraverseClause.php index a5413f7..4f20fcc 100644 --- a/src/Clauses/TraverseClause.php +++ b/src/Clauses/TraverseClause.php @@ -43,9 +43,9 @@ public function compile(QueryBuilder $queryBuilder): string $output .= $this->traverseType(); - $output .= ' '.$this->startVertex->compile($queryBuilder); + $output .= ' ' . $this->startVertex->compile($queryBuilder); if (isset($this->toVertex)) { - $output .= ' TO '.$this->toVertex->compile($queryBuilder); + $output .= ' TO ' . $this->toVertex->compile($queryBuilder); } return $output; @@ -53,8 +53,6 @@ public function compile(QueryBuilder $queryBuilder): string /** * Default path type - * - * @return string */ protected function traverseType(): string { diff --git a/src/Clauses/UpdateClause.php b/src/Clauses/UpdateClause.php index 66eeb9c..f9513a7 100644 --- a/src/Clauses/UpdateClause.php +++ b/src/Clauses/UpdateClause.php @@ -19,15 +19,11 @@ class UpdateClause extends Clause */ protected array|object|string $with; - /** - * @var string|QueryBuilder|Expression - */ protected string|QueryBuilder|Expression $collection; /** * @param array|object|string $document * @param array|object|string $with - * @param string|QueryBuilder|Expression $collection */ public function __construct( array|object|string $document, @@ -51,8 +47,8 @@ public function compile(QueryBuilder $queryBuilder): string $this->collection = $queryBuilder->normalizeArgument($this->collection, ['Collection', 'Bind']); $queryBuilder->registerCollections($this->collection->compile($queryBuilder)); - return "UPDATE {$this->document->compile($queryBuilder)} ". - "WITH {$this->with->compile($queryBuilder)} ". + return "UPDATE {$this->document->compile($queryBuilder)} " . + "WITH {$this->with->compile($queryBuilder)} " . "IN {$this->collection->compile($queryBuilder)}"; } } diff --git a/src/Clauses/UpsertClause.php b/src/Clauses/UpsertClause.php index 9f44c96..c16da57 100644 --- a/src/Clauses/UpsertClause.php +++ b/src/Clauses/UpsertClause.php @@ -70,8 +70,8 @@ public function compile(QueryBuilder $queryBuilder): string $withClause = 'REPLACE'; } - return "UPSERT {$this->search->compile($queryBuilder)} ". - "INSERT {$this->insert->compile($queryBuilder)} $withClause {$this->update->compile($queryBuilder)} ". + return "UPSERT {$this->search->compile($queryBuilder)} " . + "INSERT {$this->insert->compile($queryBuilder)} $withClause {$this->update->compile($queryBuilder)} " . "IN {$this->collection->compile($queryBuilder)}"; } } diff --git a/src/Clauses/WindowClause.php b/src/Clauses/WindowClause.php index 99f0049..8a858ab 100644 --- a/src/Clauses/WindowClause.php +++ b/src/Clauses/WindowClause.php @@ -24,7 +24,7 @@ class WindowClause extends Clause */ public function __construct( array|object $offsets, - null|string|QueryBuilder|Expression $rangeValue = null + string|QueryBuilder|Expression $rangeValue = null ) { parent::__construct(); @@ -52,10 +52,10 @@ public function compile(QueryBuilder $queryBuilder): string $output = 'WINDOW'; if (isset($this->rangeValue)) { /** @phpstan-ignore-next-line */ - $output .= ' '.$this->rangeValue->compile($queryBuilder); + $output .= ' ' . $this->rangeValue->compile($queryBuilder); $output .= ' WITH'; } - $output .= ' '.$this->offsets->compile($queryBuilder); + $output .= ' ' . $this->offsets->compile($queryBuilder); return $output; } diff --git a/src/Clauses/WithClause.php b/src/Clauses/WithClause.php index dbfbe3d..f1e972e 100644 --- a/src/Clauses/WithClause.php +++ b/src/Clauses/WithClause.php @@ -42,7 +42,7 @@ public function compile(QueryBuilder $queryBuilder): string $output = 'WITH '; $implosion = ''; foreach ($collections as $collection) { - $implosion .= ', '.$collection->compile($queryBuilder); + $implosion .= ', ' . $collection->compile($queryBuilder); } $output .= ltrim($implosion, ', '); diff --git a/src/Clauses/WithCountClause.php b/src/Clauses/WithCountClause.php index 56a33e0..c035d4b 100644 --- a/src/Clauses/WithCountClause.php +++ b/src/Clauses/WithCountClause.php @@ -31,6 +31,6 @@ public function compile(QueryBuilder $queryBuilder): string ); $queryBuilder->registerVariable($this->countVariableName); - return 'WITH COUNT INTO '.$this->countVariableName->compile($queryBuilder); + return 'WITH COUNT INTO ' . $this->countVariableName->compile($queryBuilder); } } diff --git a/src/Exceptions/BindException.php b/src/Exceptions/BindException.php index 01e6221..4debb96 100644 --- a/src/Exceptions/BindException.php +++ b/src/Exceptions/BindException.php @@ -2,6 +2,4 @@ namespace LaravelFreelancerNL\FluentAQL\Exceptions; -class BindException extends \Exception -{ -} +class BindException extends \Exception {} diff --git a/src/Exceptions/ExpressionTypeException.php b/src/Exceptions/ExpressionTypeException.php index 1569672..7b8cf2b 100644 --- a/src/Exceptions/ExpressionTypeException.php +++ b/src/Exceptions/ExpressionTypeException.php @@ -2,6 +2,4 @@ namespace LaravelFreelancerNL\FluentAQL\Exceptions; -class ExpressionTypeException extends \Exception -{ -} +class ExpressionTypeException extends \Exception {} diff --git a/src/Expressions/ArithmeticExpression.php b/src/Expressions/ArithmeticExpression.php index e31f9f9..70a56f8 100644 --- a/src/Expressions/ArithmeticExpression.php +++ b/src/Expressions/ArithmeticExpression.php @@ -16,10 +16,6 @@ class ArithmeticExpression extends Expression implements ExpressionInterface /** * Create predicate expression. - * - * @param int|float|null|Expression|QueryBuilder $leftOperand - * @param string $operator - * @param int|float|null|Expression|QueryBuilder $rightOperand */ public function __construct( int|float|null|Expression|QueryBuilder $leftOperand, @@ -32,8 +28,6 @@ public function __construct( /** * Compile calculation. * - * @param QueryBuilder $queryBuilder - * @return string * * @throws \Exception */ @@ -44,21 +38,20 @@ public function compile(QueryBuilder $queryBuilder): string $leftOperand = $normalizedCalculation['leftOperand']->compile($queryBuilder); if ($normalizedCalculation['leftOperand'] instanceof self) { - $leftOperand = '('.$leftOperand.')'; + $leftOperand = '(' . $leftOperand . ')'; } $arithmeticOperator = $normalizedCalculation['arithmeticOperator']->compile($queryBuilder); $rightOperand = $normalizedCalculation['rightOperand']->compile($queryBuilder); if ($normalizedCalculation['rightOperand'] instanceof self) { - $rightOperand = '('.$rightOperand.')'; + $rightOperand = '(' . $rightOperand . ')'; } - return $leftOperand.' '.$arithmeticOperator.' '.$rightOperand; + return $leftOperand . ' ' . $arithmeticOperator . ' ' . $rightOperand; } /** - * @param QueryBuilder $queryBuilder * @param array $calculation * @return array * diff --git a/src/Expressions/AttributeExpression.php b/src/Expressions/AttributeExpression.php index 388a96e..8dfa74d 100644 --- a/src/Expressions/AttributeExpression.php +++ b/src/Expressions/AttributeExpression.php @@ -7,6 +7,4 @@ /** * AQL literal expression. */ -class AttributeExpression extends LiteralExpression implements ExpressionInterface -{ -} +class AttributeExpression extends LiteralExpression implements ExpressionInterface {} diff --git a/src/Expressions/BindExpression.php b/src/Expressions/BindExpression.php index 94b0aca..9df65e3 100644 --- a/src/Expressions/BindExpression.php +++ b/src/Expressions/BindExpression.php @@ -24,9 +24,6 @@ public function __construct(string $bindVariable, mixed $data = null) /** * Compile expression output. - * - * @param QueryBuilder $queryBuilder - * @return string */ public function compile(QueryBuilder $queryBuilder): string { diff --git a/src/Expressions/BooleanExpression.php b/src/Expressions/BooleanExpression.php index 38bae43..d69e0eb 100644 --- a/src/Expressions/BooleanExpression.php +++ b/src/Expressions/BooleanExpression.php @@ -13,9 +13,6 @@ class BooleanExpression extends LiteralExpression implements ExpressionInterface { /** * Compile expression output. - * - * @param QueryBuilder|null $queryBuilder - * @return string */ public function compile(QueryBuilder $queryBuilder = null): string { diff --git a/src/Expressions/ConstantExpression.php b/src/Expressions/ConstantExpression.php index 9058e52..31a1c74 100644 --- a/src/Expressions/ConstantExpression.php +++ b/src/Expressions/ConstantExpression.php @@ -13,9 +13,6 @@ class ConstantExpression extends LiteralExpression implements ExpressionInterfac { /** * Compile expression output. - * - * @param QueryBuilder|null $queryBuilder - * @return string */ public function compile(QueryBuilder $queryBuilder = null): string { diff --git a/src/Expressions/Expression.php b/src/Expressions/Expression.php index 4f26393..aae7882 100644 --- a/src/Expressions/Expression.php +++ b/src/Expressions/Expression.php @@ -15,8 +15,6 @@ abstract class Expression extends QueryElement /** * Create an expression. - * - * @param mixed $expression */ public function __construct(mixed $expression) { diff --git a/src/Expressions/FunctionExpression.php b/src/Expressions/FunctionExpression.php index e02603d..a5edf00 100644 --- a/src/Expressions/FunctionExpression.php +++ b/src/Expressions/FunctionExpression.php @@ -24,7 +24,6 @@ class FunctionExpression extends Expression implements ExpressionInterface /** * FunctionExpression constructor. * - * @param string $functionName * @param array|object|scalar|null $parameters */ public function __construct( @@ -33,7 +32,7 @@ public function __construct( ) { $this->functionName = $functionName; - if (! is_array($parameters)) { + if (!is_array($parameters)) { $parameters = [$parameters]; } @@ -42,12 +41,12 @@ public function __construct( public function compile(QueryBuilder $queryBuilder): string { - if (! empty($this->parameters)) { + if (!empty($this->parameters)) { $normalizeFunction = $this->getNormalizeFunctionName(); $this->$normalizeFunction($queryBuilder); } - $output = strtoupper($this->functionName).'('; + $output = strtoupper($this->functionName) . '('; $output .= implode(', ', $this->compileParameters($this->parameters, $queryBuilder)); $output .= ')'; @@ -56,7 +55,6 @@ public function compile(QueryBuilder $queryBuilder): string /** * @param array $parameters - * @param QueryBuilder $queryBuilder * @return array */ protected function compileParameters( @@ -86,6 +84,6 @@ protected function getNormalizeFunctionName(): string { $value = ucwords(str_replace('_', ' ', strtolower($this->functionName))); - return 'normalize'.str_replace(' ', '', $value); + return 'normalize' . str_replace(' ', '', $value); } } diff --git a/src/Expressions/ListExpression.php b/src/Expressions/ListExpression.php index e263241..5daa7c1 100644 --- a/src/Expressions/ListExpression.php +++ b/src/Expressions/ListExpression.php @@ -43,6 +43,6 @@ public function compile(QueryBuilder $queryBuilder): string $outputStrings[] = $expressionElement->compile($queryBuilder); } - return '['.implode(',', $outputStrings).']'; + return '[' . implode(',', $outputStrings) . ']'; } } diff --git a/src/Expressions/LiteralExpression.php b/src/Expressions/LiteralExpression.php index 9275dac..f94e5f8 100644 --- a/src/Expressions/LiteralExpression.php +++ b/src/Expressions/LiteralExpression.php @@ -13,9 +13,6 @@ class LiteralExpression extends Expression implements ExpressionInterface { /** * Compile expression output. - * - * @param QueryBuilder $queryBuilder - * @return string */ public function compile(QueryBuilder $queryBuilder): string { diff --git a/src/Expressions/NullExpression.php b/src/Expressions/NullExpression.php index ca1bac3..0cf5172 100644 --- a/src/Expressions/NullExpression.php +++ b/src/Expressions/NullExpression.php @@ -14,15 +14,10 @@ class NullExpression extends LiteralExpression implements ExpressionInterface /** * Create an expression. */ - public function __construct() - { - } + public function __construct() {} /** * Compile expression output. - * - * @param QueryBuilder|null $queryBuilder - * @return string */ public function compile(QueryBuilder $queryBuilder = null): string { diff --git a/src/Expressions/ObjectExpression.php b/src/Expressions/ObjectExpression.php index 54384fe..729aba4 100644 --- a/src/Expressions/ObjectExpression.php +++ b/src/Expressions/ObjectExpression.php @@ -27,9 +27,9 @@ public function compile(QueryBuilder $queryBuilder): string if ($output != '') { $output .= ','; } - $output .= '"'.$key.'":'.$value->compile($queryBuilder); + $output .= '"' . $key . '":' . $value->compile($queryBuilder); } - return '{'.$output.'}'; + return '{' . $output . '}'; } } diff --git a/src/Expressions/PredicateExpression.php b/src/Expressions/PredicateExpression.php index 98fde31..9a8fc3d 100644 --- a/src/Expressions/PredicateExpression.php +++ b/src/Expressions/PredicateExpression.php @@ -14,7 +14,7 @@ class PredicateExpression extends Expression implements ExpressionInterface */ protected object|array|string|int|float|bool|null $leftOperand; - protected string|null $comparisonOperator; + protected ?string $comparisonOperator; /** * @var object|array|string|int|float|bool|null @@ -29,12 +29,11 @@ class PredicateExpression extends Expression implements ExpressionInterface * @param object|array|string|int|float|bool|null $leftOperand * @param ?string $comparisonOperator * @param object|array|string|int|float|bool|null $rightOperand - * @param string $logicalOperator */ public function __construct( object|array|string|int|float|bool|null $leftOperand, - ?string $comparisonOperator = null, - object|array|string|int|float|bool|null $rightOperand = null, + string $comparisonOperator = null, + object|array|string|int|float|bool $rightOperand = null, string $logicalOperator = 'AND' ) { $this->leftOperand = $leftOperand; @@ -54,11 +53,11 @@ public function compile(QueryBuilder $queryBuilder): string $compiledPredicate = $leftOperand->compile($queryBuilder); if (isset($this->comparisonOperator) && $this->comparisonOperator !== '') { - $compiledPredicate .= ' '.$this->comparisonOperator; + $compiledPredicate .= ' ' . $this->comparisonOperator; $rightOperand = $queryBuilder->normalizeArgument($this->rightOperand); - $compiledPredicate .= ' '.$rightOperand->compile($queryBuilder); + $compiledPredicate .= ' ' . $rightOperand->compile($queryBuilder); } return $compiledPredicate; diff --git a/src/Expressions/QueryExpression.php b/src/Expressions/QueryExpression.php index 137cfb9..61f01cb 100644 --- a/src/Expressions/QueryExpression.php +++ b/src/Expressions/QueryExpression.php @@ -31,6 +31,6 @@ public function compile(QueryBuilder $queryBuilder): string $queryBuilder->registerCollections($this->queryBuilder->collections[(string) $mode], (string) $mode); } - return '('.$this->queryBuilder.')'; + return '(' . $this->queryBuilder . ')'; } } diff --git a/src/Expressions/TernaryExpression.php b/src/Expressions/TernaryExpression.php index a123fc9..68d7229 100644 --- a/src/Expressions/TernaryExpression.php +++ b/src/Expressions/TernaryExpression.php @@ -19,8 +19,6 @@ class TernaryExpression extends Expression implements ExpressionInterface /** * @param array|PredicateExpression $predicates - * @param mixed $then - * @param mixed|null $else */ public function __construct( array|PredicateExpression $predicates, @@ -38,8 +36,8 @@ public function compile(QueryBuilder $queryBuilder): string $this->then = $queryBuilder->normalizeArgument($this->then); $this->else = $queryBuilder->normalizeArgument($this->else); - return '('.$queryBuilder->compilePredicates($this->predicates).')'. - ' ? '.$this->then->compile($queryBuilder). - ' : '.$this->else->compile($queryBuilder); + return '(' . $queryBuilder->compilePredicates($this->predicates) . ')' . + ' ? ' . $this->then->compile($queryBuilder) . + ' : ' . $this->else->compile($queryBuilder); } } diff --git a/src/Expressions/VariableExpression.php b/src/Expressions/VariableExpression.php index 93b3465..6a8f5fd 100644 --- a/src/Expressions/VariableExpression.php +++ b/src/Expressions/VariableExpression.php @@ -7,6 +7,4 @@ /** * AQL literal expression. */ -class VariableExpression extends LiteralExpression implements ExpressionInterface -{ -} +class VariableExpression extends LiteralExpression implements ExpressionInterface {} diff --git a/src/Grammar.php b/src/Grammar.php index 6f36477..b3ba06f 100644 --- a/src/Grammar.php +++ b/src/Grammar.php @@ -152,7 +152,7 @@ public function getDateFormat() public function wrap( string $value ): string { - return '`'.addcslashes($value, '`').'`'; + return '`' . addcslashes($value, '`') . '`'; } public function mapArgumentTypeToExpressionType( @@ -174,7 +174,7 @@ public function formatBind( $prefix = '@@'; } - return $prefix.$bindVariableName; + return $prefix . $bindVariableName; } /** diff --git a/src/QueryBuilder.php b/src/QueryBuilder.php index e417bfa..88702b5 100644 --- a/src/QueryBuilder.php +++ b/src/QueryBuilder.php @@ -26,14 +26,14 @@ */ class QueryBuilder { - use NormalizesExpressions; use CompilesPredicates; - use HasQueryClauses; - use HasStatementClauses; - use HasGraphClauses; use HasFunctions; + use HasGraphClauses; use HasOperatorExpressions; + use HasQueryClauses; + use HasStatementClauses; use HasSupportCommands; + use NormalizesExpressions; /** * The database query grammar instance. @@ -136,11 +136,10 @@ public function removeCommand(int $index = null): bool /** * @param mixed $collections * @param string $mode - * @return QueryBuilder */ public function registerCollections($collections, $mode = 'write'): self { - if (! is_array($collections)) { + if (!is_array($collections)) { $collections = [$collections]; } @@ -233,7 +232,7 @@ public function bindCollection( */ protected function validateBindVariable(?string $to): void { - if (isset($to) && ! $this->grammar->isBindParameter($to)) { + if (isset($to) && !$this->grammar->isBindParameter($to)) { throw new BindException('Invalid bind parameter.'); } } @@ -241,7 +240,7 @@ protected function validateBindVariable(?string $to): void protected function generateBindVariable(?string $to): string { if ($to == null) { - $to = $this->queryId.'_'.(count($this->binds) + 1); + $to = $this->queryId . '_' . (count($this->binds) + 1); } return $to; @@ -255,7 +254,7 @@ public function compile(): self $this->query = ''; /** @var Expression|Clause @command */ foreach ($this->commands as $command) { - $this->query .= ' '.$command->compile($this); + $this->query .= ' ' . $command->compile($this); } $this->query = trim($this->query); @@ -301,7 +300,7 @@ public function unsetNullValues(array $arguments): array return array_filter( $arguments, function ($value) { - return ! is_null($value); + return !is_null($value); } ); } diff --git a/src/QueryElement.php b/src/QueryElement.php index 53da2c4..23472de 100644 --- a/src/QueryElement.php +++ b/src/QueryElement.php @@ -8,9 +8,6 @@ abstract class QueryElement { /** * Compile clause|expression output. - * - * @param QueryBuilder $queryBuilder - * @return string */ abstract public function compile(QueryBuilder $queryBuilder): string; } diff --git a/src/Traits/CompilesPredicates.php b/src/Traits/CompilesPredicates.php index 5006811..0d4bbbf 100644 --- a/src/Traits/CompilesPredicates.php +++ b/src/Traits/CompilesPredicates.php @@ -14,7 +14,7 @@ trait CompilesPredicates public function compilePredicates( array|PredicateExpression $predicates ): string { - if (! is_array($predicates)) { + if (!is_array($predicates)) { $predicates = [$predicates]; } @@ -37,16 +37,14 @@ protected function compilePredicate(PredicateExpression $predicate, int $positio { $compiledPredicate = ''; if ($position > 0) { - $compiledPredicate = $predicate->logicalOperator.' '; + $compiledPredicate = $predicate->logicalOperator . ' '; } - return $compiledPredicate.$predicate->compile($this); + return $compiledPredicate . $predicate->compile($this); } /** * @param array $predicates - * @param int $position - * @return string */ protected function compilePredicateGroup( array $predicates, @@ -66,9 +64,9 @@ protected function compilePredicateGroup( $groupCompilation = ''; if ($position > 0) { - $groupCompilation = $logicalOperator.' '; + $groupCompilation = $logicalOperator . ' '; } - return $groupCompilation.'('.implode(' ', $compiledPredicates).')'; + return $groupCompilation . '(' . implode(' ', $compiledPredicates) . ')'; } } diff --git a/src/Traits/NormalizesArangoSearchFunctions.php b/src/Traits/NormalizesArangoSearchFunctions.php index 6071b29..0281154 100644 --- a/src/Traits/NormalizesArangoSearchFunctions.php +++ b/src/Traits/NormalizesArangoSearchFunctions.php @@ -17,8 +17,8 @@ trait NormalizesArangoSearchFunctions protected function normalizeAnalyzer(QueryBuilder $queryBuilder): void { if ( - ! is_array($this->parameters['predicates']) - && ! $this->parameters['predicates'] instanceof PredicateExpression + !is_array($this->parameters['predicates']) + && !$this->parameters['predicates'] instanceof PredicateExpression ) { $this->parameters['predicates'] = [$this->parameters['predicates']]; } @@ -35,8 +35,8 @@ protected function normalizeAnalyzer(QueryBuilder $queryBuilder): void protected function normalizeBoost(QueryBuilder $queryBuilder): void { if ( - ! is_array($this->parameters['predicates']) - && ! $this->parameters['predicates'] instanceof PredicateExpression + !is_array($this->parameters['predicates']) + && !$this->parameters['predicates'] instanceof PredicateExpression ) { $this->parameters['predicates'] = [$this->parameters['predicates']]; } diff --git a/src/Traits/NormalizesExpressions.php b/src/Traits/NormalizesExpressions.php index d16eb4b..388d23d 100644 --- a/src/Traits/NormalizesExpressions.php +++ b/src/Traits/NormalizesExpressions.php @@ -60,7 +60,7 @@ public function normalizeArgument( */ protected function normalizeScalar( array|string|int|float|bool $argument, - null|array|string $allowedExpressionTypes = null + array|string $allowedExpressionTypes = null ): Expression { $argumentType = $this->determineArgumentType($argument, $allowedExpressionTypes); @@ -85,7 +85,7 @@ protected function createExpression( if ($expressionType == 'CollectionBind') { return $this->bindCollection($argument); } - $expressionClass = '\LaravelFreelancerNL\FluentAQL\Expressions\\'.$expressionType.'Expression'; + $expressionClass = '\LaravelFreelancerNL\FluentAQL\Expressions\\' . $expressionType . 'Expression'; /** @phpstan-ignore-next-line */ return new $expressionClass($argument); @@ -94,19 +94,18 @@ protected function createExpression( /** * @param array|object $argument * @param array|string|null $allowedExpressionTypes - * @return Expression * * @throws ExpressionTypeException * @throws BindException */ protected function normalizeCompound( array|object $argument, - null|array|string $allowedExpressionTypes = null + array|string $allowedExpressionTypes = null ): Expression { if (is_array($argument)) { return $this->normalizeArray($argument, $allowedExpressionTypes); } - if (! is_iterable($argument)) { + if (!is_iterable($argument)) { return $this->normalizeObject($argument, $allowedExpressionTypes); } @@ -124,7 +123,7 @@ protected function normalizeCompound( */ protected function normalizeIterable( array $argument, - null|array|string $allowedExpressionTypes = null + array|string $allowedExpressionTypes = null ): array { $result = []; /** @var mixed $value */ @@ -163,7 +162,6 @@ public function normalizePredicates( /** * @param array|PredicateExpression $predicate - * @return PredicateExpression * * @throws ExpressionTypeException|BindException */ @@ -213,7 +211,7 @@ protected function normalizePredicate(array|PredicateExpression $predicate): Pre */ protected function determineArgumentType( mixed $argument, - null|array|string $allowedExpressionTypes = null + array|string $allowedExpressionTypes = null ): string { if (is_string($allowedExpressionTypes)) { $allowedExpressionTypes = [$allowedExpressionTypes]; @@ -224,7 +222,7 @@ protected function determineArgumentType( /** @var string $allowedExpressionType */ foreach ($allowedExpressionTypes as $allowedExpressionType) { - $check = 'is'.$allowedExpressionType; + $check = 'is' . $allowedExpressionType; if ($allowedExpressionType == 'Reference' || $allowedExpressionType == 'RegisteredVariable') { if ($this->grammar->$check($argument, $this->variables)) { return $allowedExpressionType; @@ -237,13 +235,13 @@ protected function determineArgumentType( } $errorMessage = 'The argument does not match one of these expression types: ' - .implode(', ', $allowedExpressionTypes) - .'.'; + . implode(', ', $allowedExpressionTypes) + . '.'; if (isStringable($argument)) { $errorMessage = "This argument '$argument', does not match one of these expression types: " - .implode(', ', $allowedExpressionTypes) - .'.'; + . implode(', ', $allowedExpressionTypes) + . '.'; } throw new ExpressionTypeException($errorMessage); @@ -258,7 +256,7 @@ protected function determineArgumentType( */ protected function normalizeArray( array $argument, - null|array|string $allowedExpressionTypes = null + array|string $allowedExpressionTypes = null ): Expression { if ($this->grammar->isAssociativeArray($argument)) { return new ObjectExpression($this->normalizeIterable($argument, $allowedExpressionTypes)); @@ -275,7 +273,7 @@ protected function normalizeArray( */ protected function normalizeObject( object $argument, - null|array|string $allowedExpressionTypes = null + array|string $allowedExpressionTypes = null ): Expression { if ($argument instanceof DateTimeInterface) { return new StringExpression($argument->format(DateTimeInterface::ATOM)); @@ -293,7 +291,7 @@ public function processBindExpression(Expression $argument): Expression if ($argument instanceof BindExpression) { $bindKey = ltrim($argument->getBindVariable(), '@'); - if (! isset($this->binds[$bindKey])) { + if (!isset($this->binds[$bindKey])) { $this->binds[$bindKey] = $argument->getData(); } } diff --git a/src/Traits/NormalizesMiscellaneousFunctions.php b/src/Traits/NormalizesMiscellaneousFunctions.php index 21c7c25..cd6e3dd 100644 --- a/src/Traits/NormalizesMiscellaneousFunctions.php +++ b/src/Traits/NormalizesMiscellaneousFunctions.php @@ -17,8 +17,8 @@ trait NormalizesMiscellaneousFunctions protected function normalizeAssert(QueryBuilder $queryBuilder): void { if ( - ! is_array($this->parameters['predicates']) - && ! $this->parameters['predicates'] instanceof PredicateExpression + !is_array($this->parameters['predicates']) + && !$this->parameters['predicates'] instanceof PredicateExpression ) { $this->parameters['predicates'] = [$this->parameters['predicates']]; } diff --git a/src/Traits/ValidatesExpressions.php b/src/Traits/ValidatesExpressions.php index 750ec9a..7c12223 100644 --- a/src/Traits/ValidatesExpressions.php +++ b/src/Traits/ValidatesExpressions.php @@ -34,7 +34,7 @@ public function isNull(mixed $value): bool public function isNumber(mixed $value): bool { - return is_numeric($value) && ! is_string($value); + return is_numeric($value) && !is_string($value); } public function isList(mixed $value): bool @@ -49,7 +49,6 @@ public function isQuery(mixed $value): bool /** * @param mixed $value - * @return bool */ public function isFunction($value): bool { @@ -58,7 +57,6 @@ public function isFunction($value): bool /** * @param mixed $value - * @return bool */ public function isSortDirection($value): bool { @@ -71,7 +69,6 @@ public function isSortDirection($value): bool /** * @param mixed $value - * @return bool */ public function isGraphDirection($value): bool { @@ -84,7 +81,6 @@ public function isGraphDirection($value): bool /** * @param mixed $value - * @return bool */ public function isCollection($value): bool { @@ -97,7 +93,6 @@ public function isCollection($value): bool /** * @param mixed $value - * @return bool */ public function isGraph($value): bool { @@ -106,7 +101,6 @@ public function isGraph($value): bool /** * @param mixed $value - * @return bool */ public function isKey($value): bool { @@ -122,7 +116,6 @@ public function isKey($value): bool /** * @param mixed $value - * @return bool */ public function isId($value): bool { @@ -158,7 +151,6 @@ public function isBindParameter(string $bindParameter): bool * Check if the array is associative. * * @param array $array - * @return bool */ public function isAssociativeArray(array $array): bool { @@ -166,14 +158,13 @@ public function isAssociativeArray(array $array): bool return false; } - return ! ctype_digit(implode('', array_keys($array))); + return !ctype_digit(implode('', array_keys($array))); } /** * Check if the array is numeric. * * @param array $array - * @return bool */ public function isIndexedArray(array $array): bool { diff --git a/src/Traits/ValidatesOperators.php b/src/Traits/ValidatesOperators.php index b05999c..3dcc4b3 100644 --- a/src/Traits/ValidatesOperators.php +++ b/src/Traits/ValidatesOperators.php @@ -6,28 +6,16 @@ trait ValidatesOperators { - /** - * @param string $operator - * @return bool - */ public function isLogicalOperator(string $operator): bool { return isset($this->logicalOperators[strtoupper($operator)]); } - /** - * @param string $operator - * @return bool - */ public function isComparisonOperator(string $operator): bool { return isset($this->comparisonOperators[strtoupper($operator)]); } - /** - * @param string $operator - * @return bool - */ public function isArithmeticOperator(string $operator): bool { return isset($this->arithmeticOperators[$operator]); diff --git a/src/Traits/ValidatesPredicates.php b/src/Traits/ValidatesPredicates.php index be7d33b..3f59d5b 100644 --- a/src/Traits/ValidatesPredicates.php +++ b/src/Traits/ValidatesPredicates.php @@ -17,8 +17,8 @@ public function isPredicate(mixed $value): bool if ( is_array($value) && isset($value[0]) - && ! is_array($value[0]) - && ! $value[0] instanceof PredicateExpression + && !is_array($value[0]) + && !$value[0] instanceof PredicateExpression ) { return true; } diff --git a/src/Traits/ValidatesReferences.php b/src/Traits/ValidatesReferences.php index 07bce95..0bec6e2 100644 --- a/src/Traits/ValidatesReferences.php +++ b/src/Traits/ValidatesReferences.php @@ -49,7 +49,7 @@ public function isRegisteredVariable( public function isAttribute(mixed $value): bool { $pattern = '/^(@?[\d\w_]+|`@?[\d\w_]+`)(\[\`.+\`\]|\[[\d\w\*]*\])*' - .'(\.(\`.+\`|@?[\d\w]*)(\[\`.+\`\]|\[[\d\w\*]*\])*)*$/'; + . '(\.(\`.+\`|@?[\d\w]*)(\[\`.+\`\]|\[[\d\w\*]*\])*)*$/'; if ( is_string($value) && preg_match($pattern, $value) @@ -69,14 +69,14 @@ public function isReference( ): bool { $variables = implode('|', $registeredVariables); - if (! is_string($value) || empty($value)) { + if (!is_string($value) || empty($value)) { return false; } return (bool) preg_match( '/^(' - .$variables - .'|CURRENT|NEW|OLD)(\[\`.+\`\]|\[[\d\w\*]*\])*(\.(\`.+\`|@?[\d\w]*)(\[\`.+\`\]|\[[\d\w\*]*\])*)*$/', + . $variables + . '|CURRENT|NEW|OLD)(\[\`.+\`\]|\[[\d\w\*]*\])*(\.(\`.+\`|@?[\d\w]*)(\[\`.+\`\]|\[[\d\w\*]*\])*)*$/', $value ); } diff --git a/src/helpers.php b/src/helpers.php index ba83032..ad09ca9 100644 --- a/src/helpers.php +++ b/src/helpers.php @@ -2,7 +2,7 @@ declare(strict_types=1); -if (! function_exists('isStringable')) { +if (!function_exists('isStringable')) { function isStringable(mixed $value): bool { if ($value === null || is_scalar($value) || $value instanceof Stringable) { diff --git a/tests/TestCase.php b/tests/TestCase.php index b614629..9fcbd89 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -1,11 +1,13 @@ aqb = new QueryBuilder(); } + + public function testDummy() + { + self::assertEquals(true, true); + } } diff --git a/tests/Unit/AQL/ArangoSearchFunctionsTest.php b/tests/Unit/AQL/ArangoSearchFunctionsTest.php index 201029f..d02fa6c 100644 --- a/tests/Unit/AQL/ArangoSearchFunctionsTest.php +++ b/tests/Unit/AQL/ArangoSearchFunctionsTest.php @@ -3,7 +3,7 @@ namespace Tests\Unit\AQL; use LaravelFreelancerNL\FluentAQL\QueryBuilder; -use LaravelFreelancerNL\FluentAQL\Tests\TestCase; +use Tests\TestCase; /** * @covers \LaravelFreelancerNL\FluentAQL\AQL\HasArangoSearchFunctions @@ -21,7 +21,7 @@ public function testAnalyzer() ->return($qb->analyzer('doc.text', '==', 'bar', 'text_en')); self::assertEquals( - 'FOR doc IN viewName RETURN ANALYZER(doc.text == "bar", @'.$qb->getQueryId().'_1)', + 'FOR doc IN viewName RETURN ANALYZER(doc.text == "bar", @' . $qb->getQueryId() . '_1)', $qb->get()->query ); } @@ -37,7 +37,7 @@ public function testAnalyzerMultiplePredicates() self::assertEquals( 'FOR doc IN viewName RETURN ANALYZER((doc.text == "foo" OR doc.text == "bar"), @' - .$qb->getQueryId().'_1)', + . $qb->getQueryId() . '_1)', $qb->get()->query ); } @@ -79,7 +79,7 @@ public function testBm25() self::assertEquals( 'FOR doc IN viewName SEARCH ANALYZER("bar", @' - .$qb->getQueryId().'_1) SORT BM25(doc) desc RETURN doc', + . $qb->getQueryId() . '_1) SORT BM25(doc) desc RETURN doc', $qb->get()->query ); } @@ -94,7 +94,7 @@ public function testBm25WithK() self::assertEquals( 'FOR doc IN viewName SEARCH ANALYZER("bar", @' - .$qb->getQueryId().'_1) SORT BM25(doc, 0.75) desc RETURN doc', + . $qb->getQueryId() . '_1) SORT BM25(doc, 0.75) desc RETURN doc', $qb->get()->query ); } @@ -109,7 +109,7 @@ public function testBm25WithKAndB() self::assertEquals( 'FOR doc IN viewName SEARCH ANALYZER("bar", @' - .$qb->getQueryId().'_1) SORT BM25(doc, 0.75, 1) desc RETURN doc', + . $qb->getQueryId() . '_1) SORT BM25(doc, 0.75, 1) desc RETURN doc', $qb->get()->query ); } @@ -124,7 +124,7 @@ public function testTfidf() self::assertEquals( 'FOR doc IN viewName SEARCH ANALYZER("bar", @' - .$qb->getQueryId().'_1) SORT TFIDF(doc) desc RETURN doc', + . $qb->getQueryId() . '_1) SORT TFIDF(doc) desc RETURN doc', $qb->get()->query ); } @@ -139,7 +139,7 @@ public function testTfidfNormalize() self::assertEquals( 'FOR doc IN viewName SEARCH ANALYZER("bar", @' - .$qb->getQueryId().'_1) SORT TFIDF(doc, true) desc RETURN doc', + . $qb->getQueryId() . '_1) SORT TFIDF(doc, true) desc RETURN doc', $qb->get()->query ); } @@ -166,7 +166,7 @@ public function testExistsWithTypeCheck() self::assertEquals( 'FOR doc IN viewName SEARCH EXISTS(doc.text, @' - .$qb->getQueryId().'_1) RETURN doc', + . $qb->getQueryId() . '_1) RETURN doc', $qb->get()->query ); } @@ -206,7 +206,7 @@ public function testLevenshteinMatch() self::assertEquals( 'FOR doc IN viewName SEARCH LEVENSHTEIN_MATCH(doc.text, @' - .$qb->getQueryId().'_1, 2) RETURN doc.text', + . $qb->getQueryId() . '_1, 2) RETURN doc.text', $qb->get()->query ); } @@ -220,8 +220,8 @@ public function testLevenshteinMatchWithOptionalParameters() self::assertEquals( 'FOR doc IN viewName SEARCH LEVENSHTEIN_MATCH(doc.text, @' - .$qb->getQueryId().'_1, 2, false, 0, @' - .$qb->getQueryId().'_2) RETURN doc.text', + . $qb->getQueryId() . '_1, 2, false, 0, @' + . $qb->getQueryId() . '_2) RETURN doc.text', $qb->get()->query ); } @@ -235,8 +235,8 @@ public function testLike() self::assertEquals( 'FOR doc IN viewName SEARCH ANALYZER(LIKE(doc.text, @' - .$qb->getQueryId().'_2), @' - .$qb->getQueryId().'_1) RETURN doc.text', + . $qb->getQueryId() . '_2), @' + . $qb->getQueryId() . '_1) RETURN doc.text', $qb->get()->query ); } @@ -250,7 +250,7 @@ public function testNgramMatch() self::assertEquals( 'FOR doc IN viewName SEARCH NGRAM_MATCH(doc.text, @' - .$qb->getQueryId().'_1) RETURN doc.text', + . $qb->getQueryId() . '_1) RETURN doc.text', $qb->get()->query ); } @@ -264,8 +264,8 @@ public function testNgramMatchOptionalArgs() self::assertEquals( 'FOR doc IN viewName SEARCH NGRAM_MATCH(doc.text, @' - .$qb->getQueryId().'_1, 0.8, @' - .$qb->getQueryId().'_2) RETURN doc.text', + . $qb->getQueryId() . '_1, 0.8, @' + . $qb->getQueryId() . '_2) RETURN doc.text', $qb->get()->query ); } @@ -279,7 +279,7 @@ public function testPhrase() self::assertEquals( 'FOR doc IN viewName SEARCH PHRASE(doc.text, @' - .$qb->getQueryId().'_1) RETURN doc.text', + . $qb->getQueryId() . '_1) RETURN doc.text', $qb->get()->query ); } @@ -293,8 +293,8 @@ public function testPhraseWithAnalyzer() self::assertEquals( 'FOR doc IN viewName SEARCH PHRASE(doc.text, @' - .$qb->getQueryId().'_1, @' - .$qb->getQueryId().'_2) RETURN doc.text', + . $qb->getQueryId() . '_1, @' + . $qb->getQueryId() . '_2) RETURN doc.text', $qb->get()->query ); } @@ -308,9 +308,9 @@ public function testPhraseWithSkipsPartsAndAnalyzer() self::assertEquals( 'FOR doc IN viewName SEARCH PHRASE(doc.text, @' - .$qb->getQueryId().'_1, 2, @' - .$qb->getQueryId().'_2, @' - .$qb->getQueryId().'_3) RETURN doc.text', + . $qb->getQueryId() . '_1, 2, @' + . $qb->getQueryId() . '_2, @' + . $qb->getQueryId() . '_3) RETURN doc.text', $qb->get()->query ); } diff --git a/tests/Unit/AQL/ArrayFunctionsTest.php b/tests/Unit/AQL/ArrayFunctionsTest.php index d4d2ca5..63ac2b9 100644 --- a/tests/Unit/AQL/ArrayFunctionsTest.php +++ b/tests/Unit/AQL/ArrayFunctionsTest.php @@ -3,7 +3,7 @@ namespace Tests\Unit\AQL; use LaravelFreelancerNL\FluentAQL\QueryBuilder; -use LaravelFreelancerNL\FluentAQL\Tests\TestCase; +use Tests\TestCase; /** * @covers \LaravelFreelancerNL\FluentAQL\AQL\HasArrayFunctions diff --git a/tests/Unit/AQL/DateFunctionsTest.php b/tests/Unit/AQL/DateFunctionsTest.php index 69e3e6a..3ae4d61 100644 --- a/tests/Unit/AQL/DateFunctionsTest.php +++ b/tests/Unit/AQL/DateFunctionsTest.php @@ -4,7 +4,7 @@ use DateTime; use LaravelFreelancerNL\FluentAQL\QueryBuilder; -use LaravelFreelancerNL\FluentAQL\Tests\TestCase; +use Tests\TestCase; /** * @covers \LaravelFreelancerNL\FluentAQL\AQL\HasDateFunctions @@ -26,10 +26,10 @@ public function testDateCompare() )); self::assertEquals( - 'RETURN DATE_COMPARE(@'.$qb->getQueryId() - .'_1, DATE_NOW(), @' - .$qb->getQueryId().'_2, @' - .$qb->getQueryId().'_3)', + 'RETURN DATE_COMPARE(@' . $qb->getQueryId() + . '_1, DATE_NOW(), @' + . $qb->getQueryId() . '_2, @' + . $qb->getQueryId() . '_3)', $qb->get()->query ); } @@ -136,7 +136,7 @@ public function testDateFormat() { $qb = new QueryBuilder(); $qb->return($qb->dateFormat(1399472349522, '%q/%yyyy')); - self::assertEquals('RETURN DATE_FORMAT(1399472349522, @'.$qb->getQueryId().'_1)', $qb->get()->query); + self::assertEquals('RETURN DATE_FORMAT(1399472349522, @' . $qb->getQueryId() . '_1)', $qb->get()->query); } public function testDateUtcToLocal() @@ -150,9 +150,9 @@ public function testDateUtcToLocal() ); self::assertEquals( - 'RETURN DATE_UTCTOLOCAL(@'.$qb->getQueryId() - .'_1, @' - .$qb->getQueryId().'_2)', + 'RETURN DATE_UTCTOLOCAL(@' . $qb->getQueryId() + . '_1, @' + . $qb->getQueryId() . '_2)', $qb->get()->query ); } @@ -175,9 +175,9 @@ public function testDateUtcToLocalWithZoneInfo() ); self::assertEquals( - 'RETURN DATE_UTCTOLOCAL(@'.$qb->getQueryId() - .'_1, @' - .$qb->getQueryId().'_2, {"name":"UTC","begin":null,"end":null,"dst":true,"offset":0})', + 'RETURN DATE_UTCTOLOCAL(@' . $qb->getQueryId() + . '_1, @' + . $qb->getQueryId() . '_2, {"name":"UTC","begin":null,"end":null,"dst":true,"offset":0})', $qb->get()->query ); } @@ -193,9 +193,9 @@ public function testDateLocalToUtc() ); self::assertEquals( - 'RETURN DATE_LOCALTOUTC(@'.$qb->getQueryId() - .'_1, @' - .$qb->getQueryId().'_2)', + 'RETURN DATE_LOCALTOUTC(@' . $qb->getQueryId() + . '_1, @' + . $qb->getQueryId() . '_2)', $qb->get()->query ); } @@ -218,9 +218,9 @@ public function testDateLocalToUtcWithZoneInfo() ); self::assertEquals( - 'RETURN DATE_LOCALTOUTC(@'.$qb->getQueryId() - .'_1, @' - .$qb->getQueryId().'_2, {"name":"UTC","begin":null,"end":null,"dst":true,"offset":0})', + 'RETURN DATE_LOCALTOUTC(@' . $qb->getQueryId() + . '_1, @' + . $qb->getQueryId() . '_2, {"name":"UTC","begin":null,"end":null,"dst":true,"offset":0})', $qb->get()->query ); } @@ -231,9 +231,9 @@ public function testDateTrunc() $qb->return($qb->dateTrunc('2017-02-03', 'month')); self::assertEquals( - 'RETURN DATE_TRUNC(@'.$qb->getQueryId() - .'_1, @' - .$qb->getQueryId().'_2)', + 'RETURN DATE_TRUNC(@' . $qb->getQueryId() + . '_1, @' + . $qb->getQueryId() . '_2)', $qb->get()->query ); } @@ -244,9 +244,9 @@ public function testDateRound() $qb->return($qb->dateRound('2017-02-03', 15, 'minutes')); self::assertEquals( - 'RETURN DATE_ROUND(@'.$qb->getQueryId() - .'_1, 15, @' - .$qb->getQueryId().'_2)', + 'RETURN DATE_ROUND(@' . $qb->getQueryId() + . '_1, 15, @' + . $qb->getQueryId() . '_2)', $qb->get()->query ); } @@ -258,7 +258,7 @@ public function testDateTimeObjectParameter() $qb->return($qb->dateRound($date, 15, 'minutes')); self::assertEquals( 'RETURN DATE_ROUND("2011-01-01T15:03:01+00:00", 15, @' - .$qb->getQueryId().'_1)', + . $qb->getQueryId() . '_1)', $qb->get()->query ); } diff --git a/tests/Unit/AQL/DocumentFunctionsTest.php b/tests/Unit/AQL/DocumentFunctionsTest.php index 475b4ec..5cac947 100644 --- a/tests/Unit/AQL/DocumentFunctionsTest.php +++ b/tests/Unit/AQL/DocumentFunctionsTest.php @@ -3,7 +3,7 @@ namespace Tests\Unit\AQL; use LaravelFreelancerNL\FluentAQL\QueryBuilder; -use LaravelFreelancerNL\FluentAQL\Tests\TestCase; +use Tests\TestCase; /** * @covers \LaravelFreelancerNL\FluentAQL\AQL\HasDocumentFunctions @@ -120,7 +120,7 @@ public function testParseIdentifier() $qb->return($qb->parseIdentifier('_users/my-user')); self::assertEquals('RETURN PARSE_IDENTIFIER(@' - .$qb->getQueryId().'_1)', $qb->get()->query); + . $qb->getQueryId() . '_1)', $qb->get()->query); } public function testUnset() diff --git a/tests/Unit/AQL/FilterClauseTest.php b/tests/Unit/AQL/FilterClauseTest.php index 408b1a0..2bc5d1f 100644 --- a/tests/Unit/AQL/FilterClauseTest.php +++ b/tests/Unit/AQL/FilterClauseTest.php @@ -3,7 +3,7 @@ namespace Tests\Unit\AQL; use LaravelFreelancerNL\FluentAQL\QueryBuilder; -use LaravelFreelancerNL\FluentAQL\Tests\TestCase; +use Tests\TestCase; /** * Class QueryExpressionTest diff --git a/tests/Unit/AQL/GeoFunctionsTest.php b/tests/Unit/AQL/GeoFunctionsTest.php index f304fcf..f90d7c4 100644 --- a/tests/Unit/AQL/GeoFunctionsTest.php +++ b/tests/Unit/AQL/GeoFunctionsTest.php @@ -3,7 +3,7 @@ namespace Tests\Unit\AQL; use LaravelFreelancerNL\FluentAQL\QueryBuilder; -use LaravelFreelancerNL\FluentAQL\Tests\TestCase; +use Tests\TestCase; /** * @covers \LaravelFreelancerNL\FluentAQL\AQL\HasGeoFunctions @@ -26,8 +26,8 @@ public function testDistanceByReference() ->return($qb->distance('l.lat', 'l.lon', 'u.lat', 'u.lon')); self::assertEquals( 'FOR l IN locations' - .' FOR u IN users' - .' RETURN DISTANCE(l.lat, l.lon, u.lat, u.lon)', + . ' FOR u IN users' + . ' RETURN DISTANCE(l.lat, l.lon, u.lat, u.lon)', $qb->get()->query ); } @@ -43,9 +43,9 @@ public function testGeoArea() self::assertEquals( 'LET polygon = {"type":"Polygon",' - .'"coordinates":[[[-11.5,23.5],[-10.5,26.1],[-11.2,27.1],[-11.5,23.5]]]}' - .' RETURN GEO_AREA(polygon, @' - .$qb->getQueryId().'_1)', + . '"coordinates":[[[-11.5,23.5],[-10.5,26.1],[-11.2,27.1],[-11.5,23.5]]]}' + . ' RETURN GEO_AREA(polygon, @' + . $qb->getQueryId() . '_1)', $qb->get()->query ); } @@ -62,9 +62,9 @@ public function testGeoContains() self::assertEquals( 'LET polygon = {"type":"Polygon",' - .'"coordinates":[[[-11.5,23.5],[-10.5,26.1],[-11.2,27.1],[-11.5,23.5]]]}' - .' FOR loc IN locations' - .' RETURN GEO_CONTAINS(polygon, loc.address.geometry)', + . '"coordinates":[[[-11.5,23.5],[-10.5,26.1],[-11.2,27.1],[-11.5,23.5]]]}' + . ' FOR loc IN locations' + . ' RETURN GEO_CONTAINS(polygon, loc.address.geometry)', $qb->get()->query ); } @@ -82,11 +82,11 @@ public function testGeoDistance() self::assertEquals( 'LET polygon = {"type":"Polygon",' - .'"coordinates":[[[-11.5,23.5],[-10.5,26.1],[-11.2,27.1],[-11.5,23.5]]]}' - .' FOR loc IN locations' - .' LET distance = GEO_DISTANCE(loc.geometry, polygon, @' - .$qb->getQueryId().'_1)' - .' RETURN distance', + . '"coordinates":[[[-11.5,23.5],[-10.5,26.1],[-11.2,27.1],[-11.5,23.5]]]}' + . ' FOR loc IN locations' + . ' LET distance = GEO_DISTANCE(loc.geometry, polygon, @' + . $qb->getQueryId() . '_1)' + . ' RETURN distance', $qb->get()->query ); } @@ -103,9 +103,9 @@ public function testGeoEquals() self::assertEquals( 'LET polygon = {"type":"Polygon",' - .'"coordinates":[[[-11.5,23.5],[-10.5,26.1],[-11.2,27.1],[-11.5,23.5]]]}' - .' FOR loc IN locations' - .' RETURN GEO_EQUALS(polygon, loc.address.geometry)', + . '"coordinates":[[[-11.5,23.5],[-10.5,26.1],[-11.2,27.1],[-11.5,23.5]]]}' + . ' FOR loc IN locations' + . ' RETURN GEO_EQUALS(polygon, loc.address.geometry)', $qb->get()->query ); } @@ -122,9 +122,9 @@ public function testGeoIntersects() self::assertEquals( 'LET polygon = {"type":"Polygon",' - .'"coordinates":[[[-11.5,23.5],[-10.5,26.1],[-11.2,27.1],[-11.5,23.5]]]}' - .' FOR loc IN locations' - .' RETURN GEO_INTERSECTS(polygon, loc.address.geometry)', + . '"coordinates":[[[-11.5,23.5],[-10.5,26.1],[-11.2,27.1],[-11.5,23.5]]]}' + . ' FOR loc IN locations' + . ' RETURN GEO_INTERSECTS(polygon, loc.address.geometry)', $qb->get()->query ); } @@ -141,9 +141,9 @@ public function testGeoInRange() self::assertEquals( 'LET polygon = {"type":"Polygon",' - .'"coordinates":[[[-11.5,23.5],[-10.5,26.1],[-11.2,27.1],[-11.5,23.5]]]}' - .' FOR loc IN locations' - .' RETURN GEO_IN_RANGE(polygon, loc.address.geometry, 10, 100)', + . '"coordinates":[[[-11.5,23.5],[-10.5,26.1],[-11.2,27.1],[-11.5,23.5]]]}' + . ' FOR loc IN locations' + . ' RETURN GEO_IN_RANGE(polygon, loc.address.geometry, 10, 100)', $qb->get()->query ); } @@ -169,9 +169,9 @@ public function testGeoInRangeIncludeEdges() self::assertEquals( 'LET polygon = {"type":"Polygon",' - .'"coordinates":[[[-11.5,23.5],[-10.5,26.1],[-11.2,27.1],[-11.5,23.5]]]}' - .' FOR loc IN locations' - .' RETURN GEO_IN_RANGE(polygon, loc.address.geometry, 10, 100, false, true)', + . '"coordinates":[[[-11.5,23.5],[-10.5,26.1],[-11.2,27.1],[-11.5,23.5]]]}' + . ' FOR loc IN locations' + . ' RETURN GEO_IN_RANGE(polygon, loc.address.geometry, 10, 100, false, true)', $qb->get()->query ); } @@ -251,7 +251,7 @@ public function testGeoMultiPolygon() self::assertEquals( 'RETURN GEO_MULTIPOLYGON([[[[40,40],[20,45],[45,30],[40,40]]' - .'],[[[20,35],[10,30],[10,10],[30,5],[45,20],[20,35]],[[30,20],[20,15],[20,25],[30,20]]]])', + . '],[[[20,35],[10,30],[10,10],[30,5],[45,20],[20,35]],[[30,20],[20,15],[20,25],[30,20]]]])', $qb->get()->query ); } diff --git a/tests/Unit/AQL/GraphClausesTest.php b/tests/Unit/AQL/GraphClausesTest.php index eb43b02..70b914c 100644 --- a/tests/Unit/AQL/GraphClausesTest.php +++ b/tests/Unit/AQL/GraphClausesTest.php @@ -3,7 +3,7 @@ namespace Tests\Unit\AQL; use LaravelFreelancerNL\FluentAQL\QueryBuilder; -use LaravelFreelancerNL\FluentAQL\Tests\TestCase; +use Tests\TestCase; /** * @covers \LaravelFreelancerNL\FluentAQL\AQL\HasQueryClauses @@ -140,8 +140,8 @@ public function testPruneClause() ->get(); self::assertEquals( 'FOR v, e, p IN 1..5 OUTBOUND "circles/A" GRAPH "traversalGraph"' - .' PRUNE e.theTruth == true' - .' RETURN {"vertices":p.vertices[*]._key,"edges":p.edges[*].label}', + . ' PRUNE e.theTruth == true' + . ' RETURN {"vertices":p.vertices[*]._key,"edges":p.edges[*].label}', $qb->query ); @@ -157,8 +157,8 @@ public function testPruneClause() ->get(); self::assertEquals( 'FOR v, e, p IN 1..5 OUTBOUND "circles/A" GRAPH "traversalGraph"' - .' PRUNE e.theTruth == true' - .' RETURN {"vertices":p.vertices[*]._key,"edges":p.edges[*].label}', + . ' PRUNE e.theTruth == true' + . ' RETURN {"vertices":p.vertices[*]._key,"edges":p.edges[*].label}', $qb->query ); } @@ -180,8 +180,8 @@ public function testPruneClauseWithMultiplePredicates() ->get(); self::assertEquals( 'FOR v, e, p IN 1..5 OUTBOUND "circles/A" GRAPH "traversalGraph"' - .' PRUNE e.active == true AND e.age > 18' - .' RETURN {"vertices":p.vertices[*]._key,"edges":p.edges[*].label}', + . ' PRUNE e.active == true AND e.age > 18' + . ' RETURN {"vertices":p.vertices[*]._key,"edges":p.edges[*].label}', $qb->query ); } @@ -209,8 +209,8 @@ public function testPruneClauseWithVariable() ->get(); self::assertEquals( 'FOR v, e, p IN 1..5 OUTBOUND "circles/A" GRAPH "traversalGraph"' - .' PRUNE pruneCondition = e.theTruth == true' - .' RETURN {"vertices":p.vertices[*]._key,"edges":p.edges[*].label}', + . ' PRUNE pruneCondition = e.theTruth == true' + . ' RETURN {"vertices":p.vertices[*]._key,"edges":p.edges[*].label}', $qb->query ); @@ -233,8 +233,8 @@ public function testPruneClauseWithVariable() ->get(); self::assertEquals( 'FOR v, e, p IN 1..5 OUTBOUND "circles/A" GRAPH "traversalGraph"' - .' PRUNE pruneCondition = e.theTruth == true' - .' RETURN {"vertices":p.vertices[*]._key,"edges":p.edges[*].label}', + . ' PRUNE pruneCondition = e.theTruth == true' + . ' RETURN {"vertices":p.vertices[*]._key,"edges":p.edges[*].label}', $qb->query ); @@ -260,8 +260,8 @@ public function testPruneClauseWithVariable() ->get(); self::assertEquals( 'FOR v, e, p IN 1..5 OUTBOUND "circles/A" GRAPH "traversalGraph"' - .' PRUNE pruneCondition = e.theTruth == true AND e.theTruth != false' - .' RETURN {"vertices":p.vertices[*]._key,"edges":p.edges[*].label}', + . ' PRUNE pruneCondition = e.theTruth == true AND e.theTruth != false' + . ' RETURN {"vertices":p.vertices[*]._key,"edges":p.edges[*].label}', $qb->query ); } diff --git a/tests/Unit/AQL/MiscellaneousFunctionsTest.php b/tests/Unit/AQL/MiscellaneousFunctionsTest.php index 3405a31..495b053 100644 --- a/tests/Unit/AQL/MiscellaneousFunctionsTest.php +++ b/tests/Unit/AQL/MiscellaneousFunctionsTest.php @@ -3,7 +3,7 @@ namespace Tests\Unit\AQL; use LaravelFreelancerNL\FluentAQL\QueryBuilder; -use LaravelFreelancerNL\FluentAQL\Tests\TestCase; +use Tests\TestCase; /** * @covers \LaravelFreelancerNL\FluentAQL\AQL\HasMiscellaneousFunctions @@ -19,7 +19,7 @@ public function testAssert() ->return($qb->assert('doc.text', '==', 'bar', 'Text is not the same')); self::assertEquals( - 'FOR doc IN viewName RETURN ASSERT(doc.text == "bar", @'.$qb->getQueryId().'_1)', + 'FOR doc IN viewName RETURN ASSERT(doc.text == "bar", @' . $qb->getQueryId() . '_1)', $qb->get()->query ); } @@ -35,7 +35,7 @@ public function testAssertMultiplePredicates() self::assertEquals( 'FOR doc IN viewName RETURN ASSERT((doc.text == "foo" OR doc.text == "bar"), @' - .$qb->getQueryId().'_1)', + . $qb->getQueryId() . '_1)', $qb->get()->query ); } @@ -71,7 +71,7 @@ public function testDocumentFunction() ->return($qb->document('pages', 'variable')); self::assertEquals( - 'LET variable = @'.$qb->getQueryId().'_1 RETURN DOCUMENT(pages, variable)', + 'LET variable = @' . $qb->getQueryId() . '_1 RETURN DOCUMENT(pages, variable)', $qb->get()->query ); } @@ -94,7 +94,7 @@ public function testFirstDocument() { $qb = new QueryBuilder(); $qb->return($qb->firstDocument('users')); - self::assertEquals('RETURN FIRST_DOCUMENT(@'.$qb->getQueryId().'_1)', $qb->get()->query); + self::assertEquals('RETURN FIRST_DOCUMENT(@' . $qb->getQueryId() . '_1)', $qb->get()->query); } public function testWarn() @@ -104,7 +104,7 @@ public function testWarn() ->return($qb->warn('doc.text', '==', 'bar', 'Text is not the same')); self::assertEquals( - 'FOR doc IN viewName RETURN WARN(doc.text == "bar", @'.$qb->getQueryId().'_1)', + 'FOR doc IN viewName RETURN WARN(doc.text == "bar", @' . $qb->getQueryId() . '_1)', $qb->get()->query ); } @@ -120,7 +120,7 @@ public function testWarnMultiplePredicates() self::assertEquals( 'FOR doc IN viewName RETURN WARN((doc.text == "foo" OR doc.text == "bar"), @' - .$qb->getQueryId().'_1)', + . $qb->getQueryId() . '_1)', $qb->get()->query ); } diff --git a/tests/Unit/AQL/NumericFunctionsTest.php b/tests/Unit/AQL/NumericFunctionsTest.php index fbd9d21..c85c5f5 100644 --- a/tests/Unit/AQL/NumericFunctionsTest.php +++ b/tests/Unit/AQL/NumericFunctionsTest.php @@ -3,7 +3,7 @@ namespace Tests\Unit\AQL; use LaravelFreelancerNL\FluentAQL\QueryBuilder; -use LaravelFreelancerNL\FluentAQL\Tests\TestCase; +use Tests\TestCase; /** * @covers \LaravelFreelancerNL\FluentAQL\AQL\HasNumericFunctions diff --git a/tests/Unit/AQL/OperatorExpressionsTest.php b/tests/Unit/AQL/OperatorExpressionsTest.php index a2e2a41..5f5fa84 100644 --- a/tests/Unit/AQL/OperatorExpressionsTest.php +++ b/tests/Unit/AQL/OperatorExpressionsTest.php @@ -3,7 +3,7 @@ namespace Tests\Unit\AQL; use LaravelFreelancerNL\FluentAQL\QueryBuilder; -use LaravelFreelancerNL\FluentAQL\Tests\TestCase; +use Tests\TestCase; /** * @covers \LaravelFreelancerNL\FluentAQL\AQL\HasOperatorExpressions diff --git a/tests/Unit/AQL/QueryClausesTest.php b/tests/Unit/AQL/QueryClausesTest.php index b73e316..5c82d66 100644 --- a/tests/Unit/AQL/QueryClausesTest.php +++ b/tests/Unit/AQL/QueryClausesTest.php @@ -3,7 +3,7 @@ namespace Tests\Unit\AQL; use LaravelFreelancerNL\FluentAQL\QueryBuilder; -use LaravelFreelancerNL\FluentAQL\Tests\TestCase; +use Tests\TestCase; use stdClass; /** @@ -57,7 +57,7 @@ public function testForClauseWithCollectionBind() ->get(); self::assertEquals('FOR u IN @@' - .$qb->getQueryId().'_1', $qb->query); + . $qb->getQueryId() . '_1', $qb->query); } public function testForClauseInExpression() @@ -114,7 +114,7 @@ public function testFilterOnNullValueCanUseAllLogicalOperators() ->get(); self::assertEquals( 'FOR doc IN documents FILTER doc.attribute1 != null AND doc.attribute2 != null' - .' AND doc.attribute3 != null RETURN doc', + . ' AND doc.attribute3 != null RETURN doc', $result->query ); } @@ -198,7 +198,7 @@ public function testFiltersWithEmptyStringValue() ->filter('doc.test', '==', '') ->get(); self::assertEquals( - 'FOR doc IN documents FILTER doc.test == @'.$result->getQueryId().'_1', + 'FOR doc IN documents FILTER doc.test == @' . $result->getQueryId() . '_1', $result->query ); } @@ -234,7 +234,7 @@ public function testCollectClause() $result = (new QueryBuilder()) ->collect('doc', 'expression') ->get(); - self::assertEquals('COLLECT doc = @'.$result->getQueryId().'_1', $result->query); + self::assertEquals('COLLECT doc = @' . $result->getQueryId() . '_1', $result->query); $result = (new QueryBuilder()) ->for('u', 'Users') @@ -252,7 +252,7 @@ public function testCollectMultipleClause() ->get(); self::assertEquals( 'FOR u IN Users COLLECT hometown = u.city, surname = u.surname' - .' RETURN [hometown,surname]', + . ' RETURN [hometown,surname]', $result->query ); } @@ -267,14 +267,14 @@ public function testIntoClause() $result = (new QueryBuilder()) ->into('groupsVariable', 'projectionExpression') ->get(); - self::assertEquals('INTO groupsVariable = @'.$result->getQueryId().'_1', $result->query); + self::assertEquals('INTO groupsVariable = @' . $result->getQueryId() . '_1', $result->query); $result = (new QueryBuilder()) ->into('groupsVariable', '{ "name" : u.name, "isActive" : u.status == "active" }')->get(); - self::assertEquals('INTO groupsVariable = @'.$result->getQueryId().'_1', $result->query); + self::assertEquals('INTO groupsVariable = @' . $result->getQueryId() . '_1', $result->query); } public function testKeepClause() @@ -369,7 +369,7 @@ public function testAggregateClause() $result = (new QueryBuilder()) ->aggregate('variableName', 'aggregateExpression') ->get(); - self::assertEquals('AGGREGATE variableName = @'.$result->getQueryId().'_1', $result->query); + self::assertEquals('AGGREGATE variableName = @' . $result->getQueryId() . '_1', $result->query); } public function testReturnClause() @@ -382,7 +382,7 @@ public function testReturnClause() $result = (new QueryBuilder()) ->return('u.name') ->get(); - self::assertEquals('RETURN @'.$result->getQueryId().'_1', $result->query); + self::assertEquals('RETURN @' . $result->getQueryId() . '_1', $result->query); $result = (new QueryBuilder()) ->for('u', 'Users') @@ -393,12 +393,12 @@ public function testReturnClause() $result = (new QueryBuilder()) ->return('1 + 1') ->get(); - self::assertEquals('RETURN @'.$result->getQueryId().'_1', $result->query); + self::assertEquals('RETURN @' . $result->getQueryId() . '_1', $result->query); $result = (new QueryBuilder()) ->return('1 + 1', true) ->get(); - self::assertEquals('RETURN DISTINCT @'.$result->getQueryId().'_1', $result->query); + self::assertEquals('RETURN DISTINCT @' . $result->getQueryId() . '_1', $result->query); } public function testOptionsClause() diff --git a/tests/Unit/AQL/StatementClausesTest.php b/tests/Unit/AQL/StatementClausesTest.php index 187a8b5..ef7210a 100644 --- a/tests/Unit/AQL/StatementClausesTest.php +++ b/tests/Unit/AQL/StatementClausesTest.php @@ -3,7 +3,7 @@ namespace Tests\Unit\AQL; use LaravelFreelancerNL\FluentAQL\QueryBuilder; -use LaravelFreelancerNL\FluentAQL\Tests\TestCase; +use Tests\TestCase; use stdClass; /** @@ -33,7 +33,7 @@ public function testLetStatement() "C" ] }')->get(); - self::assertEquals('LET x = @'.$result->getQueryId().'_1', $result->query); + self::assertEquals('LET x = @' . $result->getQueryId() . '_1', $result->query); $qb = new QueryBuilder(); $object = new stdClass(); @@ -46,18 +46,18 @@ public function testLetStatement() ->get(); self::assertEquals( 'LET x = {"name":"Catelyn","surname":"Stark","alive":false,"age":40,"traits":[@' - .$result->getQueryId() - .'_1,@' - .$result->getQueryId() - .'_2,@' - .$result->getQueryId() - .'_3]}', + . $result->getQueryId() + . '_1,@' + . $result->getQueryId() + . '_2,@' + . $result->getQueryId() + . '_3]}', $result->query ); $result = (new QueryBuilder())->let('x', 'y') ->get(); - self::assertEquals('LET x = @'.$result->getQueryId().'_1', $result->query); + self::assertEquals('LET x = @' . $result->getQueryId() . '_1', $result->query); } public function testInsertStatement() @@ -73,7 +73,7 @@ public function testInsertStatement() "C" ] }', 'Characters')->get(); - self::assertEquals('INSERT @'.$result->getQueryId().'_1 IN Characters', $result->query); + self::assertEquals('INSERT @' . $result->getQueryId() . '_1 IN Characters', $result->query); } public function testInsertEmptyArrayStatement() @@ -99,7 +99,7 @@ public function testUpdateClause() '{ name: CONCAT(u.firstName, " ", u.lastName) }', 'users' )->get(); - self::assertEquals('FOR u IN users UPDATE u WITH @'.$result->getQueryId().'_1 IN users', $result->query); + self::assertEquals('FOR u IN users UPDATE u WITH @' . $result->getQueryId() . '_1 IN users', $result->query); } public function testUpdateMaintainsNullValue() @@ -127,7 +127,7 @@ public function testReplaceStatement() 'users' ) ->get(); - self::assertEquals('FOR u IN users REPLACE u WITH @'.$result->getQueryId().'_1 IN users', $result->query); + self::assertEquals('FOR u IN users REPLACE u WITH @' . $result->getQueryId() . '_1 IN users', $result->query); } public function testUpsertStatement() @@ -141,12 +141,12 @@ public function testUpsertStatement() )->get(); self::assertEquals( 'UPSERT @' - .$result->getQueryId() - .'_1 INSERT @' - .$result->getQueryId() - .'_2 UPDATE @' - .$result->getQueryId() - .'_3 IN users', + . $result->getQueryId() + . '_1 INSERT @' + . $result->getQueryId() + . '_2 UPDATE @' + . $result->getQueryId() + . '_3 IN users', $result->query ); @@ -160,12 +160,12 @@ public function testUpsertStatement() )->get(); self::assertEquals( 'UPSERT @' - .$result->getQueryId() - .'_1 INSERT @' - .$result->getQueryId() - .'_2 REPLACE @' - .$result->getQueryId() - .'_3 IN users', + . $result->getQueryId() + . '_1 INSERT @' + . $result->getQueryId() + . '_2 REPLACE @' + . $result->getQueryId() + . '_3 IN users', $result->query ); } @@ -187,6 +187,6 @@ public function testRemoveStatement() ->for('i', '1..1000') ->remove('{ _key: CONCAT(\'test\', i) }', 'users') ->get(); - self::assertEquals('FOR i IN 1..1000 REMOVE @'.$result->getQueryId().'_1 IN users', $result->query); + self::assertEquals('FOR i IN 1..1000 REMOVE @' . $result->getQueryId() . '_1 IN users', $result->query); } } diff --git a/tests/Unit/AQL/StringFunctionsTest.php b/tests/Unit/AQL/StringFunctionsTest.php index 16489ae..53887d9 100644 --- a/tests/Unit/AQL/StringFunctionsTest.php +++ b/tests/Unit/AQL/StringFunctionsTest.php @@ -3,7 +3,7 @@ namespace Tests\Unit\AQL; use LaravelFreelancerNL\FluentAQL\QueryBuilder; -use LaravelFreelancerNL\FluentAQL\Tests\TestCase; +use Tests\TestCase; /** * @covers \LaravelFreelancerNL\FluentAQL\AQL\HasStringFunctions @@ -18,9 +18,9 @@ public function testConcat() $qb->return($qb->concat('string', 'this', 'together')); self::assertEquals( 'RETURN CONCAT(@' - .$qb->getQueryId().'_1, @' - .$qb->getQueryId().'_2, @' - .$qb->getQueryId().'_3)', + . $qb->getQueryId() . '_1, @' + . $qb->getQueryId() . '_2, @' + . $qb->getQueryId() . '_3)', $qb->get()->query ); } @@ -31,10 +31,10 @@ public function testConcatSeparator() $qb->return($qb->concatSeparator('-', 'string', 'this', 'together')); self::assertEquals( 'RETURN CONCAT_SEPARATOR(@' - .$qb->getQueryId().'_1, @' - .$qb->getQueryId().'_2, @' - .$qb->getQueryId().'_3, @' - .$qb->getQueryId().'_4)', + . $qb->getQueryId() . '_1, @' + . $qb->getQueryId() . '_2, @' + . $qb->getQueryId() . '_3, @' + . $qb->getQueryId() . '_4)', $qb->get()->query ); } @@ -45,8 +45,8 @@ public function testContains() $qb->return($qb->contains('foobarbaz', 'bar')); self::assertEquals( 'RETURN CONTAINS(@' - .$qb->getQueryId().'_1, @' - .$qb->getQueryId().'_2, false)', + . $qb->getQueryId() . '_1, @' + . $qb->getQueryId() . '_2, false)', $qb->get()->query ); } @@ -57,8 +57,8 @@ public function testContainsReturnsIndex() $qb->return($qb->contains('foobarbaz', 'bar', true)); self::assertEquals( 'RETURN CONTAINS(@' - .$qb->getQueryId().'_1, @' - .$qb->getQueryId().'_2, true)', + . $qb->getQueryId() . '_1, @' + . $qb->getQueryId() . '_2, true)', $qb->get()->query ); } @@ -69,8 +69,8 @@ public function testFindFirst() $qb->return($qb->findFirst('foobarbaz', 'bar')); self::assertEquals( 'RETURN FIND_FIRST(@' - .$qb->getQueryId().'_1, @' - .$qb->getQueryId().'_2)', + . $qb->getQueryId() . '_1, @' + . $qb->getQueryId() . '_2)', $qb->get()->query ); } @@ -81,8 +81,8 @@ public function testFindFirstWithStart() $qb->return($qb->findFirst('foobarbaz', 'bar', 3)); self::assertEquals( 'RETURN FIND_FIRST(@' - .$qb->getQueryId().'_1, @' - .$qb->getQueryId().'_2, 3)', + . $qb->getQueryId() . '_1, @' + . $qb->getQueryId() . '_2, 3)', $qb->get()->query ); } @@ -93,8 +93,8 @@ public function testFindFirstWithStartAndEnd() $qb->return($qb->findFirst('foobarbaz', 'bar', 3, 12)); self::assertEquals( 'RETURN FIND_FIRST(@' - .$qb->getQueryId().'_1, @' - .$qb->getQueryId().'_2, 3, 12)', + . $qb->getQueryId() . '_1, @' + . $qb->getQueryId() . '_2, 3, 12)', $qb->get()->query ); } @@ -105,8 +105,8 @@ public function testFindLast() $qb->return($qb->findLast('foobarbaz', 'bar')); self::assertEquals( 'RETURN FIND_LAST(@' - .$qb->getQueryId().'_1, @' - .$qb->getQueryId().'_2)', + . $qb->getQueryId() . '_1, @' + . $qb->getQueryId() . '_2)', $qb->get()->query ); } @@ -117,8 +117,8 @@ public function testFindLastWithStart() $qb->return($qb->findLast('foobarbaz', 'bar', 3)); self::assertEquals( 'RETURN FIND_LAST(@' - .$qb->getQueryId().'_1, @' - .$qb->getQueryId().'_2, 3)', + . $qb->getQueryId() . '_1, @' + . $qb->getQueryId() . '_2, 3)', $qb->get()->query ); } @@ -129,8 +129,8 @@ public function testFindLastWithStartAndEnd() $qb->return($qb->findLast('foobarbaz', 'bar', 3, 12)); self::assertEquals( 'RETURN FIND_LAST(@' - .$qb->getQueryId().'_1, @' - .$qb->getQueryId().'_2, 3, 12)', + . $qb->getQueryId() . '_1, @' + . $qb->getQueryId() . '_2, 3, 12)', $qb->get()->query ); } @@ -141,8 +141,8 @@ public function testContainsReturnIndex() $qb->return($qb->contains('foobarbaz', 'bar', true)); self::assertEquals( 'RETURN CONTAINS(@' - .$qb->getQueryId().'_1, @' - .$qb->getQueryId().'_2, true)', + . $qb->getQueryId() . '_1, @' + . $qb->getQueryId() . '_2, true)', $qb->get()->query ); } @@ -153,8 +153,8 @@ public function testLevenshteinDistance() $qb->return($qb->levenshteinDistance('foobar', 'bar')); self::assertEquals( 'RETURN LEVENSHTEIN_DISTANCE(@' - .$qb->getQueryId().'_1, @' - .$qb->getQueryId().'_2)', + . $qb->getQueryId() . '_1, @' + . $qb->getQueryId() . '_2)', $qb->get()->query ); } @@ -165,7 +165,7 @@ public function testLeftTrim() $qb->return($qb->ltrim('/ Lörem ipsüm, DOLOR SIT Ämet./')); self::assertEquals( 'RETURN LTRIM(@' - .$qb->getQueryId().'_1, null)', + . $qb->getQueryId() . '_1, null)', $qb->get()->query ); } @@ -176,8 +176,8 @@ public function testLeftTrimWithChar() $qb->return($qb->ltrim('/ Lörem ipsüm, DOLOR SIT Ämet./', '/')); self::assertEquals( 'RETURN LTRIM(@' - .$qb->getQueryId().'_1, @' - .$qb->getQueryId().'_2)', + . $qb->getQueryId() . '_1, @' + . $qb->getQueryId() . '_2)', $qb->get()->query ); } @@ -188,8 +188,8 @@ public function testRegexMatches() $qb->return($qb->regexMatches('foobarbaz', 'bar', true)); self::assertEquals( 'RETURN REGEX_MATCHES(@' - .$qb->getQueryId().'_1, @' - .$qb->getQueryId().'_2, true)', + . $qb->getQueryId() . '_1, @' + . $qb->getQueryId() . '_2, true)', $qb->get()->query ); } @@ -200,9 +200,9 @@ public function testRegexReplace() $qb->return($qb->regexReplace('foobarbaz', 'bar', 'bars', true)); self::assertEquals( 'RETURN REGEX_REPLACE(@' - .$qb->getQueryId().'_1, @' - .$qb->getQueryId().'_2, @' - .$qb->getQueryId().'_3, true)', + . $qb->getQueryId() . '_1, @' + . $qb->getQueryId() . '_2, @' + . $qb->getQueryId() . '_3, true)', $qb->get()->query ); } @@ -213,8 +213,8 @@ public function testRegexSplit() $qb->return($qb->regexSplit('foobarbaz', 'bar', true, 10)); self::assertEquals( 'RETURN REGEX_SPLIT(@' - .$qb->getQueryId().'_1, @' - .$qb->getQueryId().'_2, true, 10)', + . $qb->getQueryId() . '_1, @' + . $qb->getQueryId() . '_2, true, 10)', $qb->get()->query ); } @@ -225,8 +225,8 @@ public function testRegexTest() $qb->return($qb->regexTest('foobarbaz', 'bar', true)); self::assertEquals( 'RETURN REGEX_TEST(@' - .$qb->getQueryId().'_1, @' - .$qb->getQueryId().'_2, true)', + . $qb->getQueryId() . '_1, @' + . $qb->getQueryId() . '_2, true)', $qb->get()->query ); } @@ -237,7 +237,7 @@ public function testRightTrim() $qb->return($qb->rtrim('/ Lörem ipsüm, DOLOR SIT Ämet./')); self::assertEquals( 'RETURN RTRIM(@' - .$qb->getQueryId().'_1, null)', + . $qb->getQueryId() . '_1, null)', $qb->get()->query ); } @@ -248,8 +248,8 @@ public function testRightTrimWithChar() $qb->return($qb->rtrim('/ Lörem ipsüm, DOLOR SIT Ämet./', '/')); self::assertEquals( 'RETURN RTRIM(@' - .$qb->getQueryId().'_1, @' - .$qb->getQueryId().'_2)', + . $qb->getQueryId() . '_1, @' + . $qb->getQueryId() . '_2)', $qb->get()->query ); } @@ -260,7 +260,7 @@ public function testSoundex() $qb->return($qb->soundex('foobarbaz')); self::assertEquals( 'RETURN SOUNDEX(@' - .$qb->getQueryId().'_1)', + . $qb->getQueryId() . '_1)', $qb->get()->query ); } @@ -271,8 +271,8 @@ public function testSplit() $qb->return($qb->split('foobarbaz', 'bar', 10)); self::assertEquals( 'RETURN SPLIT(@' - .$qb->getQueryId().'_1, @' - .$qb->getQueryId().'_2, 10)', + . $qb->getQueryId() . '_1, @' + . $qb->getQueryId() . '_2, 10)', $qb->get()->query ); } @@ -283,9 +283,9 @@ public function testSubstitute() $qb->return($qb->substitute('foobarbaz', 'bar', 'bars', 10)); self::assertEquals( 'RETURN SUBSTITUTE(@' - .$qb->getQueryId().'_1, @' - .$qb->getQueryId().'_2, @' - .$qb->getQueryId().'_3, 10)', + . $qb->getQueryId() . '_1, @' + . $qb->getQueryId() . '_2, @' + . $qb->getQueryId() . '_3, 10)', $qb->get()->query ); } @@ -296,7 +296,7 @@ public function testSubstring() $qb->return($qb->substring('foobarbaz', 3, 10)); self::assertEquals( 'RETURN SUBSTRING(@' - .$qb->getQueryId().'_1, 3, 10)', + . $qb->getQueryId() . '_1, 3, 10)', $qb->get()->query ); } @@ -307,8 +307,8 @@ public function testTokens() $qb->return($qb->tokens('Lörem ipsüm, DOLOR SIT Ämet.', 'text_de')); self::assertEquals( 'RETURN TOKENS(@' - .$qb->getQueryId().'_1, @' - .$qb->getQueryId().'_2)', + . $qb->getQueryId() . '_1, @' + . $qb->getQueryId() . '_2)', $qb->get()->query ); } @@ -319,7 +319,7 @@ public function testTrim() $qb->return($qb->trim(' Lörem ipsüm, DOLOR SIT Ämet.')); self::assertEquals( 'RETURN TRIM(@' - .$qb->getQueryId().'_1, null)', + . $qb->getQueryId() . '_1, null)', $qb->get()->query ); } @@ -330,7 +330,7 @@ public function testTrimWithType() $qb->return($qb->trim(' Lörem ipsüm, DOLOR SIT Ämet.', 1)); self::assertEquals( 'RETURN TRIM(@' - .$qb->getQueryId().'_1, 1)', + . $qb->getQueryId() . '_1, 1)', $qb->get()->query ); } @@ -341,8 +341,8 @@ public function testTrimWithChar() $qb->return($qb->trim('/ Lörem ipsüm, DOLOR SIT Ämet./', '/')); self::assertEquals( 'RETURN TRIM(@' - .$qb->getQueryId().'_1, @' - .$qb->getQueryId().'_2)', + . $qb->getQueryId() . '_1, @' + . $qb->getQueryId() . '_2)', $qb->get()->query ); } @@ -353,7 +353,7 @@ public function testLower() $qb->return($qb->lower(' Lörem ipsüm, DOLOR SIT Ämet.')); self::assertEquals( 'RETURN LOWER(@' - .$qb->getQueryId().'_1)', + . $qb->getQueryId() . '_1)', $qb->get()->query ); } @@ -364,7 +364,7 @@ public function testUpper() $qb->return($qb->upper(' Lörem ipsüm, DOLOR SIT Ämet.')); self::assertEquals( 'RETURN UPPER(@' - .$qb->getQueryId().'_1)', + . $qb->getQueryId() . '_1)', $qb->get()->query ); } diff --git a/tests/Unit/AQL/SupportCommandsTest.php b/tests/Unit/AQL/SupportCommandsTest.php index 49957d4..9626392 100644 --- a/tests/Unit/AQL/SupportCommandsTest.php +++ b/tests/Unit/AQL/SupportCommandsTest.php @@ -3,7 +3,7 @@ namespace Tests\Unit\AQL; use LaravelFreelancerNL\FluentAQL\QueryBuilder; -use LaravelFreelancerNL\FluentAQL\Tests\TestCase; +use Tests\TestCase; /** * @covers \LaravelFreelancerNL\FluentAQL\QueryBuilder diff --git a/tests/Unit/AQL/TypeFunctionsTest.php b/tests/Unit/AQL/TypeFunctionsTest.php index dea9014..83027c0 100644 --- a/tests/Unit/AQL/TypeFunctionsTest.php +++ b/tests/Unit/AQL/TypeFunctionsTest.php @@ -3,7 +3,7 @@ namespace Tests\Unit\AQL; use LaravelFreelancerNL\FluentAQL\QueryBuilder; -use LaravelFreelancerNL\FluentAQL\Tests\TestCase; +use Tests\TestCase; /** * @covers \LaravelFreelancerNL\FluentAQL\AQL\HasTypeFunctions @@ -18,7 +18,7 @@ public function testToArray() $qb->return($qb->toArray('whatever')); self::assertEquals( 'RETURN TO_ARRAY(@' - .$qb->getQueryId().'_1)', + . $qb->getQueryId() . '_1)', $qb->get()->query ); } @@ -29,7 +29,7 @@ public function testToList() $qb->return($qb->toList('whatever')); self::assertEquals( 'RETURN TO_ARRAY(@' - .$qb->getQueryId().'_1)', + . $qb->getQueryId() . '_1)', $qb->get()->query ); } @@ -40,7 +40,7 @@ public function testToBool() $qb->return($qb->toBool('whatever')); self::assertEquals( 'RETURN TO_BOOL(@' - .$qb->getQueryId().'_1)', + . $qb->getQueryId() . '_1)', $qb->get()->query ); } @@ -51,7 +51,7 @@ public function testToNumber() $qb->return($qb->toNumber('whatever')); self::assertEquals( 'RETURN TO_NUMBER(@' - .$qb->getQueryId().'_1)', + . $qb->getQueryId() . '_1)', $qb->get()->query ); } diff --git a/tests/Unit/Expressions/BindExpressionTest.php b/tests/Unit/Expressions/BindExpressionTest.php index 399ea65..b3d620a 100644 --- a/tests/Unit/Expressions/BindExpressionTest.php +++ b/tests/Unit/Expressions/BindExpressionTest.php @@ -4,7 +4,7 @@ use LaravelFreelancerNL\FluentAQL\Expressions\BindExpression; use LaravelFreelancerNL\FluentAQL\QueryBuilder; -use LaravelFreelancerNL\FluentAQL\Tests\TestCase; +use Tests\TestCase; /** * Class QueryExpressionTest diff --git a/tests/Unit/Expressions/LiteralExpressionTest.php b/tests/Unit/Expressions/LiteralExpressionTest.php index f95313c..227ff39 100644 --- a/tests/Unit/Expressions/LiteralExpressionTest.php +++ b/tests/Unit/Expressions/LiteralExpressionTest.php @@ -6,7 +6,7 @@ use LaravelFreelancerNL\FluentAQL\Expressions\BindExpression; use LaravelFreelancerNL\FluentAQL\Expressions\LiteralExpression; use LaravelFreelancerNL\FluentAQL\QueryBuilder; -use LaravelFreelancerNL\FluentAQL\Tests\TestCase; +use Tests\TestCase; /** * Class QueryExpressionTest diff --git a/tests/Unit/Expressions/NullExpressionTest.php b/tests/Unit/Expressions/NullExpressionTest.php index e78c645..491633c 100644 --- a/tests/Unit/Expressions/NullExpressionTest.php +++ b/tests/Unit/Expressions/NullExpressionTest.php @@ -4,7 +4,7 @@ use LaravelFreelancerNL\FluentAQL\Expressions\NullExpression; use LaravelFreelancerNL\FluentAQL\QueryBuilder; -use LaravelFreelancerNL\FluentAQL\Tests\TestCase; +use Tests\TestCase; /** * Class QueryExpressionTest diff --git a/tests/Unit/Expressions/PredicateExpressionTest.php b/tests/Unit/Expressions/PredicateExpressionTest.php index af6d1af..05a22c3 100644 --- a/tests/Unit/Expressions/PredicateExpressionTest.php +++ b/tests/Unit/Expressions/PredicateExpressionTest.php @@ -5,7 +5,7 @@ use LaravelFreelancerNL\FluentAQL\Expressions\LiteralExpression; use LaravelFreelancerNL\FluentAQL\Expressions\PredicateExpression; use LaravelFreelancerNL\FluentAQL\QueryBuilder; -use LaravelFreelancerNL\FluentAQL\Tests\TestCase; +use Tests\TestCase; /** * Class QueryExpressionTest @@ -78,11 +78,11 @@ public function testGroupOfPredicateExpressions() ); $result = $qb->for('u', 'users') - ->filter([$predicate1, $predicate2]) - ->return('u'); + ->filter([$predicate1, $predicate2]) + ->return('u'); self::assertEquals( - 'FOR u IN users FILTER u.name == @'.$qb->getQueryId().'_1 AND u.age == 27 RETURN u', + 'FOR u IN users FILTER u.name == @' . $qb->getQueryId() . '_1 AND u.age == 27 RETURN u', $result->get()->query ); } diff --git a/tests/Unit/Expressions/QueryExpressionTest.php b/tests/Unit/Expressions/QueryExpressionTest.php index 46d4053..a861dfd 100644 --- a/tests/Unit/Expressions/QueryExpressionTest.php +++ b/tests/Unit/Expressions/QueryExpressionTest.php @@ -4,7 +4,7 @@ use LaravelFreelancerNL\FluentAQL\Expressions\QueryExpression; use LaravelFreelancerNL\FluentAQL\QueryBuilder; -use LaravelFreelancerNL\FluentAQL\Tests\TestCase; +use Tests\TestCase; /** * Class QueryExpressionTest diff --git a/tests/Unit/GrammarTest.php b/tests/Unit/GrammarTest.php index 674c42c..d6115fd 100644 --- a/tests/Unit/GrammarTest.php +++ b/tests/Unit/GrammarTest.php @@ -4,7 +4,7 @@ use LaravelFreelancerNL\FluentAQL\Grammar; use LaravelFreelancerNL\FluentAQL\QueryBuilder; -use LaravelFreelancerNL\FluentAQL\Tests\TestCase; +use Tests\TestCase; use stdClass; /** diff --git a/tests/Unit/HelpersTest.php b/tests/Unit/HelpersTest.php index e46f895..6b9c720 100644 --- a/tests/Unit/HelpersTest.php +++ b/tests/Unit/HelpersTest.php @@ -4,7 +4,7 @@ namespace Tests\Unit; -use LaravelFreelancerNL\FluentAQL\Tests\TestCase; +use Tests\TestCase; class HelpersTest extends TestCase { diff --git a/tests/Unit/QueryBuilderTest.php b/tests/Unit/QueryBuilderTest.php index 02f1e10..d15289e 100644 --- a/tests/Unit/QueryBuilderTest.php +++ b/tests/Unit/QueryBuilderTest.php @@ -9,7 +9,7 @@ use LaravelFreelancerNL\FluentAQL\Expressions\BindExpression; use LaravelFreelancerNL\FluentAQL\Expressions\LiteralExpression; use LaravelFreelancerNL\FluentAQL\QueryBuilder; -use LaravelFreelancerNL\FluentAQL\Tests\TestCase; +use Tests\TestCase; /** * @covers \LaravelFreelancerNL\FluentAQL\QueryBuilder @@ -109,11 +109,11 @@ public function testBind() ] }'); self::assertInstanceOf(BindExpression::class, $bind); - self::assertEquals('@'.$qb->getQueryId().'_1', $bind->compile($qb)); + self::assertEquals('@' . $qb->getQueryId() . '_1', $bind->compile($qb)); - self::arrayHasKey($qb->getQueryId().'_1'); - self::assertIsString($qb->binds[$qb->getQueryId().'_1']); - self::assertEquals(121, strlen($qb->binds[$qb->getQueryId().'_1'])); + self::arrayHasKey($qb->getQueryId() . '_1'); + self::assertIsString($qb->binds[$qb->getQueryId() . '_1']); + self::assertEquals(121, strlen($qb->binds[$qb->getQueryId() . '_1'])); } public function testBindCollection() @@ -122,12 +122,12 @@ public function testBindCollection() $bind = $qb->bindCollection('users'); self::assertInstanceOf(BindExpression::class, $bind); - self::assertEquals('@@'.$qb->getQueryId().'_1', $bind->compile($qb)); + self::assertEquals('@@' . $qb->getQueryId() . '_1', $bind->compile($qb)); - self::arrayHasKey($qb->getQueryId().'_1'); - self::assertIsString($qb->binds[$qb->getQueryId().'_1']); + self::arrayHasKey($qb->getQueryId() . '_1'); + self::assertIsString($qb->binds[$qb->getQueryId() . '_1']); - self::assertEquals('users', $qb->binds[$qb->getQueryId().'_1']); + self::assertEquals('users', $qb->binds[$qb->getQueryId() . '_1']); } public function testInvalidBindVariable() diff --git a/tests/Unit/SubqueryTest.php b/tests/Unit/SubqueryTest.php index 199e6e3..791203b 100644 --- a/tests/Unit/SubqueryTest.php +++ b/tests/Unit/SubqueryTest.php @@ -3,7 +3,7 @@ namespace Tests\Unit; use LaravelFreelancerNL\FluentAQL\QueryBuilder; -use LaravelFreelancerNL\FluentAQL\Tests\TestCase; +use Tests\TestCase; class SubqueryTest extends TestCase { @@ -46,7 +46,7 @@ public function testSubQueryWithBinds() ->get(); self::assertEquals( - 'FOR u IN users FILTER u.active == @'.$subQuery->getQueryId().'_1 RETURN u._key', + 'FOR u IN users FILTER u.active == @' . $subQuery->getQueryId() . '_1 RETURN u._key', $subQuery->query ); @@ -58,16 +58,16 @@ public function testSubQueryWithBinds() ->get(); self::assertEquals( - 'FOR u IN users FILTER u.name == @'. - $result->getQueryId(). - '_1 FILTER u._key == (FOR u IN users FILTER u.active == @'. - $subQuery->getQueryId(). + 'FOR u IN users FILTER u.name == @' . + $result->getQueryId() . + '_1 FILTER u._key == (FOR u IN users FILTER u.active == @' . + $subQuery->getQueryId() . '_1 RETURN u._key) RETURN u', $result->query ); - self::assertArrayHasKey($result->getQueryId().'_1', $result->binds); - self::assertArrayHasKey($subQuery->getQueryId().'_1', $result->binds); + self::assertArrayHasKey($result->getQueryId() . '_1', $result->binds); + self::assertArrayHasKey($subQuery->getQueryId() . '_1', $result->binds); } public function testSubQueryWithManyToManyJoin() @@ -86,7 +86,7 @@ public function testSubQueryWithManyToManyJoin() self::assertEquals( 'FOR b IN books LET a = (FOR x IN b.authors FOR a IN authors FILTER x == a._id RETURN a)' - .' RETURN {"book":b,"authors":a}', + . ' RETURN {"book":b,"authors":a}', $result->query ); } @@ -107,7 +107,7 @@ public function testSubQueryWithFunction() self::assertEquals( 'FOR b IN books LET a = FIRST((FOR x IN b.authors FOR a IN authors FILTER x == a._id RETURN a))' - .' RETURN {"book":b,"authors":a}', + . ' RETURN {"book":b,"authors":a}', $result->query ); } @@ -146,11 +146,11 @@ public function testSubqueryWithLet() self::assertEquals( 'WITH persons' - .' LET verteces = (FOR v IN 0..99 OUTBOUND "persons/123" relations RETURN v._key)' - .' LET edges = (FOR v, e IN 1..99 OUTBOUND "persons/123" relations RETURN e._key)' - .' LET vertexRemovals = (FOR vertexKey IN verteces REMOVE vertexKey IN persons)' - .' LET edgeRemovals = (FOR edgeKey IN edges REMOVE edgeKey IN relations)' - .' RETURN [vertexRemovals,edgeRemovals]', + . ' LET verteces = (FOR v IN 0..99 OUTBOUND "persons/123" relations RETURN v._key)' + . ' LET edges = (FOR v, e IN 1..99 OUTBOUND "persons/123" relations RETURN e._key)' + . ' LET vertexRemovals = (FOR vertexKey IN verteces REMOVE vertexKey IN persons)' + . ' LET edgeRemovals = (FOR edgeKey IN edges REMOVE edgeKey IN relations)' + . ' RETURN [vertexRemovals,edgeRemovals]', $deleteQuery->query ); }