Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
matrix:
arangodb: ['3.11', '3.12']
php: ['8.2', '8.3', '8.4']
laravel: ['^11.0']
laravel: ['^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 }}
Expand Down
13 changes: 6 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "^12.0",
"spatie/laravel-data": "^4.4.0",
"stevebauman/unfinalize": "^2.1",
"vlucas/phpdotenv": "^5.4"
Expand All @@ -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",
"pestphp/pest": "^2.6.1",
"pestphp/pest-plugin-faker": "^2.0",
"pestphp/pest-plugin-laravel": "^2.0",
"larastan/larastan": "^3.1",
"orchestra/testbench": "^10.0",
"pestphp/pest": "^3.7.4",
"pestphp/pest-plugin-faker": "^3.0",
"pestphp/pest-plugin-laravel": "^3.1",
"phpmd/phpmd": "2.13",
"phpstan/phpstan": "^1.0",
"spatie/laravel-ray": "^1.32",
"timacdonald/log-fake": "^2.2.0"
},
Expand Down
5 changes: 4 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ parameters:
level: 8
ignoreErrors:
- identifier: missingType.generics
- identifier: trait.unused
universalObjectCratesClasses:
- 'Illuminate\Support\Fluent'
paths:
- src
excludePaths:
- src/Schema
- src/Schema
- src/Facades/Schema.php
treatPhpDocTypesAsCertain: false
5 changes: 4 additions & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ parameters:
level: 8
ignoreErrors:
- identifier: missingType.generics
- identifier: trait.unused
universalObjectCratesClasses:
- 'Illuminate\Support\Fluent'
paths:
- src
excludePaths:
- src/Schema
- src/Schema
- src/Facades/Schema.php
treatPhpDocTypesAsCertain: false
9 changes: 5 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/AranguentServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
},
Expand Down
6 changes: 3 additions & 3 deletions src/Concerns/RunsQueries.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected function isUniqueConstraintError(Exception $exception)
* @param array<mixed> $bindings
* @param bool $useReadPdo
* @return \Generator
* @SuppressWarnings(PHPMD.BooleanArgumentFlag)
* @SuppressWarnings("PHPMD.BooleanArgumentFlag")
*/
public function cursor($query, $bindings = [], $useReadPdo = true)
{
Expand Down Expand Up @@ -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<mixed> $bindings
Expand All @@ -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<mixed> $bindings
Expand Down
6 changes: 3 additions & 3 deletions src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ protected function getDefaultPostProcessor(): Processor
*/
protected function getDefaultQueryGrammar()
{
($grammar = new QueryGrammar())->setConnection($this);
$grammar = new QueryGrammar($this);

return $grammar;
}
Expand Down Expand Up @@ -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)
{
Expand All @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Console/DbCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class DbCommand extends IlluminateDbCommand
*
* @return int
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function handle()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Console/Migrations/MigrateMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function handle()
*
* @throws Exception
*
* @SuppressWarnings(PHPMD.BooleanArgumentFlag)
* @SuppressWarnings("PHPMD.BooleanArgumentFlag")
*/
protected function writeMigration($name, $table, $create, $edge = false)
{
Expand Down
13 changes: 10 additions & 3 deletions src/Console/TableCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/Eloquent/Casts/AsArrayObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class AsArrayObject extends IlluminateAsArrayObject
* @param array<array-key, mixed> $arguments
* @return \Illuminate\Contracts\Database\Eloquent\CastsAttributes<\Illuminate\Database\Eloquent\Casts\ArrayObject<array-key, mixed>, iterable<array-key, mixed>>
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public static function castUsing(array $arguments)
{
Expand All @@ -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)
{
Expand Down
8 changes: 4 additions & 4 deletions src/Eloquent/Casts/AsCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down
16 changes: 8 additions & 8 deletions src/Eloquent/Casts/AsEnumArrayObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -23,7 +23,7 @@ class AsEnumArrayObject extends IlluminateAsEnumArrayObjectAlias
* @param array{class-string<TEnum>} $arguments
* @return \Illuminate\Contracts\Database\Eloquent\CastsAttributes<\Illuminate\Database\Eloquent\Casts\ArrayObject<array-key, TEnum>, iterable<TEnum>>
*
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings("PHPMD.ExcessiveMethodLength")
*/
public static function castUsing(array $arguments)
{
Expand All @@ -36,7 +36,7 @@ public static function castUsing(array $arguments)
/**
* @param array<class-string<TEnum>> $arguments
*
* @SuppressWarnings(PHPMD.UndefinedVariable)
* @SuppressWarnings("PHPMD.UndefinedVariable")
*/
public function __construct(array $arguments)
{
Expand All @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Eloquent/Casts/AsEnumCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
4 changes: 2 additions & 2 deletions src/Eloquent/Concerns/HasAranguentRelationships.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Eloquent/Concerns/HasAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
5 changes: 3 additions & 2 deletions src/Eloquent/Concerns/QueriesAranguentRelationships.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions src/Migrations/MigrationCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function stubPath()
*
* @throws FileNotFoundException
*
* @SuppressWarnings(PHPMD.BooleanArgumentFlag)
* @SuppressWarnings("PHPMD.BooleanArgumentFlag")
*/
protected function getStub($table, $create, $edge = false)
{
Expand Down Expand Up @@ -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()) {
Expand Down
2 changes: 1 addition & 1 deletion src/Providers/CommandServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function register()
* @param string[] $commands
* @return void
*
* @SuppressWarnings(PHPMD.ElseExpression)
* @SuppressWarnings("PHPMD.ElseExpression")
*/
protected function registerCommands(array $commands)
{
Expand Down
Loading