Skip to content

Commit

Permalink
Narrow array phpdocs (#1234)
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek authored Oct 26, 2024
1 parent 7f86f4d commit 9998be7
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -1520,7 +1520,7 @@ protected function validateEntityScope(): void
}
}

private function assertIsWriteable(): void
private function assertIsWritable(): void
{
if ($this->readOnly) {
throw new Exception('Model is read-only');
Expand All @@ -1536,7 +1536,7 @@ private function assertIsWriteable(): void
*/
public function save(array $data = [])
{
$this->getModel()->assertIsWriteable();
$this->getModel()->assertIsWritable();
$this->getModel()->assertHasPersistence();

$this->setMulti($data);
Expand Down Expand Up @@ -1891,7 +1891,7 @@ public function delete($id = null)
return $this;
}

$this->getModel()->assertIsWriteable();
$this->getModel()->assertIsWritable();
$this->getModel()->assertHasPersistence();
$this->assertIsLoaded();

Expand Down
4 changes: 2 additions & 2 deletions src/Model/Scope.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Atk4\Data\Persistence\Sql\Expressionable;

/**
* @property array<AbstractScope> $elements
* @property array<int|string, AbstractScope> $elements
*/
class Scope extends AbstractScope
{
Expand Down Expand Up @@ -91,7 +91,7 @@ public function addCondition($field, $operator = null, $value = null)
/**
* Return array of nested conditions.
*
* @return array<AbstractScope>
* @return array<int|string, AbstractScope>
*/
public function getNestedConditions(): array
{
Expand Down
8 changes: 4 additions & 4 deletions src/Persistence.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public function insert(Model $model, array $data)
}

/**
* @param array<scalar|null> $dataRaw
* @param array<string, scalar|null> $dataRaw
*
* @return scalar
*/
Expand Down Expand Up @@ -246,8 +246,8 @@ public function update(Model $model, $id, array $data): void
}

/**
* @param scalar $idRaw
* @param array<scalar|null> $dataRaw
* @param scalar $idRaw
* @param array<string, scalar|null> $dataRaw
*/
protected function updateRaw(Model $model, $idRaw, array $dataRaw): void
{
Expand Down Expand Up @@ -299,7 +299,7 @@ protected function deleteRaw(Model $model, $idRaw): void
*
* @param array<string, mixed> $row
*
* @return array<scalar|Persistence\Sql\Expressionable|null>
* @return array<string, scalar|Persistence\Sql\Expressionable|null>
*/
public function typecastSaveRow(Model $model, array $row): array
{
Expand Down
4 changes: 2 additions & 2 deletions src/Persistence/Sql.php
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ private function assertExactlyOneRecordUpdated(Model $model, $idRaw, int $affect
}

/**
* @param array<scalar|Expressionable|null> $dataRaw
* @param array<string, scalar|Expressionable|null> $dataRaw
*/
#[\Override]
protected function insertRaw(Model $model, array $dataRaw)
Expand Down Expand Up @@ -596,7 +596,7 @@ protected function insertRaw(Model $model, array $dataRaw)
}

/**
* @param array<scalar|Expressionable|null> $dataRaw
* @param array<string, scalar|Expressionable|null> $dataRaw
*/
#[\Override]
protected function updateRaw(Model $model, $idRaw, array $dataRaw): void
Expand Down
2 changes: 1 addition & 1 deletion src/Persistence/Sql/Expression.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ abstract class Expression implements Expressionable, \ArrayAccess
* This property is made public to ease customization and make it accessible
* from Connection class for example.
*
* @var array<array<mixed>>
* @var array<string, array<int|string, mixed>>
*/
public array $args = ['custom' => []];

Expand Down
2 changes: 1 addition & 1 deletion src/Persistence/Sql/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ abstract class Query extends Expression

public bool $wrapInParentheses = true;

/** @var array<string> */
/** @var list<string> */
protected array $supportedOperators = ['=', '!=', '<', '>', '<=', '>=', 'in', 'not in', 'like', 'not like', 'regexp', 'not regexp'];

protected string $templateSelect = '[with]select[option] [field] [from] [table][join][where][group][having][order][limit]';
Expand Down

0 comments on commit 9998be7

Please sign in to comment.