Skip to content

Commit

Permalink
Use scalar for key type
Browse files Browse the repository at this point in the history
  • Loading branch information
olvlvl committed Nov 17, 2024
1 parent 662ffc3 commit d7ba4dc
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/ActiveRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* @see self::get_primary_key_value()
* @property-read TKey $primary_key_value The value of the primary key.
*
* @template TKey of int|non-empty-string|non-empty-array<non-empty-string>
* @template TKey of scalar|non-empty-array<scalar>
*/
abstract class ActiveRecord extends Prototyped
{
Expand Down
2 changes: 1 addition & 1 deletion lib/ActiveRecord/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/**
* Base class for activerecord models.
*
* @template TKey of int|non-empty-string|non-empty-string[]
* @template TKey of scalar|non-empty-array<scalar>
* @template TValue of ActiveRecord
*
* @property-read Model|null $parent Parent model.
Expand Down
2 changes: 1 addition & 1 deletion lib/ActiveRecord/ModelProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface ModelProvider
*
* @param class-string<T> $activerecord_class
*
* @phpstan-return Model<int|non-empty-string|non-empty-string[], T>
* @phpstan-return Model<scalar|non-empty-array<scalar>, T>
*/
public function model_for_record(string $activerecord_class): Model;
}
2 changes: 1 addition & 1 deletion lib/ActiveRecord/Relation.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ protected function resolve_related_model(): Model
*
* @param class-string<T> $activerecord_class
*
* @return Model<int|non-empty-string|non-empty-string[], T>
* @return Model<scalar|non-empty-array<scalar>, T>
*/
protected function model_for_activerecord(string $activerecord_class): Model
{
Expand Down
10 changes: 5 additions & 5 deletions lib/ActiveRecord/StaticModelProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
final class StaticModelProvider
{
/**
* @var (Closure(): ModelProvider)|null
* @var (Closure():ModelProvider)|null
*/
private static ?Closure $factory = null;

Expand All @@ -21,10 +21,10 @@ final class StaticModelProvider
/**
* Sets the {@see ModelProvider} factory.
*
* @param (callable(): ModelProvider) $factory
* @param (callable():ModelProvider) $factory
* The factory is invoked once: the first time {@see model_for_record} is invoked.
*
* @return (callable(): ModelProvider)|null
* @return (callable():ModelProvider)|null
* The previous factory, or `null` if none was defined.
*/
public static function set(callable $factory): ?callable
Expand All @@ -40,7 +40,7 @@ public static function set(callable $factory): ?callable
/**
* Returns the current {@see ModelProvider} factory.
*
* @return (callable(): ModelProvider)|null
* @return (callable():ModelProvider)|null
*/
public static function get(): ?callable
{
Expand All @@ -63,7 +63,7 @@ public static function reset(): void
*
* @param class-string<T> $activerecord_class
*
* @phpstan-return Model<int|non-empty-string|non-empty-string[], T>
* @phpstan-return Model<scalar|non-empty-array<scalar>, T>
**/
public static function model_for_record(string $activerecord_class): Model
{
Expand Down

0 comments on commit d7ba4dc

Please sign in to comment.