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
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2018-2025 Aternos GmbH
Copyright (c) 2018-2026 Aternos GmbH

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
5 changes: 3 additions & 2 deletions src/BaseModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,11 @@ public function setId(mixed $id): static
}

/**
* Generate an unique identifier for the model
* Generate a unique identifier for the model
*/
protected function generateId()
protected function generateId(): void
{
/** @noinspection SpellCheckingInspection */
$characters = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
$charactersLength = strlen($characters);
do {
Expand Down
10 changes: 7 additions & 3 deletions src/Driver/DriverRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Aternos\Model\Driver;

use Aternos\Model\Driver\OpenSearch\OpenSearch;
use Aternos\Model\Driver\Mysqli\Mysqli;
use Aternos\Model\Driver\OpenSearch\OpenSearch;
use Aternos\Model\Driver\Redis\Redis;
use Aternos\Model\Driver\Test\TestDriver;
use InvalidArgumentException;
Expand Down Expand Up @@ -34,10 +34,12 @@ class DriverRegistry implements DriverRegistryInterface
* Register a driver object by ID
*
* @param DriverInterface $driver
* @return $this
*/
public function registerDriver(DriverInterface $driver)
public function registerDriver(DriverInterface $driver): static
{
$this->drivers[$driver->getId()] = $driver;
return $this;
}

/**
Expand All @@ -47,10 +49,12 @@ public function registerDriver(DriverInterface $driver)
*
* @param string $id
* @param string $class
* @return $this
*/
public function registerDriverClass(string $id, string $class)
public function registerDriverClass(string $id, string $class): static
{
$this->classes[$id] = $class;
return $this;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Driver/Mysqli/MysqlConnectionFailedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ class MysqlConnectionFailedException extends MysqlException
{
public function __construct(Throwable $previous)
{
parent::__construct("Could not connect to Mysqli database", $previous?->getCode(), $previous);
parent::__construct("Could not connect to Mysqli database", $previous->getCode(), $previous);
}
}
3 changes: 2 additions & 1 deletion src/Driver/Test/TestTableEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

namespace Aternos\Model\Driver\Test;

use ArrayAccess;
use Aternos\Model\ModelInterface;
use Aternos\Model\Query\SelectField;
use Aternos\Model\Query\UpdateField;
use Aternos\Model\Query\WhereCondition;
use Aternos\Model\Query\WhereGroup;

class TestTableEntry implements \ArrayAccess
class TestTableEntry implements ArrayAccess
{
public function __construct(protected array $data)
{
Expand Down
2 changes: 1 addition & 1 deletion src/GenericModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Aternos\Model\Driver\DriverInterface;
use Aternos\Model\Driver\DriverRegistry;
use Aternos\Model\Driver\DriverRegistryInterface;
use Aternos\Model\Driver\Test\TestDriver;
use Aternos\Model\Driver\Features\CacheableInterface;
use Aternos\Model\Driver\Features\DeletableInterface;
use Aternos\Model\Driver\Features\DeleteQueryableInterface;
Expand All @@ -18,6 +17,7 @@
use Aternos\Model\Driver\Features\UpdateQueryableInterface;
use Aternos\Model\Driver\Mysqli\Mysqli;
use Aternos\Model\Driver\Redis\Redis;
use Aternos\Model\Driver\Test\TestDriver;
use Aternos\Model\Query\CountField;
use Aternos\Model\Query\DeleteQuery;
use Aternos\Model\Query\GroupField;
Expand Down
5 changes: 3 additions & 2 deletions src/ModelCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ public function __construct(array $models = [])
* Add a model
*
* @param TModel $model
* @noinspection PhpDocSignatureInspection
* @return static
*/
public function add(ModelInterface $model)
public function add(ModelInterface $model): static
{
$this->models[] = $model;
return $this;
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/Query/Generator/SQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class SQL implements QueryGeneratorInterface
* Callback function to escape values
*
* @var callable|string
* @noinspection SpellCheckingInspection
*/
public $escapeFunction = "addslashes";

Expand Down
1 change: 0 additions & 1 deletion src/Query/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Aternos\Model\ModelInterface;
use InvalidArgumentException;
use UnexpectedValueException;

/**
* Class Query
Expand Down
4 changes: 3 additions & 1 deletion src/Query/WhereGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,12 @@ public function __construct(array $conditions = [], int $conjunction = self:: AN
* Add an element to the group
*
* @param WhereCondition|WhereGroup $conditionOrGroup
* @return $this
*/
public function add(WhereCondition|WhereGroup $conditionOrGroup)
public function add(WhereCondition|WhereGroup $conditionOrGroup): static
{
$this->group[] = $conditionOrGroup;
return $this;
}

/**
Expand Down
Loading