Skip to content

Fix return types #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 7, 2022
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
4 changes: 2 additions & 2 deletions src/Kitar/Dynamodb/Model/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public static function find($key)
}

if (is_string($key) || is_numeric($key)) {
$model = new static;
$model = new static();
$model->setAttribute($model->getKeyName(), $key);
$key = $model->getKey();
}
Expand All @@ -122,7 +122,7 @@ public static function find($key)
* Get all of the models from the database.
*
* @param array $columns
* @return Illuminate\Database\Eloquent\Collection
* @return \Illuminate\Database\Eloquent\Collection
*/
public static function all($columns = [])
{
Expand Down
27 changes: 13 additions & 14 deletions src/Kitar/Dynamodb/Query/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

class Builder extends BaseBuilder
{

/**
* Name of the index.
* @var string|null
Expand Down Expand Up @@ -91,29 +90,29 @@ class Builder extends BaseBuilder

/**
* Dedicated query for building FilterExpression.
* @var Kitar\Dynamodb\Query\Builder
* @var \Kitar\Dynamodb\Query\Builder
*/
protected $filter_query;

/**
* Dedicated query for building ConditionExpression.
* @var Kitar\Dynamodb\Query\Builder
* @var \Kitar\Dynamodb\Query\Builder
*/
protected $condition_query;

/**
* Dedicated query for building KeyConditionExpression.
* @var Kitar\Dynamodb\Query\Builder
* @var \Kitar\Dynamodb\Query\Builder
*/
protected $key_condition_query;

/**
* Create a new query builder instance.
*
* @param Kitar\Dynamodb\Connection $connection
* @param Kitar\Dynamodb\Query\Grammar $grammar
* @param Kitar\Dynamodb\Query\Processor $processor
* @param Kitar\Dynamodb\Query\ExpressionAttributes|null $expression_attributes
* @param \Kitar\Dynamodb\Connection $connection
* @param \Kitar\Dynamodb\Query\Grammar $grammar
* @param \Kitar\Dynamodb\Query\Processor $processor
* @param \Kitar\Dynamodb\Query\ExpressionAttributes|null $expression_attributes
* @param bool $is_nested_query
* @return void
*/
Expand All @@ -125,7 +124,7 @@ public function __construct(Connection $connection, Grammar $grammar, Processor

$this->processor = $processor;

$this->expression_attributes = $expression_attributes ?? new ExpressionAttributes;
$this->expression_attributes = $expression_attributes ?? new ExpressionAttributes();

if (! $is_nested_query) {
$this->initializeDedicatedQueries();
Expand Down Expand Up @@ -336,7 +335,7 @@ public function decrement($column, $amount = 1, array $extra = [])
* @param $symbol
* @param int $amount
* @param array $extra
* @return array|\Aws\Result|Aws\Result|Illuminate\Support\Collection
* @return array|\Aws\Result|Aws\Result|\Illuminate\Support\Collection
*/
protected function incrementOrDecrement($column, $symbol, $amount = 1, array $extra = [])
{
Expand All @@ -350,7 +349,7 @@ protected function incrementOrDecrement($column, $symbol, $amount = 1, array $ex
/**
* Query.
*
* @return Illuminate\Support\Collection|array
* @return \Illuminate\Support\Collection|array
*/
public function query()
{
Expand All @@ -361,7 +360,7 @@ public function query()
* Scan.
*
* @param array $columns
* @return Illuminate\Support\Collection|array
* @return \Illuminate\Support\Collection|array
*/
public function scan($columns = [])
{
Expand Down Expand Up @@ -518,12 +517,12 @@ public function newQuery()
* @param string $query_method
* @param array $params
* @param string $processor_method
* @return array|Illuminate\Support\Collection|Aws\Result
* @return array|\Illuminate\Support\Collection|\Aws\Result
*/
protected function process($query_method, $processor_method)
{
// Compile columns and wheres attributes.
// These attributes needs to intaract with ExpressionAttributes during compile,
// These attributes needs to interact with ExpressionAttributes during compile,
// so it need to run before compileExpressionAttributes.
$params = array_merge(
$this->grammar->compileProjectionExpression($this->columns, $this->expression_attributes),
Expand Down