From 7706cb31760af63f2743b6474050a4e0212da4d7 Mon Sep 17 00:00:00 2001 From: Laravel Freelancer NL <36150929+LaravelFreelancerNL@users.noreply.github.com> Date: Tue, 25 Feb 2025 23:11:35 +0100 Subject: [PATCH 01/20] Set minimum version to 11, major only --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 43b3f49..56239c0 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "composer/composer": "^2.8.0", "laravel-freelancer-nl/arangodb-php-client": "^2.8.0", "laravel-freelancer-nl/fluentaql": "^2.0", - "laravel/framework": "^11.0", + "laravel/framework": "^11", "spatie/laravel-data": "^4.4.0", "stevebauman/unfinalize": "^2.1", "vlucas/phpdotenv": "^5.4" From 0d3411889bf22b01d5761328bac45cbd432a804b Mon Sep 17 00:00:00 2001 From: Laravel Freelancer NL <36150929+LaravelFreelancerNL@users.noreply.github.com> Date: Tue, 25 Feb 2025 23:12:24 +0100 Subject: [PATCH 02/20] Added Laravel 12 to the matrix --- .github/workflows/run-tests.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 1840ea4..6551490 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -17,10 +17,12 @@ jobs: matrix: arangodb: ['3.11', '3.12'] php: ['8.2', '8.3', '8.4'] - laravel: ['^11.0'] + laravel: ['^11.0', '^12.0'] include: - laravel: '^11.0' testbench: '^9.0' + - laravel: '^12.0' + testbench: '^10.0' name: QA L ${{ matrix.laravel }} / P ${{ matrix.php }} / A ${{ matrix.arangodb }} - ${{ matrix.dependency-version }} From a6ff28f188c4adba7db3cc3a36bf6630632f4430 Mon Sep 17 00:00:00 2001 From: Deploy Date: Wed, 12 Mar 2025 13:58:07 +0100 Subject: [PATCH 03/20] updated deps --- composer.json | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index 56239c0..f29ee29 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "composer/composer": "^2.8.0", "laravel-freelancer-nl/arangodb-php-client": "^2.8.0", "laravel-freelancer-nl/fluentaql": "^2.0", - "laravel/framework": "^11", + "laravel/framework": "^11.0 || ^12.0", "spatie/laravel-data": "^4.4.0", "stevebauman/unfinalize": "^2.1", "vlucas/phpdotenv": "^5.4" @@ -36,13 +36,12 @@ "laravel/pint": "^1.10", "mockery/mockery": "^1.5.0", "nunomaduro/collision": "^8.0", - "larastan/larastan": "^2.0", - "orchestra/testbench": "^9.0", + "larastan/larastan": "^2.0 || ^3.1", + "orchestra/testbench": "^9.0 || ^10.0", "pestphp/pest": "^2.6.1", - "pestphp/pest-plugin-faker": "^2.0", - "pestphp/pest-plugin-laravel": "^2.0", + "pestphp/pest-plugin-faker": "^2.0 || ^3.0", + "pestphp/pest-plugin-laravel": "^2.0 || ^3.1", "phpmd/phpmd": "2.13", - "phpstan/phpstan": "^1.0", "spatie/laravel-ray": "^1.32", "timacdonald/log-fake": "^2.2.0" }, From 1dcee1bebb3e676557bdfb7201e797deb95deca4 Mon Sep 17 00:00:00 2001 From: Deploy Date: Wed, 12 Mar 2025 14:33:23 +0100 Subject: [PATCH 04/20] updated php --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index f29ee29..e15490b 100644 --- a/composer.json +++ b/composer.json @@ -38,9 +38,9 @@ "nunomaduro/collision": "^8.0", "larastan/larastan": "^2.0 || ^3.1", "orchestra/testbench": "^9.0 || ^10.0", - "pestphp/pest": "^2.6.1", + "pestphp/pest": "^3.7.4", "pestphp/pest-plugin-faker": "^2.0 || ^3.0", - "pestphp/pest-plugin-laravel": "^2.0 || ^3.1", + "pestphp/pest-plugin-laravel": "^3.1", "phpmd/phpmd": "2.13", "spatie/laravel-ray": "^1.32", "timacdonald/log-fake": "^2.2.0" From 894ccea5514005abc4d1c0eb0557dee2cd6e922f Mon Sep 17 00:00:00 2001 From: Deploy Date: Wed, 12 Mar 2025 14:33:54 +0100 Subject: [PATCH 05/20] Updated method call compatibility --- src/AranguentServiceProvider.php | 2 +- src/Connection.php | 2 +- src/Query/Concerns/HandlesAqlGrammar.php | 4 ++-- src/Schema/Builder.php | 14 +++++--------- src/Schema/Concerns/HandlesViews.php | 5 ++++- src/Schema/Grammar.php | 14 +++++++++++++- 6 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/AranguentServiceProvider.php b/src/AranguentServiceProvider.php index 14128d2..f450b9f 100644 --- a/src/AranguentServiceProvider.php +++ b/src/AranguentServiceProvider.php @@ -72,7 +72,7 @@ function ($db) { function ($config, $name) { $config['name'] = $name; $connection = new Connection($config); - $connection->setSchemaGrammar(new SchemaGrammar()); + $connection->setSchemaGrammar(new SchemaGrammar($connection)); return $connection; }, diff --git a/src/Connection.php b/src/Connection.php index b60a5c9..6b66c35 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -93,7 +93,7 @@ protected function getDefaultPostProcessor(): Processor */ protected function getDefaultQueryGrammar() { - ($grammar = new QueryGrammar())->setConnection($this); + $grammar = new QueryGrammar($this); return $grammar; } diff --git a/src/Query/Concerns/HandlesAqlGrammar.php b/src/Query/Concerns/HandlesAqlGrammar.php index cfc0794..c3fa84f 100644 --- a/src/Query/Concerns/HandlesAqlGrammar.php +++ b/src/Query/Concerns/HandlesAqlGrammar.php @@ -148,10 +148,10 @@ public function wrap($value) * @param Expression|string $table * @return float|int|string */ - public function wrapTable($table) + public function wrapTable($table, $prefix = null) { if (!$table instanceof Expression) { - $wrappedTable = $this->wrap($this->tablePrefix . $table); + $wrappedTable = $this->wrap(($prefix ?? $this->tablePrefix) . $table); assert(!is_array($wrappedTable)); diff --git a/src/Schema/Builder.php b/src/Schema/Builder.php index f8bd902..6e1be8f 100644 --- a/src/Schema/Builder.php +++ b/src/Schema/Builder.php @@ -129,11 +129,14 @@ public function getAllTables(): array /** * Get the tables that belong to the database. * + * @param string|string[]|null $schema * @return array * @throws ArangoException */ - public function getTables() + public function getTables($schema = null) { + unset($schema); + return $this->mapResultsToArray( $this->schemaManager->getCollections(true), ); @@ -197,14 +200,7 @@ public function hasColumn($table, $column) */ public function getColumns($table) { - $parameters = []; - $parameters['name'] = 'columns'; - $parameters['handler'] = 'aql'; - $parameters['table'] = $table; - - $command = new Fluent($parameters); - - $compilation = $this->grammar->compileColumns($table, $command); + $compilation = $this->grammar->compileColumns(null, $table); $rawColumns = $this->connection->select($compilation['aqb'], $compilation['bindings']); diff --git a/src/Schema/Concerns/HandlesViews.php b/src/Schema/Concerns/HandlesViews.php index a9a744f..a775a25 100644 --- a/src/Schema/Concerns/HandlesViews.php +++ b/src/Schema/Concerns/HandlesViews.php @@ -40,11 +40,14 @@ public function hasView($view) } /** + * @param string|string[]|null $schema * @return mixed[] * @throws ArangoException */ - public function getViews(): array + public function getViews($schema = null): array { + unset($schema); + return $this->mapResultsToArray( $this->schemaManager->getViews(), ); diff --git a/src/Schema/Grammar.php b/src/Schema/Grammar.php index 1f49b9c..7bbf97a 100644 --- a/src/Schema/Grammar.php +++ b/src/Schema/Grammar.php @@ -24,12 +24,24 @@ class Grammar extends IlluminateGrammar * Compile AQL to check if an attribute is in use within a document in the collection. * If multiple attributes are set then all must be set in one document. * + * @param string|null $schema * @param string $table * @return Fluent * @throws BindException */ - public function compileColumns($table, Fluent $command) + public function compileColumns($schema, $table) { + // At this time we don't use the schema; even if it has been set on the table. + unset($schema); + + $parameters = []; + $parameters['name'] = 'columns'; + $parameters['handler'] = 'aql'; + $parameters['table'] = $table; + + $command = new Fluent($parameters); + + $command->bindings = [ '@collection' => $table, ]; From e2b1160acea04164d3c87802a7c06a31738343b3 Mon Sep 17 00:00:00 2001 From: Deploy Date: Wed, 12 Mar 2025 15:05:34 +0100 Subject: [PATCH 06/20] Fixed phpmd suppressions to be compatible with the latest phpstan. --- src/Concerns/RunsQueries.php | 6 +++--- src/Connection.php | 4 ++-- src/Console/DbCommand.php | 2 +- src/Console/Migrations/MigrateMakeCommand.php | 2 +- src/Eloquent/Casts/AsArrayObject.php | 4 ++-- src/Eloquent/Casts/AsCollection.php | 8 ++++---- src/Eloquent/Casts/AsEnumArrayObject.php | 16 +++++++-------- src/Eloquent/Casts/AsEnumCollection.php | 6 +++--- .../Concerns/HasAranguentRelationships.php | 4 ++-- src/Eloquent/Concerns/HasAttributes.php | 2 +- .../QueriesAranguentRelationships.php | 2 +- src/Migrations/MigrationCreator.php | 4 ++-- src/Providers/CommandServiceProvider.php | 2 +- src/Query/Concerns/BuildsGroups.php | 2 +- src/Query/Concerns/BuildsJoins.php | 10 +++++----- src/Query/Concerns/BuildsSelects.php | 2 +- src/Query/Concerns/BuildsSubqueries.php | 2 +- src/Query/Concerns/BuildsWheres.php | 20 +++++++++---------- src/Query/Concerns/CompilesAggregates.php | 2 +- src/Query/Concerns/CompilesColumns.php | 2 +- src/Query/Concerns/CompilesFilters.php | 10 +++++----- src/Query/Concerns/HandlesAliases.php | 2 +- src/Query/Concerns/HandlesAqlGrammar.php | 2 +- src/Query/Grammar.php | 8 ++++---- src/Query/Processor.php | 2 +- src/Schema/Concerns/HandlesGraphs.php | 2 +- .../Concerns/InteractsWithDatabase.php | 2 +- 27 files changed, 65 insertions(+), 65 deletions(-) diff --git a/src/Concerns/RunsQueries.php b/src/Concerns/RunsQueries.php index bc4c679..28cae0e 100644 --- a/src/Concerns/RunsQueries.php +++ b/src/Concerns/RunsQueries.php @@ -33,7 +33,7 @@ protected function isUniqueConstraintError(Exception $exception) * @param array $bindings * @param bool $useReadPdo * @return \Generator - * @SuppressWarnings(PHPMD.BooleanArgumentFlag) + * @SuppressWarnings("PHPMD.BooleanArgumentFlag") */ public function cursor($query, $bindings = [], $useReadPdo = true) { @@ -195,7 +195,7 @@ protected function handleQueryBuilder($query, array $bindings): array /** * Run a select statement against the database. * - * @SuppressWarnings(PHPMD.BooleanArgumentFlag) + * @SuppressWarnings("PHPMD.BooleanArgumentFlag") * * @param string|FluentAqlBuilder $query * @param array $bindings @@ -210,7 +210,7 @@ public function select($query, $bindings = [], $useReadPdo = true) /** * Run an AQL query against the database and return the results. * - * @SuppressWarnings(PHPMD.BooleanArgumentFlag) + * @SuppressWarnings("PHPMD.BooleanArgumentFlag") * * @param string|FluentAqlBuilder $query * @param array $bindings diff --git a/src/Connection.php b/src/Connection.php index 6b66c35..3ca2992 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -201,7 +201,7 @@ protected function escapeBinary($value) * @param bool $binary * @return string * - * @SuppressWarnings(PHPMD.BooleanArgumentFlag) + * @SuppressWarnings("PHPMD.BooleanArgumentFlag") */ public function escape($value, $binary = false) { @@ -221,7 +221,7 @@ public function escape($value, $binary = false) * @param string $value * @return string * - * @SuppressWarnings(PHPMD.BooleanArgumentFlag) + * @SuppressWarnings("PHPMD.BooleanArgumentFlag") */ protected function escapeString($value, bool $binary = false) { diff --git a/src/Console/DbCommand.php b/src/Console/DbCommand.php index 465fdf4..b0dfda2 100644 --- a/src/Console/DbCommand.php +++ b/src/Console/DbCommand.php @@ -14,7 +14,7 @@ class DbCommand extends IlluminateDbCommand * * @return int * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function handle() { diff --git a/src/Console/Migrations/MigrateMakeCommand.php b/src/Console/Migrations/MigrateMakeCommand.php index 3fae1ee..d782055 100644 --- a/src/Console/Migrations/MigrateMakeCommand.php +++ b/src/Console/Migrations/MigrateMakeCommand.php @@ -111,7 +111,7 @@ public function handle() * * @throws Exception * - * @SuppressWarnings(PHPMD.BooleanArgumentFlag) + * @SuppressWarnings("PHPMD.BooleanArgumentFlag") */ protected function writeMigration($name, $table, $create, $edge = false) { diff --git a/src/Eloquent/Casts/AsArrayObject.php b/src/Eloquent/Casts/AsArrayObject.php index 7cb56fe..b57203c 100644 --- a/src/Eloquent/Casts/AsArrayObject.php +++ b/src/Eloquent/Casts/AsArrayObject.php @@ -17,7 +17,7 @@ class AsArrayObject extends IlluminateAsArrayObject * @param array $arguments * @return \Illuminate\Contracts\Database\Eloquent\CastsAttributes<\Illuminate\Database\Eloquent\Casts\ArrayObject, iterable> * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public static function castUsing(array $arguments) { @@ -44,7 +44,7 @@ public function get($model, $key, $value, $attributes) * @param mixed[] $attributes * @return mixed[] * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function set($model, $key, $value, $attributes) { diff --git a/src/Eloquent/Casts/AsCollection.php b/src/Eloquent/Casts/AsCollection.php index e10056e..3507e08 100644 --- a/src/Eloquent/Casts/AsCollection.php +++ b/src/Eloquent/Casts/AsCollection.php @@ -11,8 +11,8 @@ use LaravelFreelancerNL\Aranguent\Eloquent\Model; /** - * @SuppressWarnings(PHPMD.UndefinedVariable) - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UndefinedVariable") + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ class AsCollection extends IlluminateAsCollection { @@ -37,7 +37,7 @@ public function __construct(protected array $arguments) {} * @param $attributes * @return Collection|mixed|void|null * - * @SuppressWarnings(PHPMD.UndefinedVariable) + * @SuppressWarnings("PHPMD.UndefinedVariable") */ public function get($model, $key, $value, $attributes) { @@ -68,7 +68,7 @@ public function get($model, $key, $value, $attributes) * @param mixed[] $attributes * @return mixed[] * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function set($model, $key, $value, $attributes) { diff --git a/src/Eloquent/Casts/AsEnumArrayObject.php b/src/Eloquent/Casts/AsEnumArrayObject.php index 54f4915..dc6df72 100644 --- a/src/Eloquent/Casts/AsEnumArrayObject.php +++ b/src/Eloquent/Casts/AsEnumArrayObject.php @@ -10,8 +10,8 @@ use LaravelFreelancerNL\Aranguent\Eloquent\Model; /** - * @SuppressWarnings(PHPMD.UndefinedVariable) - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UndefinedVariable") + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ class AsEnumArrayObject extends IlluminateAsEnumArrayObjectAlias { @@ -23,7 +23,7 @@ class AsEnumArrayObject extends IlluminateAsEnumArrayObjectAlias * @param array{class-string} $arguments * @return \Illuminate\Contracts\Database\Eloquent\CastsAttributes<\Illuminate\Database\Eloquent\Casts\ArrayObject, iterable> * - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + * @SuppressWarnings("PHPMD.ExcessiveMethodLength") */ public static function castUsing(array $arguments) { @@ -36,7 +36,7 @@ public static function castUsing(array $arguments) /** * @param array> $arguments * - * @SuppressWarnings(PHPMD.UndefinedVariable) + * @SuppressWarnings("PHPMD.UndefinedVariable") */ public function __construct(array $arguments) { @@ -50,7 +50,7 @@ public function __construct(array $arguments) * @param $attributes * @return ArrayObject|void * - * @SuppressWarnings(PHPMD.UndefinedVariable) + * @SuppressWarnings("PHPMD.UndefinedVariable") */ public function get($model, $key, $value, $attributes) { @@ -83,8 +83,8 @@ public function get($model, $key, $value, $attributes) * @param mixed[] $attributes * @return mixed[] * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - * @SuppressWarnings(PHPMD.UndefinedVariable) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") + * @SuppressWarnings("PHPMD.UndefinedVariable") */ public function set($model, $key, $value, $attributes) { @@ -136,7 +136,7 @@ protected function getStorableEnumValue($enum) * @param class-string $class * @return string * - * @SuppressWarnings(PHPMD.ShortMethodName) + * @SuppressWarnings("PHPMD.ShortMethodName") */ public static function of($class) { diff --git a/src/Eloquent/Casts/AsEnumCollection.php b/src/Eloquent/Casts/AsEnumCollection.php index 334323a..37bbeef 100644 --- a/src/Eloquent/Casts/AsEnumCollection.php +++ b/src/Eloquent/Casts/AsEnumCollection.php @@ -11,9 +11,9 @@ use LaravelFreelancerNL\Aranguent\Eloquent\Model; /** - * @SuppressWarnings(PHPMD.UndefinedVariable) - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - * @SuppressWarnings(PHPMD.ShortMethodName) + * @SuppressWarnings("PHPMD.UndefinedVariable") + * @SuppressWarnings("PHPMD.UnusedFormalParameter") + * @SuppressWarnings("PHPMD.ShortMethodName") */ class AsEnumCollection extends IlluminateAsEnumCollection { diff --git a/src/Eloquent/Concerns/HasAranguentRelationships.php b/src/Eloquent/Concerns/HasAranguentRelationships.php index 3289b8a..b956e08 100644 --- a/src/Eloquent/Concerns/HasAranguentRelationships.php +++ b/src/Eloquent/Concerns/HasAranguentRelationships.php @@ -163,8 +163,8 @@ protected function newMorphTo(Builder $query, Model $parent, $foreignKey, $owner * * Laravel API PHPMD exclusions * - * @SuppressWarnings(PHPMD.BooleanArgumentFlag) - * @SuppressWarnings(PHPMD.ExcessiveParameterList) + * @SuppressWarnings("PHPMD.BooleanArgumentFlag") + * @SuppressWarnings("PHPMD.ExcessiveParameterList") * * @param string $name * @param string $table diff --git a/src/Eloquent/Concerns/HasAttributes.php b/src/Eloquent/Concerns/HasAttributes.php index 37feade..7ed02e4 100644 --- a/src/Eloquent/Concerns/HasAttributes.php +++ b/src/Eloquent/Concerns/HasAttributes.php @@ -24,7 +24,7 @@ protected function isJsonCastable($key) * @param bool $asObject * @return mixed * - * @SuppressWarnings(PHPMD.BooleanArgumentFlag) + * @SuppressWarnings("PHPMD.BooleanArgumentFlag") */ public function fromJson($value, $asObject = false) { diff --git a/src/Eloquent/Concerns/QueriesAranguentRelationships.php b/src/Eloquent/Concerns/QueriesAranguentRelationships.php index fa16bc8..fe6feab 100644 --- a/src/Eloquent/Concerns/QueriesAranguentRelationships.php +++ b/src/Eloquent/Concerns/QueriesAranguentRelationships.php @@ -125,7 +125,7 @@ public function mergeConstraintsFrom(Builder $from) * @param string $function * @return $this * - * @SuppressWarnings(PHPMD.CyclomaticComplexity) + * @SuppressWarnings("PHPMD.CyclomaticComplexity") */ public function withAggregate($relations, $column, $function = null) { diff --git a/src/Migrations/MigrationCreator.php b/src/Migrations/MigrationCreator.php index c786c57..f560b33 100644 --- a/src/Migrations/MigrationCreator.php +++ b/src/Migrations/MigrationCreator.php @@ -59,7 +59,7 @@ public function stubPath() * * @throws FileNotFoundException * - * @SuppressWarnings(PHPMD.BooleanArgumentFlag) + * @SuppressWarnings("PHPMD.BooleanArgumentFlag") */ protected function getStub($table, $create, $edge = false) { @@ -107,7 +107,7 @@ protected function getStub($table, $create, $edge = false) * * @throws \Exception */ - /** @phpstan-ignore-next-line @SuppressWarnings(PHPMD.BooleanArgumentFlag) */ + /** @phpstan-ignore-next-line @SuppressWarnings("PHPMD.BooleanArgumentFlag") */ public function create($name, $path, $table = null, $create = false, $edge = false) { if ($this->useFallback()) { diff --git a/src/Providers/CommandServiceProvider.php b/src/Providers/CommandServiceProvider.php index f2460bb..cfacb90 100644 --- a/src/Providers/CommandServiceProvider.php +++ b/src/Providers/CommandServiceProvider.php @@ -48,7 +48,7 @@ public function register() * @param string[] $commands * @return void * - * @SuppressWarnings(PHPMD.ElseExpression) + * @SuppressWarnings("PHPMD.ElseExpression") */ protected function registerCommands(array $commands) { diff --git a/src/Query/Concerns/BuildsGroups.php b/src/Query/Concerns/BuildsGroups.php index 7607ec3..0a23b86 100644 --- a/src/Query/Concerns/BuildsGroups.php +++ b/src/Query/Concerns/BuildsGroups.php @@ -195,7 +195,7 @@ public function addNestedHavingQuery($query, $boolean = 'and') * @param bool $not * @return $this * - * @SuppressWarnings(PHPMD.BooleanArgumentFlag) + * @SuppressWarnings("PHPMD.BooleanArgumentFlag") */ public function havingBetween($column, iterable $values, $boolean = 'and', $not = false) { diff --git a/src/Query/Concerns/BuildsJoins.php b/src/Query/Concerns/BuildsJoins.php index d8cbe67..caf419d 100644 --- a/src/Query/Concerns/BuildsJoins.php +++ b/src/Query/Concerns/BuildsJoins.php @@ -23,7 +23,7 @@ trait BuildsJoins * @param \Illuminate\Contracts\Database\Query\Expression|string|null $second * @return $this * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function rightJoin($table, $first, $operator = null, $second = null) { @@ -40,7 +40,7 @@ public function rightJoin($table, $first, $operator = null, $second = null) * @param \Illuminate\Contracts\Database\Query\Expression|string|null $second * @return $this * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function rightJoinSub($query, $as, $first, $operator = null, $second = null) { @@ -56,7 +56,7 @@ public function rightJoinSub($query, $as, $first, $operator = null, $second = nu * @param \Illuminate\Contracts\Database\Query\Expression|string $second * @return $this * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function rightJoinWhere($table, $first, $operator, $second) { @@ -69,7 +69,7 @@ public function rightJoinWhere($table, $first, $operator, $second) * * The boolean argument flag is part of this method's API in Laravel. * - * @SuppressWarnings(PHPMD.BooleanArgumentFlag) + * @SuppressWarnings("PHPMD.BooleanArgumentFlag") * * @param mixed $table * @param Closure|string $first @@ -117,7 +117,7 @@ public function join($table, $first, $operator = null, $second = null, $type = ' * * @throws \InvalidArgumentException * - * @SuppressWarnings(PHPMD.BooleanArgumentFlag) + * @SuppressWarnings("PHPMD.BooleanArgumentFlag") */ public function joinSub($query, $as, $first, $operator = null, $second = null, $type = 'inner', $where = false): IlluminateQueryBuilder { diff --git a/src/Query/Concerns/BuildsSelects.php b/src/Query/Concerns/BuildsSelects.php index 3360f43..ba99513 100644 --- a/src/Query/Concerns/BuildsSelects.php +++ b/src/Query/Concerns/BuildsSelects.php @@ -229,7 +229,7 @@ public function inRandomOrder($seed = '') * @param bool $all * @return $this * - * @SuppressWarnings(PHPMD.BooleanArgumentFlag) + * @SuppressWarnings("PHPMD.BooleanArgumentFlag") */ public function union($query, $all = false) { diff --git a/src/Query/Concerns/BuildsSubqueries.php b/src/Query/Concerns/BuildsSubqueries.php index 22cba48..02d5475 100644 --- a/src/Query/Concerns/BuildsSubqueries.php +++ b/src/Query/Concerns/BuildsSubqueries.php @@ -28,7 +28,7 @@ trait BuildsSubqueries * @param \Closure|IlluminateQueryBuilder|IlluminateEloquentBuilder|string $query * @return array * - * @SuppressWarnings(PHPMD.BooleanArgumentFlag) + * @SuppressWarnings("PHPMD.BooleanArgumentFlag") */ public function createSub($query, bool $returnSingleValue = false) { diff --git a/src/Query/Concerns/BuildsWheres.php b/src/Query/Concerns/BuildsWheres.php index e4ddf55..e1781ee 100644 --- a/src/Query/Concerns/BuildsWheres.php +++ b/src/Query/Concerns/BuildsWheres.php @@ -27,7 +27,7 @@ trait BuildsWheres * @param string $boolean * @return $this * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function whereFullText($columns, $value, array $options = [], $boolean = 'and') { @@ -47,7 +47,7 @@ public function whereFullText($columns, $value, array $options = [], $boolean = * * @throws \InvalidArgumentException * - * @SuppressWarnings(PHPMD.BooleanArgumentFlag) + * @SuppressWarnings("PHPMD.BooleanArgumentFlag") */ public function prepareValueAndOperator($value, $operator, $useDefault = false) { @@ -157,7 +157,7 @@ public function addNestedWhereQuery($query, $boolean = 'and') * @param bool $not * @return $this * - * @SuppressWarnings(PHPMD.BooleanArgumentFlag) + * @SuppressWarnings("PHPMD.BooleanArgumentFlag") */ public function addWhereExistsQuery(IlluminateQueryBuilder $query, $boolean = 'and', $not = false) { @@ -195,8 +195,8 @@ public function mergeWheres($wheres, $bindings) * @param string $boolean * @return IlluminateQueryBuilder * - * @SuppressWarnings(PHPMD.CyclomaticComplexity) - * @SuppressWarnings(PHPMD.NPathComplexity) + * @SuppressWarnings("PHPMD.CyclomaticComplexity") + * @SuppressWarnings("PHPMD.NPathComplexity") */ public function where($column, $operator = null, $value = null, $boolean = 'and') { @@ -286,7 +286,7 @@ public function where($column, $operator = null, $value = null, $boolean = 'and' * @param bool $not * @return IlluminateQueryBuilder * - * @SuppressWarnings(PHPMD.BooleanArgumentFlag) + * @SuppressWarnings("PHPMD.BooleanArgumentFlag") */ public function whereBetween($column, iterable $values, $boolean = 'and', $not = false) { @@ -356,7 +356,7 @@ public function whereColumn($first, $operator = null, $second = null, $boolean = * @param bool $not * @return IlluminateQueryBuilder * - * @SuppressWarnings(PHPMD.BooleanArgumentFlag) + * @SuppressWarnings("PHPMD.BooleanArgumentFlag") */ public function whereIn($column, $values, $boolean = 'and', $not = false) { @@ -390,7 +390,7 @@ public function whereIn($column, $values, $boolean = 'and', $not = false) /** * Add a "where JSON contains" clause to the query. * - * @SuppressWarnings(PHPMD.BooleanArgumentFlag) + * @SuppressWarnings("PHPMD.BooleanArgumentFlag") * * @param string $column * @param mixed $value @@ -445,7 +445,7 @@ public function whereJsonLength($column, $operator, $value = null, $boolean = 'a * @param bool $not * @return $this * - * @SuppressWarnings(PHPMD.BooleanArgumentFlag) + * @SuppressWarnings("PHPMD.BooleanArgumentFlag") */ public function whereLike($column, $value, $caseSensitive = false, $boolean = 'and', $not = false) { @@ -466,7 +466,7 @@ public function whereLike($column, $value, $caseSensitive = false, $boolean = 'a * @param bool $not * @return $this * - * @SuppressWarnings(PHPMD.BooleanArgumentFlag) + * @SuppressWarnings("PHPMD.BooleanArgumentFlag") */ public function whereNull($columns, $boolean = 'and', $not = false) { diff --git a/src/Query/Concerns/CompilesAggregates.php b/src/Query/Concerns/CompilesAggregates.php index 27ecca6..be3edc2 100644 --- a/src/Query/Concerns/CompilesAggregates.php +++ b/src/Query/Concerns/CompilesAggregates.php @@ -40,7 +40,7 @@ protected function compileAvg(Builder $query, array $aggregate) /** * Compile AQL for count aggregate. * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") * @param Builder $query * @return string */ diff --git a/src/Query/Concerns/CompilesColumns.php b/src/Query/Concerns/CompilesColumns.php index 50c3966..fb0bca1 100644 --- a/src/Query/Concerns/CompilesColumns.php +++ b/src/Query/Concerns/CompilesColumns.php @@ -76,7 +76,7 @@ protected function compileColumns(IlluminateQueryBuilder $query, $columns) * @return array * @throws Exception * - * @SuppressWarnings(PHPMD.CyclomaticComplexity) + * @SuppressWarnings("PHPMD.CyclomaticComplexity") */ protected function prepareColumns(IlluminateQueryBuilder $query, array $columns) { diff --git a/src/Query/Concerns/CompilesFilters.php b/src/Query/Concerns/CompilesFilters.php index 291ed47..047d3ce 100644 --- a/src/Query/Concerns/CompilesFilters.php +++ b/src/Query/Concerns/CompilesFilters.php @@ -42,7 +42,7 @@ protected function compileWheresToArray($query) * @param array $aql * @return string * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ protected function concatenateWhereClauses($query, $aql) { @@ -357,7 +357,7 @@ protected function filterJsonLength(IlluminateQueryBuilder $query, array $filter * @param array $filter * @return mixed * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ protected function filterExpression(IlluminateQueryBuilder $query, $filter) { @@ -526,7 +526,7 @@ protected function filterSub(IlluminateQueryBuilder $query, $filter) * @param array $filter * @return string * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ protected function filterExists(IlluminateQueryBuilder $query, $filter) { @@ -540,7 +540,7 @@ protected function filterExists(IlluminateQueryBuilder $query, $filter) * @param array $filter * @return string * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ protected function filterNotExists(IlluminateQueryBuilder $query, $filter) { @@ -554,7 +554,7 @@ protected function filterNotExists(IlluminateQueryBuilder $query, $filter) * @param array $filter * @return string * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ protected function filterNested(IlluminateQueryBuilder $query, $filter) { diff --git a/src/Query/Concerns/HandlesAliases.php b/src/Query/Concerns/HandlesAliases.php index 784a57c..0d081c2 100644 --- a/src/Query/Concerns/HandlesAliases.php +++ b/src/Query/Concerns/HandlesAliases.php @@ -175,7 +175,7 @@ public function registerColumnAlias(string $column, ?string $alias = null): bool } /** - * @SuppressWarnings(PHPMD.CyclomaticComplexity) + * @SuppressWarnings("PHPMD.CyclomaticComplexity") */ public function registerTableAlias(string|Expression $table, ?string $alias = null): string { diff --git a/src/Query/Concerns/HandlesAqlGrammar.php b/src/Query/Concerns/HandlesAqlGrammar.php index c3fa84f..07ebf37 100644 --- a/src/Query/Concerns/HandlesAqlGrammar.php +++ b/src/Query/Concerns/HandlesAqlGrammar.php @@ -116,7 +116,7 @@ public function quoteString($value) * @param Array|Expression|string $value * @return array|float|int|string * - * @SuppressWarnings(PHPMD.BooleanArgumentFlag) + * @SuppressWarnings("PHPMD.BooleanArgumentFlag") */ public function wrap($value) { diff --git a/src/Query/Grammar.php b/src/Query/Grammar.php index 903fdd4..54dc477 100644 --- a/src/Query/Grammar.php +++ b/src/Query/Grammar.php @@ -264,7 +264,7 @@ protected function compileFrom(IlluminateQueryBuilder $query, $table) * * @param array $options * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ protected function compileFromOptions($options): string { @@ -297,7 +297,7 @@ protected function compilePostIterationVariables(IlluminateQueryBuilder $query, * @param array $variables * @return string * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ protected function compileVariables(IlluminateQueryBuilder $query, array $variables): string { @@ -367,7 +367,7 @@ protected function compileOrdersToArray(IlluminateQueryBuilder $query, $orders, * @param int $offset * @return string * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ protected function compileOffset(IlluminateQueryBuilder $query, $offset) { @@ -383,7 +383,7 @@ protected function compileOffset(IlluminateQueryBuilder $query, $offset) * @param int $limit * @return string * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ protected function compileLimit(IlluminateQueryBuilder $query, $limit) { diff --git a/src/Query/Processor.php b/src/Query/Processor.php index c3f1d23..7764e4e 100644 --- a/src/Query/Processor.php +++ b/src/Query/Processor.php @@ -12,7 +12,7 @@ class Processor extends IlluminateProcessor /** * Process the results of a "select" query. * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") * * @param array|null $results * @return array diff --git a/src/Schema/Concerns/HandlesGraphs.php b/src/Schema/Concerns/HandlesGraphs.php index db3ea48..7557155 100644 --- a/src/Schema/Concerns/HandlesGraphs.php +++ b/src/Schema/Concerns/HandlesGraphs.php @@ -12,7 +12,7 @@ trait HandlesGraphs * @param array $properties * @throws ArangoException * - * @SuppressWarnings(PHPMD.BooleanArgumentFlag) + * @SuppressWarnings("PHPMD.BooleanArgumentFlag") */ public function createGraph(string $name, array $properties = [], bool $waitForSync = false) { diff --git a/src/Testing/Concerns/InteractsWithDatabase.php b/src/Testing/Concerns/InteractsWithDatabase.php index c5e36af..a0f9195 100644 --- a/src/Testing/Concerns/InteractsWithDatabase.php +++ b/src/Testing/Concerns/InteractsWithDatabase.php @@ -17,7 +17,7 @@ trait InteractsWithDatabase * @param string|null $connection * @return \Illuminate\Contracts\Database\Query\Expression * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ public function castAsJson($value, $connection = null) { From 3a69992f147acaf81f6b9d8f1d19f70ea1a15860 Mon Sep 17 00:00:00 2001 From: Deploy Date: Wed, 12 Mar 2025 15:06:10 +0100 Subject: [PATCH 07/20] Parent compatibility fix --- src/Console/TableCommand.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Console/TableCommand.php b/src/Console/TableCommand.php index 5302e93..f9ea755 100644 --- a/src/Console/TableCommand.php +++ b/src/Console/TableCommand.php @@ -66,10 +66,17 @@ public function handle(ConnectionResolverInterface $connections) return 1; } - $tableName = $this->withoutTablePrefix($connection, $table['name']); + [$columns, $indexes] = $connection->withoutTablePrefix(function ($connection) use ($table) { + $schema = $connection->getSchemaBuilder(); + $tableName = $table['name']; + + return [ + $this->columns($schema, $tableName), + $this->indexes($schema, $tableName) + ]; + }); + - $columns = $this->columns($schema, $tableName); - $indexes = $this->indexes($schema, $tableName); $data = [ 'table' => $table, From df1793d1e268dcf6649346d734dd52d49ac49656 Mon Sep 17 00:00:00 2001 From: Deploy Date: Wed, 12 Mar 2025 15:06:42 +0100 Subject: [PATCH 08/20] Grammar creation compatibility fix --- tests/Pest.php | 4 +- tests/Query/GrammarTest.php | 4 +- tests/Query/IdKeyConversionTest.php | 2 +- tests/Query/InsertTest.php | 2 +- tests/Query/OrderingTest.php | 6 +-- tests/Query/WheresTest.php | 58 ++++++++++++++--------------- 6 files changed, 38 insertions(+), 38 deletions(-) diff --git a/tests/Pest.php b/tests/Pest.php index 7c223d6..63ed5ce 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -54,9 +54,9 @@ /** @link https://pestphp.com/docs/helpers */ -function getBuilder() +function getBuilder($connection) { - $grammar = new Grammar(); + $grammar = new Grammar($connection); $processor = m::mock(Processor::class); return new Builder(m::mock(Connection::class), $grammar, $processor); diff --git a/tests/Query/GrammarTest.php b/tests/Query/GrammarTest.php index 644e928..b35630c 100644 --- a/tests/Query/GrammarTest.php +++ b/tests/Query/GrammarTest.php @@ -1,7 +1,7 @@ connection); $builder = $builder->select(['id', '_id', 'email']) ->from('users'); @@ -12,7 +12,7 @@ }); test('wrap bypass', function () { - $builder = getBuilder(); + $builder = getBuilder($this->connection); $builder = $builder->select('*') ->from('users') ->where('i`d', '=', "a123"); diff --git a/tests/Query/IdKeyConversionTest.php b/tests/Query/IdKeyConversionTest.php index c659147..c6758fe 100644 --- a/tests/Query/IdKeyConversionTest.php +++ b/tests/Query/IdKeyConversionTest.php @@ -24,7 +24,7 @@ }); test('get id conversion single attribute', function () { - $builder = getBuilder(); + $builder = getBuilder($this->connection); $builder = $builder->select('id')->from('users'); $this->assertSame( diff --git a/tests/Query/InsertTest.php b/tests/Query/InsertTest.php index 1f599c0..fe6be9f 100644 --- a/tests/Query/InsertTest.php +++ b/tests/Query/InsertTest.php @@ -25,7 +25,7 @@ test('insert get id', function () { - $builder = getBuilder(); + $builder = getBuilder($this->connection); $builder->getConnection()->shouldReceive('execute')->once()->andReturn(1); $result = $builder->from('users')->insertGetId(['email' => 'foo']); diff --git a/tests/Query/OrderingTest.php b/tests/Query/OrderingTest.php index f9648b2..3ce2a2c 100644 --- a/tests/Query/OrderingTest.php +++ b/tests/Query/OrderingTest.php @@ -5,7 +5,7 @@ use Illuminate\Support\Facades\DB; test('orderBy', function () { - $builder = getBuilder(); + $builder = getBuilder($this->connection); $builder->select('*')->from('users')->orderBy('email')->orderBy('age', 'desc'); $this->assertSame( 'FOR userDoc IN users SORT `userDoc`.`email` ASC, `userDoc`.`age` DESC RETURN userDoc', @@ -46,7 +46,7 @@ }); test('orderByRaw', function () { - $builder = getBuilder(); + $builder = getBuilder($this->connection); $builder->select('*')->from('users')->orderByRaw('userDoc.age @direction', ['@direction' => 'ASC']); $this->assertSame( 'FOR userDoc IN users SORT userDoc.age @direction RETURN userDoc', @@ -56,7 +56,7 @@ test('reorder', function () { - $builder = getBuilder(); + $builder = getBuilder($this->connection); $builder->select('*') ->from('users') ->orderByRaw('userDoc.age @direction', ['@direction' => 'ASC']) diff --git a/tests/Query/WheresTest.php b/tests/Query/WheresTest.php index d243b7b..522f296 100644 --- a/tests/Query/WheresTest.php +++ b/tests/Query/WheresTest.php @@ -4,7 +4,7 @@ use TestSetup\Models\Character; test('basic wheres', function () { - $builder = getBuilder(); + $builder = getBuilder($this->connection); $builder = $builder->select('*') ->from('users') ->where('id', '=', "a123"); @@ -18,7 +18,7 @@ }); test('basic wheres with multiple predicates', function () { - $builder = getBuilder(); + $builder = getBuilder($this->connection); $builder->select('*') ->from('users') ->where('id', '=', 1) @@ -35,7 +35,7 @@ }); test('basic or wheres', function () { - $builder = getBuilder(); + $builder = getBuilder($this->connection); $builder->select('*') ->from('users') ->where('id', '==', 1) @@ -50,7 +50,7 @@ }); test('where operator conversion', function () { - $builder = getBuilder(); + $builder = getBuilder($this->connection); $builder->select('*') ->from('users') ->where('email', '=', 'email@example.com') @@ -68,7 +68,7 @@ }); test('where =~ operator', function () { - $builder = getBuilder(); + $builder = getBuilder($this->connection); $builder->select('*') ->from('users') ->where('email', '=~', 'email@example.com'); @@ -83,7 +83,7 @@ }); test('where json arrow conversion', function () { - $builder = getBuilder(); + $builder = getBuilder($this->connection); $builder->select('*') ->from('users') ->where('email->address', '=', 'email@example.com') @@ -101,7 +101,7 @@ }); test('where json contains', function () { - $builder = getBuilder(); + $builder = getBuilder($this->connection); $builder->select('*') ->from('users') ->whereJsonContains('options->languages', 'en'); @@ -116,7 +116,7 @@ }); test('where json length', function () { - $builder = getBuilder(); + $builder = getBuilder($this->connection); $builder->select('*') ->from('users') ->whereJsonLength('options->languages', '>', 'en'); @@ -131,7 +131,7 @@ }); test('where between', function () { - $builder = getBuilder(); + $builder = getBuilder($this->connection); $builder->select('*')->from('users')->whereBetween('votes', [1, 100]); $this->assertSame( @@ -145,7 +145,7 @@ }); test('where not between', function () { - $builder = getBuilder(); + $builder = getBuilder($this->connection); $builder->select('*')->from('users')->whereNotBetween('votes', [1, 100]); $this->assertSame( @@ -159,7 +159,7 @@ }); test('where between columns', function () { - $builder = getBuilder(); + $builder = getBuilder($this->connection); $builder->select('*')->from('users')->whereBetweenColumns('votes', ['min_vote', 'max_vote']); $this->assertSame( @@ -170,7 +170,7 @@ }); test('where column', function () { - $builder = getBuilder(); + $builder = getBuilder($this->connection); $builder->select('*')->from('users')->whereColumn('first_name', '=', 'last_name'); $this->assertSame( @@ -180,7 +180,7 @@ }); test('where column without operator', function () { - $builder = getBuilder(); + $builder = getBuilder($this->connection); $builder->select('*')->from('users')->whereColumn('first_name', 'last_name'); $this->assertSame( @@ -190,12 +190,12 @@ }); test('where nulls', function () { - $builder = getBuilder(); + $builder = getBuilder($this->connection); $builder->select('*')->from('users')->whereNull('_key'); expect($builder->toSql())->toBe('FOR userDoc IN users FILTER `userDoc`.`_key` == null RETURN userDoc'); expect($builder->getBindings())->toEqual([]); - $builder = getBuilder(); + $builder = getBuilder($this->connection); $builder->select('*') ->from('users') ->where('id', '=', 1) @@ -210,12 +210,12 @@ }); test('where not nulls', function () { - $builder = getBuilder(); + $builder = getBuilder($this->connection); $builder->select('*')->from('users')->whereNotNull('id'); expect($builder->toSql())->toBe('FOR userDoc IN users FILTER `userDoc`.`_key` != null RETURN userDoc'); expect($builder->getBindings())->toEqual([]); - $builder = getBuilder(); + $builder = getBuilder($this->connection); $builder->select('*') ->from('users') ->where('id', '>', 1) @@ -254,7 +254,7 @@ test('where integer in raw', function () { - $builder = getBuilder(); + $builder = getBuilder($this->connection); $builder->select() ->from('users') @@ -267,7 +267,7 @@ }); test('where not in', function () { - $builder = getBuilder(); + $builder = getBuilder($this->connection); $builder->select() ->from('users') @@ -282,7 +282,7 @@ }); test('where integer not in raw', function () { - $builder = getBuilder(); + $builder = getBuilder($this->connection); $builder->select() ->from('users') @@ -295,7 +295,7 @@ }); test('where date', function () { - $builder = getBuilder(); + $builder = getBuilder($this->connection); $builder->select('*')->from('users')->whereDate('created_at', '2016-12-31'); $this->assertSame( @@ -307,7 +307,7 @@ }); test('where year', function () { - $builder = getBuilder(); + $builder = getBuilder($this->connection); $builder->select('*')->from('users')->whereYear('created_at', '2016'); $this->assertSame( @@ -319,7 +319,7 @@ }); test('where month', function () { - $builder = getBuilder(); + $builder = getBuilder($this->connection); $builder->select('*')->from('users')->whereMonth('created_at', '12'); $this->assertSame( @@ -331,7 +331,7 @@ }); test('where day', function () { - $builder = getBuilder(); + $builder = getBuilder($this->connection); $builder->select('*')->from('users')->whereDay('created_at', '31'); $this->assertSame( @@ -343,7 +343,7 @@ }); test('where time', function () { - $builder = getBuilder(); + $builder = getBuilder($this->connection); $builder->select('*')->from('users')->whereTime('created_at', '11:20:45'); $this->assertSame( @@ -427,7 +427,7 @@ }); test('where nested', function () { - $builder = getBuilder(); + $builder = getBuilder($this->connection); $query = $builder->select('*') ->from('characters') @@ -575,7 +575,7 @@ test('basic whereNot', function () { - $builder = getBuilder(); + $builder = getBuilder($this->connection); $builder->select('*')->from('characters')->where('surname', 'Lannister')->whereNot('alive', true); $this->assertSame( @@ -589,7 +589,7 @@ }); test('whereNot nested', function () { - $query = getBuilder(); + $query = getBuilder($this->connection); $query = $query ->select('*') ->from('characters') @@ -624,7 +624,7 @@ }); test('basic orWhereNot', function () { - $builder = getBuilder(); + $builder = getBuilder($this->connection); $builder->select('*')->from('characters')->where('alive', true)->orWhereNot('surname', 'Lannister'); $this->assertSame( From 31170a60f538888a866e4a8daceaad1b033c3f29 Mon Sep 17 00:00:00 2001 From: Deploy Date: Wed, 12 Mar 2025 15:21:26 +0100 Subject: [PATCH 09/20] Made tests more resilient against changes in the amount of system analyzers --- tests/Console/MigrateFreshCommandTest.php | 28 +++++++++++++++-------- tests/Console/WipeCommandTest.php | 24 +++++++++++-------- tests/Schema/AnalyzerTest.php | 6 +++-- 3 files changed, 38 insertions(+), 20 deletions(-) diff --git a/tests/Console/MigrateFreshCommandTest.php b/tests/Console/MigrateFreshCommandTest.php index 25d4c2c..0e71f5a 100644 --- a/tests/Console/MigrateFreshCommandTest.php +++ b/tests/Console/MigrateFreshCommandTest.php @@ -84,6 +84,8 @@ }); test('migrate:fresh --drop-analyzers', function () { + $initialAnalyzers = $this->schemaManager->getAnalyzers(); + $path = [ realpath(__DIR__ . '/../../TestSetup/Database/Migrations'), ]; @@ -95,6 +97,9 @@ ); } + + $analyzersAfterCreation = $this->schemaManager->getAnalyzers(); + $this->artisan('migrate:fresh', [ '--path' => [ database_path('migrations'), @@ -108,8 +113,10 @@ ])->assertExitCode(0); - $analyzers = $this->schemaManager->getAnalyzers(); - expect(count($analyzers))->toBe(13); + $endAnalyzers = $this->schemaManager->getAnalyzers(); + + expect(count($analyzersAfterCreation))->toBe(1 + count($initialAnalyzers)); + expect(count($initialAnalyzers))->toBe(count($endAnalyzers)); }); test('migrate:fresh --drop-graphs', function () { @@ -151,6 +158,10 @@ }); test('migrate:fresh --drop-all', function () { + $initialViews = $this->schemaManager->getViews(); + $initialAnalyzers = $this->schemaManager->getAnalyzers(); + $initialGraphs = $this->schemaManager->getGraphs(); + $path = [ realpath(__DIR__ . '/../../TestSetup/Database/Migrations'), ]; @@ -194,15 +205,14 @@ ])->assertExitCode(0); + $endAnalyzers = $this->schemaManager->getAnalyzers(); + $endGraphs = $this->schemaManager->getGraphs(); + $endViews = $this->schemaManager->getViews(); - $analyzers = $this->schemaManager->getAnalyzers(); - expect(count($analyzers))->toBe(13); + expect(count($initialAnalyzers))->toBe(count($endAnalyzers)); + expect(count($initialGraphs))->toBe(count($endGraphs)); + expect(count($initialViews))->toBe(count($endViews)); - $graphs = $this->schemaManager->getGraphs(); - expect(count($graphs))->toBe(0); - - $views = $this->schemaManager->getViews(); - expect(count($views))->toBe(2); }); test('migrate:fresh --drop-types', function () { diff --git a/tests/Console/WipeCommandTest.php b/tests/Console/WipeCommandTest.php index f41add2..49a398d 100644 --- a/tests/Console/WipeCommandTest.php +++ b/tests/Console/WipeCommandTest.php @@ -59,6 +59,8 @@ }); test('db:wipe --drop-analyzers', function () { + $initialAnalyzers = $this->schemaManager->getAnalyzers(); + $schemaManager = $this->connection->getArangoClient()->schema(); if (!$schemaManager->hasAnalyzer('dropMyAnalyzer')) { Schema::createAnalyzer( @@ -71,8 +73,8 @@ '--drop-analyzers' => true, ])->assertExitCode(0); - $analyzers = $this->schemaManager->getAnalyzers(); - expect(count($analyzers))->toBe(13); + $endAnalyzers = $this->schemaManager->getAnalyzers(); + expect(count($initialAnalyzers))->toBe(count($endAnalyzers)); }); test('db:wipe --drop-graphs', function () { @@ -103,6 +105,10 @@ }); test('db:wipe --drop-all', function () { + $initialAnalyzers = $this->schemaManager->getAnalyzers(); + $initialViews = $this->schemaManager->getViews(); + $initialGraphs = $this->schemaManager->getGraphs(); + $schemaManager = $this->connection->getArangoClient()->schema(); if (!$schemaManager->hasAnalyzer('dropMyAnalyzer')) { Schema::createAnalyzer( @@ -135,14 +141,14 @@ '--drop-all' => true, ])->assertExitCode(0); - $analyzers = $this->schemaManager->getAnalyzers(); - expect(count($analyzers))->toBe(13); + $endAnalyzers = $this->schemaManager->getAnalyzers(); + $endGraphs = $this->schemaManager->getGraphs(); + $endViews = $this->schemaManager->getViews(); - $graphs = $this->schemaManager->getGraphs(); - expect(count($graphs))->toBe(0); - - $views = $this->schemaManager->getViews(); - expect(count($views))->toBe(0); + expect(count($initialAnalyzers))->toBe(count($endAnalyzers)); + expect(count($initialGraphs))->toBe(count($endGraphs)); + expect(count($initialViews))->toBe(2); + expect(count($endViews))->toBe(0); }); test('db:wipe --drop-types', function () { diff --git a/tests/Schema/AnalyzerTest.php b/tests/Schema/AnalyzerTest.php index b662f5b..0919365 100644 --- a/tests/Schema/AnalyzerTest.php +++ b/tests/Schema/AnalyzerTest.php @@ -21,11 +21,13 @@ test('getAnalyzers', function () { $schemaManager = $this->connection->getArangoClient()->schema(); + $initialAnalyzers = $schemaManager->getAnalyzers(); $analyzers = Schema::getAnalyzers(); - expect($analyzers)->toHaveCount(13); -}); + $endAnalyzers = $schemaManager->getAnalyzers(); + expect(count($initialAnalyzers))->toBe(count($endAnalyzers)); +})->only(); test('replaceAnalyzer', function () { $schemaManager = $this->connection->getArangoClient()->schema(); From 063de2f16bedce71efa347bb5e9ce67d16b59663 Mon Sep 17 00:00:00 2001 From: Deploy Date: Wed, 12 Mar 2025 15:28:46 +0100 Subject: [PATCH 10/20] Made tests more resilient against changes in the amount of system analyzers --- tests/Schema/AnalyzerTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Schema/AnalyzerTest.php b/tests/Schema/AnalyzerTest.php index 0919365..d96149c 100644 --- a/tests/Schema/AnalyzerTest.php +++ b/tests/Schema/AnalyzerTest.php @@ -27,7 +27,7 @@ $endAnalyzers = $schemaManager->getAnalyzers(); expect(count($initialAnalyzers))->toBe(count($endAnalyzers)); -})->only(); +}); test('replaceAnalyzer', function () { $schemaManager = $this->connection->getArangoClient()->schema(); From 9c0656ff744b0aa50af4be7ec37ac6ecf5a5ac3a Mon Sep 17 00:00:00 2001 From: Deploy Date: Wed, 12 Mar 2025 15:28:55 +0100 Subject: [PATCH 11/20] Test against ray usage --- tests/ArchTest.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/ArchTest.php b/tests/ArchTest.php index b3b8763..2d41668 100644 --- a/tests/ArchTest.php +++ b/tests/ArchTest.php @@ -1,6 +1,10 @@ expect(['dd', 'dump', 'ray']) -// ->each->not->toBeUsed(); +declare (strict_types=1); + +/* + * Besides ray we don't test for debug function use as we need to test their proper functioning in the package. + */ +it('will not use debugging functions') + ->expect(['ray']) + ->each->not->toBeUsed(); From 3e0738643c219695717326c34457611b4bb4a3c1 Mon Sep 17 00:00:00 2001 From: Deploy Date: Wed, 12 Mar 2025 15:29:07 +0100 Subject: [PATCH 12/20] Set connection the laravel 12 way --- tests/Schema/ColumnTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Schema/ColumnTest.php b/tests/Schema/ColumnTest.php index 1ae2f5f..6bcde80 100644 --- a/tests/Schema/ColumnTest.php +++ b/tests/Schema/ColumnTest.php @@ -4,7 +4,7 @@ use Mockery as M; beforeEach(function () { - $this->grammar = new Grammar(); + $this->grammar = new Grammar($this->connection); }); afterEach(function () { From b4bde5163c4917d5650ff1732e7805b39c217015 Mon Sep 17 00:00:00 2001 From: Deploy Date: Wed, 12 Mar 2025 15:29:28 +0100 Subject: [PATCH 13/20] Check for analyzer count regardless of changes in system analyzers --- tests/Schema/SchemaBuilderTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/Schema/SchemaBuilderTest.php b/tests/Schema/SchemaBuilderTest.php index 858c12b..2ba9a01 100644 --- a/tests/Schema/SchemaBuilderTest.php +++ b/tests/Schema/SchemaBuilderTest.php @@ -228,10 +228,11 @@ test('getAnalyzers', function () { $schemaManager = $this->connection->getArangoClient()->schema(); + $initialAnalyzers = $schemaManager->getAnalyzers(); $analyzers = Schema::getAnalyzers(); - expect($analyzers)->toHaveCount(13); + expect(count($initialAnalyzers))->toBe(count($analyzers)); }); test('replaceAnalyzer', function () { From 02e2858884c1cb4c371d0fc0bf242437ba876870 Mon Sep 17 00:00:00 2001 From: Deploy Date: Wed, 12 Mar 2025 15:31:02 +0100 Subject: [PATCH 14/20] Style fix --- src/Console/TableCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Console/TableCommand.php b/src/Console/TableCommand.php index f9ea755..ff620ff 100644 --- a/src/Console/TableCommand.php +++ b/src/Console/TableCommand.php @@ -72,7 +72,7 @@ public function handle(ConnectionResolverInterface $connections) return [ $this->columns($schema, $tableName), - $this->indexes($schema, $tableName) + $this->indexes($schema, $tableName), ]; }); From 706cc1e813eeb96f0065367f54c789deb7eda5dc Mon Sep 17 00:00:00 2001 From: Deploy Date: Wed, 12 Mar 2025 16:00:19 +0100 Subject: [PATCH 15/20] Ignored rules and files that don't apply --- phpstan.neon | 5 ++++- phpstan.neon.dist | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index a00e0c8..0e502c6 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -5,9 +5,12 @@ parameters: level: 8 ignoreErrors: - identifier: missingType.generics + - identifier: trait.unused universalObjectCratesClasses: - 'Illuminate\Support\Fluent' paths: - src excludePaths: - - src/Schema \ No newline at end of file + - src/Schema + - src/Facades/Schema.php + treatPhpDocTypesAsCertain: false \ No newline at end of file diff --git a/phpstan.neon.dist b/phpstan.neon.dist index a00e0c8..0e502c6 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -5,9 +5,12 @@ parameters: level: 8 ignoreErrors: - identifier: missingType.generics + - identifier: trait.unused universalObjectCratesClasses: - 'Illuminate\Support\Fluent' paths: - src excludePaths: - - src/Schema \ No newline at end of file + - src/Schema + - src/Facades/Schema.php + treatPhpDocTypesAsCertain: false \ No newline at end of file From 38931c84bf80476e2d00fc495d68801a60de78de Mon Sep 17 00:00:00 2001 From: Deploy Date: Wed, 12 Mar 2025 16:00:42 +0100 Subject: [PATCH 16/20] phpstan checks --- src/Eloquent/Concerns/QueriesAranguentRelationships.php | 3 ++- src/Query/Builder.php | 3 +-- src/Query/Concerns/BuildsGroups.php | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Eloquent/Concerns/QueriesAranguentRelationships.php b/src/Eloquent/Concerns/QueriesAranguentRelationships.php index fe6feab..43ed9b0 100644 --- a/src/Eloquent/Concerns/QueriesAranguentRelationships.php +++ b/src/Eloquent/Concerns/QueriesAranguentRelationships.php @@ -179,7 +179,8 @@ public function withAggregate($relations, $column, $function = null) // If the query contains certain elements like orderings / more than one column selected // then we will remove those elements from the query so that it will execute properly // when given to the database. Otherwise, we may receive SQL errors or poor syntax. - unset($query->orders); + $query->orders = null; + $query->setBindings([], 'order'); if (is_array($query->columns) && count($query->columns) > 1) { diff --git a/src/Query/Builder.php b/src/Query/Builder.php index 0d42f88..e47355e 100644 --- a/src/Query/Builder.php +++ b/src/Query/Builder.php @@ -115,12 +115,11 @@ class Builder extends IlluminateQueryBuilder * Create a new query builder instance. */ public function __construct( - IlluminateConnectionInterface $connection, + IlluminateConnectionInterface $connection, ?IlluminateQueryGrammar $grammar = null, ?IlluminateProcessor $processor = null, ?AQB $aqb = null, ) { - assert($connection instanceof IlluminateConnectionInterface); assert($processor instanceof IlluminateProcessor); parent::__construct($connection, $grammar, $processor); diff --git a/src/Query/Concerns/BuildsGroups.php b/src/Query/Concerns/BuildsGroups.php index 0a23b86..b49fbb5 100644 --- a/src/Query/Concerns/BuildsGroups.php +++ b/src/Query/Concerns/BuildsGroups.php @@ -56,6 +56,8 @@ public function groupByRaw($aql, array $bindings = []) public function cleanGroupVariables(): void { + // FIXME: check for possible expressions instead of strings. + /* @phpstan-ignore-next-line */ $this->tableAliases = array_diff($this->tableAliases, $this->groupVariables ?? []); $this->groupVariables = null; } From 2f9b5495e8bb6657708d9fb0c457220d1ad58a6e Mon Sep 17 00:00:00 2001 From: Deploy Date: Wed, 12 Mar 2025 16:22:29 +0100 Subject: [PATCH 17/20] ci: removed Laravel 11 from workflows --- .github/workflows/coverage.yml | 6 +++--- .github/workflows/run-tests.yml | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 83d2599..da8b5e4 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -10,10 +10,10 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - laravel: ['^11.0'] + laravel: ['^12.0'] include: - - laravel: '^11.0' - testbench: '^9.0' + - laravel: '^12.0' + testbench: '^10.0' name: Test coverage (Scrutinizer) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 6551490..a17c471 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -17,10 +17,8 @@ jobs: matrix: arangodb: ['3.11', '3.12'] php: ['8.2', '8.3', '8.4'] - laravel: ['^11.0', '^12.0'] + laravel: ['^12.0'] include: - - laravel: '^11.0' - testbench: '^9.0' - laravel: '^12.0' testbench: '^10.0' From 665b9e286dc7abbb9bd61b3202b8fd32bb23785a Mon Sep 17 00:00:00 2001 From: Deploy Date: Wed, 12 Mar 2025 16:29:48 +0100 Subject: [PATCH 18/20] qa: Updated phpdocs --- src/Query/Concerns/BuildsWheres.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Query/Concerns/BuildsWheres.php b/src/Query/Concerns/BuildsWheres.php index e1781ee..7b05155 100644 --- a/src/Query/Concerns/BuildsWheres.php +++ b/src/Query/Concerns/BuildsWheres.php @@ -6,6 +6,7 @@ use Carbon\CarbonPeriod; use Closure; +use DateTimeInterface; use Illuminate\Contracts\Database\Query\ConditionExpression; use Illuminate\Contracts\Support\Arrayable; use Illuminate\Database\Eloquent\Builder as IlluminateEloquentBuilder; @@ -40,7 +41,7 @@ public function whereFullText($columns, $value, array $options = [], $boolean = /** * Prepare the value and operator for a where clause. * - * @param float|int|string|null $value + * @param DateTimeInterface|float|int|string|null $value * @param string|null $operator * @param bool $useDefault * @return array From 2c03e8aef4b4fde8a3ee8c9086ecb25657f57417 Mon Sep 17 00:00:00 2001 From: Deploy Date: Wed, 12 Mar 2025 16:30:11 +0100 Subject: [PATCH 19/20] feat!: dropped laravel 11 due to incompatibilities. --- composer.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index e15490b..24586d6 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "composer/composer": "^2.8.0", "laravel-freelancer-nl/arangodb-php-client": "^2.8.0", "laravel-freelancer-nl/fluentaql": "^2.0", - "laravel/framework": "^11.0 || ^12.0", + "laravel/framework": "^12.0", "spatie/laravel-data": "^4.4.0", "stevebauman/unfinalize": "^2.1", "vlucas/phpdotenv": "^5.4" @@ -36,10 +36,10 @@ "laravel/pint": "^1.10", "mockery/mockery": "^1.5.0", "nunomaduro/collision": "^8.0", - "larastan/larastan": "^2.0 || ^3.1", - "orchestra/testbench": "^9.0 || ^10.0", + "larastan/larastan": "^3.1", + "orchestra/testbench": "^10.0", "pestphp/pest": "^3.7.4", - "pestphp/pest-plugin-faker": "^2.0 || ^3.0", + "pestphp/pest-plugin-faker": "^3.0", "pestphp/pest-plugin-laravel": "^3.1", "phpmd/phpmd": "2.13", "spatie/laravel-ray": "^1.32", From 8fb99a42df3f0a830cbacb35a52b0479b3a2aaf8 Mon Sep 17 00:00:00 2001 From: Deploy Date: Wed, 12 Mar 2025 16:32:38 +0100 Subject: [PATCH 20/20] docs: updated supported versions --- readme.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/readme.md b/readme.md index 8af3f21..2e9ba45 100644 --- a/readme.md +++ b/readme.md @@ -34,10 +34,11 @@ You may then use composer to install Aranguent: ### Version compatibility -| Laravel | ArangoDB | PHP | Aranguent | -|:--------------|:---------|:-----|:----------| -| ^8.0 and ^9.0 | ^3.7 | ^8.0 | ^0.13 | -| ^11.0 | ^3.11 | ^8.2 | ^1.0.0 | +| Laravel | ArangoDB | PHP | Aranguent | +|:--------------|:---------|:-----|:-------------------------| +| ^8.0 and ^9.0 | ^3.7 | ^8.0 | ^0.13 | +| ^11.0 | ^3.11 | ^8.2 | ^1.0.0 - 1.0.0-beta.11 | +| ^12.0 | ^3.11 | ^8.2 | ^v1.0.0-beta.12 | ## Documentation 1) [Connect to ArangoDB](docs/connect-to-arangodb.md): set up a connection