feat: STUBS!

This commit is contained in:
Matthew Kilgore 2021-12-01 17:36:36 -05:00
parent c561897f1c
commit 05aa62f70c
35 changed files with 19100 additions and 3 deletions

View File

@ -1,13 +1,38 @@
inclues:
includes:
- vendor/phpstan/phpstan-php-parser/extension.neon
parameters:
stubFiles:
- stubs/Illuminate/Enumerable.stub
- stubs/Illuminate/Database/EloquentBuilder.stub
- stubs/Illuminate/Collection.stub
- stubs/Illuminate/Database/EloquentCollection.stub
- stubs/Illuminate/Database/Factory.stub
- stubs/Illuminate/Database/Model.stub
- stubs/Illuminate/Database/Gate.stub
- stubs/Illuminate/Database/Relation.stub
- stubs/Illuminate/Database/BelongsTo.stub
- stubs/Illuminate/Database/BelongsToMany.stub
- stubs/Illuminate/Database/HasOneOrMany.stub
- stubs/Illuminate/Database/HasMany.stub
- stubs/Illuminate/Database/HasOne.stub
- stubs/Illuminate/Database/HasOneThrough.stub
- stubs/Illuminate/Database/HasManyThrough.stub
- stubs/Illuminate/Database/MorphTo.stub
- stubs/Illuminate/Database/MorphToMany.stub
- stubs/Illuminate/Database/MorphMany.stub
- stubs/Illuminate/Database/MorphOne.stub
- stubs/Illuminate/Database/MorphOneOrMany.stub
- stubs/Illuminate/HigherOrderProxies.stub
- stubs/Illuminate/Database/QueryBuilder.stub
- stubs/Illuminate/EnumeratesValues.stub
- stubs/Contracts/Support.stub
universalObjectCratesClasses:
- Illuminate\Http\Request
mixinExcludeClasses:
- Eloquent
earlyTerminatingFunctionCalls:
- abort
- dd
excludePaths:
- *.blade.php
mixinExcludeClasses:
- Eloquent
checkGenericClassInNonGenericObjectType: false

View File

@ -0,0 +1,16 @@
<?php
namespace Illuminate\Contracts\Container;
/** @extends \ArrayAccess<string, mixed> */
interface Container extends \ArrayAccess
{
}
namespace Illuminate\Contracts\Foundation;
interface Application extends \Illuminate\Contracts\Container\Container
{
}

View File

@ -0,0 +1,17 @@
<?php
namespace Illuminate\Contracts\Pagination;
/**
* @mixin \Illuminate\Support\Collection
* @mixin \Illuminate\Pagination\Paginator
*/
interface Paginator
{}
/**
* @mixin \Illuminate\Support\Collection
* @mixin \Illuminate\Pagination\LengthAwarePaginator
*/
interface LengthAwarePaginator extends Paginator
{}

View File

@ -0,0 +1,19 @@
<?php
namespace Illuminate\Contracts\Support;
interface Htmlable
{}
interface Arrayable
{
/**
* Get the instance as an array.
*
* @return array<mixed>
*/
public function toArray();
}
interface Jsonable
{}

View File

@ -0,0 +1,31 @@
<?php
namespace Flarum\User {
trait AccountActivationMailerTrait
{
/**
* @param User $user
* @param string $email
* @return EmailToken
*/
protected function generateToken(\Flarum\User\User $user, $email)
{
}
/**
* Get the data that should be made available to email templates.
*
* @param User $user
* @param EmailToken $token
* @return array
*/
protected function getEmailData(\Flarum\User\User $user, \Flarum\User\EmailToken $token)
{
}
/**
* @param User $user
* @param array $data
*/
protected function sendConfirmationEmail(\Flarum\User\User $user, $data)
{
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,148 @@
<?php
namespace Illuminate\Support;
/**
* @template TKey
* @template TValue
* @implements \ArrayAccess<TKey, TValue>
* @implements Enumerable<TKey, TValue>
*/
class Collection implements \ArrayAccess, Enumerable
{
/**
* @param callable|null $callback
* @param mixed $default
* @return TValue|null
*/
public function first(callable $callback = null, $default = null){}
/**
* @param callable|null $callback
* @param mixed $default
* @return TValue|null
*/
public function last(callable $callback = null, $default = null){}
/**
* @param mixed $key
* @param mixed $default
* @return TValue|null
*/
public function get($key, $default = null) {}
/**
* @return TValue|null
*/
public function pop() {}
/**
* @param mixed $key
* @param mixed $default
* @return TValue|null
*/
public function pull($key, $default = null) {}
/**
* @param mixed $value
* @param bool $strict
* @return TKey|false
*/
public function search($value, $strict = false) {}
/**
* @return TValue|null
*/
public function shift() {}
/**
* @param callable(TValue, TKey): (void|bool) $callable
* @return static<TValue>
*/
public function each($callable) {}
/**
* @template TReturn
* @param callable(TValue, TKey): TReturn $callable
* @return static<TKey, TReturn>
*/
public function map($callable) {}
/**
* Run a grouping map over the items.
*
* The callback should return an associative array with a single key/value pair.
*
* @template TMapToGroupsKey of array-key
* @template TMapToGroupsValue
*
* @param callable(TValue, TKey): array<TMapToGroupsKey, TMapToGroupsValue> $callback
* @return static<TMapToGroupsKey, static<int, TMapToGroupsValue>>
*/
public function mapToGroups(callable $callback) {}
/**
* @param array<mixed>|string|callable(TValue, TKey): mixed $groupBy
* @param bool $preserveKeys
* @return static<array-key, static<TKey, TValue>>
*/
public function groupBy($groupBy, $preserveKeys = false);
/**
* @template TClass
* @param class-string<TClass> $class
* @return static<int, TClass>
*/
public function mapInto($class);
/**
* @template TReturn
* @param callable(TValue, TKey): (array<TReturn>|\Illuminate\Support\Enumerable<array-key, TReturn>) $callback
* @return static<TKey, TReturn>
*/
public function flatMap(callable $callback) {}
/**
* @template TReturn
* @param callable(TValue ...$values): TReturn $callback
* @return static<int, TReturn>
*/
public function mapSpread(callable $callback) {}
/**
* @param int $number
* @param null|callable(int, int): mixed $callback
* @return static<mixed>
*/
public static function times($number, callable $callback = null) {}
/**
* @param string|array<mixed> $value
* @param string|null $key
* @return static<int, mixed>
*/
public function pluck($value, $key = null) {}
/**
* @return TValue
*/
public function pop() {}
/**
* Push one or more items onto the end of the collection.
*
* @param TValue ...$values
* @return static
*/
public function push(...$values) {}
/**
* Put an item in the collection by key.
*
* @param TKey $key
* @param TValue $value
* @return static
*/
public function put($key, $value) {}
}

View File

@ -0,0 +1,27 @@
<?php
namespace Illuminate\Database\Eloquent\Relations;
/**
* @template TRelatedModel of \Illuminate\Database\Eloquent\Model
* @template TChildModel of \Illuminate\Database\Eloquent\Model
* @extends Relation<TRelatedModel>
*/
class BelongsTo extends Relation
{
/** @phpstan-return TChildModel */
public function associate();
/** @phpstan-return TChildModel */
public function dissociate();
/** @phpstan-return TChildModel */
public function getChild();
/**
* Get the results of the relationship.
*
* @phpstan-return ?TRelatedModel
*/
public function getResults();
}

View File

@ -0,0 +1,112 @@
<?php
namespace Illuminate\Database\Eloquent\Relations;
/**
* @template TRelatedModel of \Illuminate\Database\Eloquent\Model
* @extends Relation<TRelatedModel>
*/
class BelongsToMany extends Relation
{
/**
* Find a related model by its primary key or return new instance of the related model.
*
* @param mixed $id
* @param array<int, mixed> $columns
* @return \Illuminate\Support\Collection<int, TRelatedModel>|TRelatedModel
*/
public function findOrNew($id, $columns = ['*']);
/**
* Get the first related model record matching the attributes or instantiate it.
*
* @param array<string, mixed> $attributes
* @return TRelatedModel
*/
public function firstOrNew(array $attributes);
/**
* Get the first related record matching the attributes or create it.
*
* @param array<string, mixed> $attributes
* @param array<mixed> $joining
* @param bool $touch
* @return TRelatedModel
*/
public function firstOrCreate(array $attributes, array $joining = [], $touch = true);
/**
* Create or update a related record matching the attributes, and fill it with values.
*
* @param array<string, mixed> $attributes
* @param array<mixed> $values
* @param array<mixed> $joining
* @param bool $touch
* @return TRelatedModel
*/
public function updateOrCreate(array $attributes, array $values = [], array $joining = [], $touch = true);
/**
* Find a related model by its primary key.
*
* @param mixed $id
* @param array<int, mixed> $columns
* @return TRelatedModel|\Illuminate\Database\Eloquent\Collection<TRelatedModel>|null
*/
public function find($id, $columns = ['*']);
/**
* Find multiple related models by their primary keys.
*
* @param \Illuminate\Contracts\Support\Arrayable|int[] $ids
* @param array<int, mixed> $columns
* @return \Illuminate\Database\Eloquent\Collection<TRelatedModel>
*/
public function findMany($ids, $columns = ['*']);
/**
* Find a related model by its primary key or throw an exception.
*
* @param mixed $id
* @param array<int, mixed> $columns
* @return TRelatedModel|\Illuminate\Database\Eloquent\Collection<TRelatedModel>
*
* @throws \Illuminate\Database\Eloquent\ModelNotFoundException
*/
public function findOrFail($id, $columns = ['*']);
/**
* Execute the query and get the first result.
*
* @param array<int, mixed> $columns
* @return TRelatedModel|null
*/
public function first($columns = ['*']);
/**
* Execute the query and get the first result or throw an exception.
*
* @param array<int, mixed> $columns
* @return TRelatedModel
*
* @throws \Illuminate\Database\Eloquent\ModelNotFoundException
*/
public function firstOrFail($columns = ['*']);
/**
* Create a new instance of the related model.
*
* @param array<model-property<TRelatedModel>, mixed> $attributes
* @param mixed[] $joining
* @param bool $touch
* @return TRelatedModel
*/
public function create(array $attributes = [], array $joining = [], $touch = true);
/**
* Get the results of the relationship.
*
* @phpstan-return \Illuminate\Database\Eloquent\Collection<TRelatedModel>
*/
public function getResults();
}

View File

@ -0,0 +1,454 @@
<?php
namespace Illuminate\Database\Eloquent;
/**
* @template TModelClass of Model
* @property-read static<TModelClass> $orWhere
*/
class Builder
{
/**
* Create and return an un-saved model instance.
*
* @phpstan-param array<model-property<TModelClass>, mixed> $attributes
* @phpstan-return TModelClass
*/
public function make(array $attributes = []);
/**
* Register a new global scope.
*
* @param string $identifier
* @param \Illuminate\Database\Eloquent\Scope|\Closure $scope
* @return static<TModelClass>
*/
public function withGlobalScope($identifier, $scope);
/**
* Remove a registered global scope.
*
* @param \Illuminate\Database\Eloquent\Scope|string $scope
* @return static<TModelClass>
*/
public function withoutGlobalScope($scope);
/** @phpstan-return TModelClass */
public function getModel();
/**
* @phpstan-param array<model-property<TModelClass>, mixed> $attributes
* @phpstan-return TModelClass
*/
public function create(array $attributes = []);
/**
* Create a collection of models from plain arrays.
*
* @param array<mixed> $items
* @phpstan-return \Illuminate\Database\Eloquent\Collection<TModelClass>
*/
public function hydrate(array $items);
/**
* Create a collection of models from a raw query.
*
* @param string $query
* @param array<mixed> $bindings
* @phpstan-return \Illuminate\Database\Eloquent\Collection<TModelClass>
*/
public function fromQuery($query, $bindings = []);
/**
* Find a model by its primary key.
*
* @param mixed $id
* @param array<int, (model-property<TModelClass>|'*')>|model-property<TModelClass>|'*' $columns
* @phpstan-return TModelClass|\Illuminate\Database\Eloquent\Collection<TModelClass>|null
*/
public function find($id, $columns = ['*']);
/**
* Find multiple models by their primary keys.
*
* @param \Illuminate\Contracts\Support\Arrayable|array<mixed> $ids
* @param array<int, (model-property<TModelClass>|'*')>|model-property<TModelClass>|'*' $columns
* @phpstan-return \Illuminate\Database\Eloquent\Collection<TModelClass>
*/
public function findMany($ids, $columns = ['*']);
/**
* Find a model by its primary key or throw an exception.
*
* @param mixed $id
* @param array<int, (model-property<TModelClass>|'*')>|model-property<TModelClass>|'*' $columns
* @phpstan-return TModelClass|\Illuminate\Database\Eloquent\Collection<TModelClass>
*
* @throws \Illuminate\Database\Eloquent\ModelNotFoundException
*/
public function findOrFail($id, $columns = ['*']);
/**
* Find a model by its primary key or return fresh model instance.
*
* @param mixed $id
* @param array<int, (model-property<TModelClass>|'*')>|model-property<TModelClass>|'*' $columns
* @phpstan-return TModelClass
*/
public function findOrNew($id, $columns = ['*']);
/**
* Execute the query and get the first result.
*
* @param array<model-property<TModelClass>|int, mixed>|string $columns
* @return TModelClass|null
*/
public function first($columns = ['*']);
/**
* Get the first record matching the attributes or instantiate it.
*
* @param array<model-property<TModelClass>, mixed> $attributes
* @param array<model-property<TModelClass>, mixed> $values
* @phpstan-return TModelClass
*/
public function firstOrNew(array $attributes = [], array $values = []);
/**
* Get the first record matching the attributes or create it.
*
* @param array<model-property<TModelClass>, mixed> $attributes
* @param array<model-property<TModelClass>, mixed> $values
* @phpstan-return TModelClass
*/
public function firstOrCreate(array $attributes, array $values = []);
/**
* Create or update a record matching the attributes, and fill it with values.
*
* @param array<model-property<TModelClass>, mixed> $attributes
* @param array<model-property<TModelClass>, mixed> $values
* @phpstan-return TModelClass
*/
public function updateOrCreate(array $attributes, array $values = []);
/**
* @param array<model-property<TModelClass>, mixed> $attributes
* @phpstan-return TModelClass
*/
public function forceCreate(array $attributes);
/**
* @param array<model-property<TModelClass>, mixed> $values
* @return int
*/
public function update(array $values);
/**
* Execute the query and get the first result or throw an exception.
*
* @param array<int, (model-property<TModelClass>|'*')>|model-property<TModelClass>|'*' $columns
* @phpstan-return TModelClass
*
* @throws \Illuminate\Database\Eloquent\ModelNotFoundException
*/
public function firstOrFail($columns = ['*']);
/**
* Execute the query and get the first result if it's the sole matching record.
*
* @param array<int, (model-property<TModelClass>|'*')>|model-property<TModelClass>|'*' $columns
* @phpstan-return TModelClass
*/
public function sole($columns = ['*']);
/**
* Execute the query and get the first result or call a callback.
*
* @param \Closure|array<int, (model-property<TModelClass>|'*')> $columns
* @param \Closure|null $callback
* @phpstan-return TModelClass|mixed
*/
public function firstOr($columns = ['*'], \Closure $callback = null);
/**
* Add a basic where clause to the query.
*
* @param \Closure|model-property<TModelClass>|array<model-property<TModelClass>|int, mixed>|\Illuminate\Database\Query\Expression $column
* @param mixed $operator
* @param mixed $value
* @param string $boolean
* @return static
*/
public function where($column, $operator = null, $value = null, $boolean = 'and');
/**
* Add an "or where" clause to the query.
*
* @param \Closure|model-property<TModelClass>|array<model-property<TModelClass>|int, mixed>|\Illuminate\Database\Query\Expression $column
* @param mixed $operator
* @param mixed $value
* @return static
*/
public function orWhere($column, $operator = null, $value = null);
/**
* Add a relationship count / exists condition to the query.
*
* @template TRelatedModel of Model
* @param \Illuminate\Database\Eloquent\Relations\Relation<TRelatedModel>|string $relation
* @param string $operator
* @param int $count
* @param string $boolean
* @param \Closure|null $callback
* @return static
*
* @throws \RuntimeException
*/
public function has($relation, $operator = '>=', $count = 1, $boolean = 'and', \Closure $callback = null);
/**
* Add a relationship count / exists condition to the query with an "or".
*
* @param string $relation
* @param string $operator
* @param int $count
* @return static
*/
public function orHas($relation, $operator = '>=', $count = 1);
/**
* Add a relationship count / exists condition to the query.
*
* @param string $relation
* @param string $boolean
* @param \Closure|null $callback
* @return static
*/
public function doesntHave($relation, $boolean = 'and', \Closure $callback = null);
/**
* Add a relationship count / exists condition to the query with an "or".
*
* @param string $relation
* @return static
*/
public function orDoesntHave($relation);
/**
* Add a relationship count / exists condition to the query with where clauses.
*
* @param string $relation
* @param \Closure|null $callback
* @param string $operator
* @param int $count
* @return static
*/
public function whereHas($relation, \Closure $callback = null, $operator = '>=', $count = 1);
/**
* Add a relationship count / exists condition to the query with where clauses and an "or".
*
* @param string $relation
* @param \Closure|null $callback
* @param string $operator
* @param int $count
* @return static
*/
public function orWhereHas($relation, \Closure $callback = null, $operator = '>=', $count = 1);
/**
* Add a polymorphic relationship count / exists condition to the query.
*
* @template TRelatedModel of Model
* @template TChildModel of Model
* @param \Illuminate\Database\Eloquent\Relations\MorphTo<TRelatedModel, TChildModel>|string $relation
* @param string|array<string> $types
* @param string $operator
* @param int $count
* @param string $boolean
* @param \Closure|null $callback
* @return static
*/
public function hasMorph($relation, $types, $operator = '>=', $count = 1, $boolean = 'and', \Closure $callback = null);
/**
* Add a polymorphic relationship count / exists condition to the query with an "or".
*
* @template TRelatedModel of Model
* @template TChildModel of Model
* @param \Illuminate\Database\Eloquent\Relations\MorphTo<TRelatedModel, TChildModel>|string $relation
* @param string|array<string> $types
* @param string $operator
* @param int $count
* @return static
*/
public function orHasMorph($relation, $types, $operator = '>=', $count = 1);
/**
* Add a polymorphic relationship count / exists condition to the query.
*
* @template TRelatedModel of Model
* @template TChildModel of Model
* @param \Illuminate\Database\Eloquent\Relations\MorphTo<TRelatedModel, TChildModel>|string $relation
* @param string|array<string> $types
* @param string $boolean
* @param \Closure|null $callback
* @return static
*/
public function doesntHaveMorph($relation, $types, $boolean = 'and', \Closure $callback = null);
/**
* Add a polymorphic relationship count / exists condition to the query with an "or".
*
* @template TRelatedModel of Model
* @template TChildModel of Model
* @param \Illuminate\Database\Eloquent\Relations\MorphTo<TRelatedModel, TChildModel>|string $relation
* @param string|array<string> $types
* @return static
*/
public function orDoesntHaveMorph($relation, $types);
/**
* Add a polymorphic relationship count / exists condition to the query with where clauses.
*
* @template TRelatedModel of Model
* @template TChildModel of Model
* @param \Illuminate\Database\Eloquent\Relations\MorphTo<TRelatedModel, TChildModel>|string $relation
* @param string|array<string> $types
* @param \Closure|null $callback
* @param string $operator
* @param int $count
* @return static
*/
public function whereHasMorph($relation, $types, \Closure $callback = null, $operator = '>=', $count = 1);
/**
* Add a polymorphic relationship count / exists condition to the query with where clauses and an "or".
*
* @template TRelatedModel of Model
* @template TChildModel of Model
* @param \Illuminate\Database\Eloquent\Relations\MorphTo<TRelatedModel, TChildModel>|string $relation
* @param string|array<string> $types
* @param \Closure|null $callback
* @param string $operator
* @param int $count
* @return static
*/
public function orWhereHasMorph($relation, $types, \Closure $callback = null, $operator = '>=', $count = 1);
/**
* Add a polymorphic relationship count / exists condition to the query with where clauses.
*
* @template TRelatedModel of Model
* @template TChildModel of Model
* @param \Illuminate\Database\Eloquent\Relations\MorphTo<TRelatedModel, TChildModel>|string $relation
* @param string|array<string> $types
* @param \Closure|null $callback
* @return static
*/
public function whereDoesntHaveMorph($relation, $types, \Closure $callback = null);
/**
* Add a polymorphic relationship count / exists condition to the query with where clauses and an "or".
*
* @template TRelatedModel of Model
* @template TChildModel of Model
* @param \Illuminate\Database\Eloquent\Relations\MorphTo<TRelatedModel, TChildModel>|string $relation
* @param string|array<string> $types
* @param \Closure|null $callback
* @return static
*/
public function orWhereDoesntHaveMorph($relation, $types, \Closure $callback = null);
/**
* Merge the where constraints from another query to the current query.
*
* @param \Illuminate\Database\Eloquent\Builder<TModelClass> $from
* @return static
*/
public function mergeConstraintsFrom(\Illuminate\Database\Eloquent\Builder $from);
/**
* Add a relationship count / exists condition to the query with where clauses and an "or".
*
* @param string $relation
* @param \Closure|null $callback
* @return static
*/
public function orWhereDoesntHave($relation, \Closure $callback = null);
/**
* Add a relationship count / exists condition to the query with where clauses.
*
* @param string $relation
* @param \Closure|null $callback
* @return static
*/
public function whereDoesntHave($relation, \Closure $callback = null);
/**
* Add a basic where clause to the query, and return the first result.
*
* @param \Closure|model-property<TModelClass>|array<model-property<TModelClass>|int, mixed>|\Illuminate\Database\Query\Expression $column
* @param mixed $operator
* @param mixed $value
* @param string $boolean
* @phpstan-return TModelClass|null
*/
public function firstWhere($column, $operator = null, $value = null, $boolean = 'and');
/**
* Execute the query as a "select" statement.
*
* @param array<int, (model-property<TModelClass>|'*')>|model-property<TModelClass>|'*' $columns
* @phpstan-return \Illuminate\Database\Eloquent\Collection<TModelClass>
*/
public function get($columns = ['*']);
/**
* Get the hydrated models without eager loading.
*
* @param array<int, (model-property<TModelClass>|'*')>|model-property<TModelClass>|'*' $columns
* @phpstan-return TModelClass[]
*/
public function getModels($columns = ['*']);
/**
* Get a single column's value from the first result of a query.
*
* @param model-property<TModelClass>|\Illuminate\Database\Query\Expression $column
* @return mixed
*/
public function value($column);
/**
* Apply the callback's query changes if the given "value" is true.
*
* @param mixed $value
* @param callable($this, mixed): (void|Builder<TModelClass>) $callback
* @param callable($this, mixed): (null|Builder<TModelClass>)|null $default
* @return mixed|$this
*/
public function when($value, $callback, $default = null);
/**
* Apply the callback's query changes if the given "value" is false.
*
* @param mixed $value
* @param callable($this, mixed): (void|Builder<TModelClass>) $callback
* @param callable($this, mixed): (null|Builder<TModelClass>)|null $default
* @return mixed|$this
*/
public function unless($value, $callback, $default = null);
}
class Scope {}
/**
* @method static \Illuminate\Database\Eloquent\Builder<static> withTrashed(bool $withTrashed = true)
* @method static \Illuminate\Database\Eloquent\Builder<static> onlyTrashed()
* @method static \Illuminate\Database\Eloquent\Builder<static> withoutTrashed()
* @method static bool restore()
*/
trait SoftDeletes {}

View File

@ -0,0 +1,43 @@
<?php
namespace Illuminate\Database\Eloquent;
use Illuminate\Support\Traits\EnumeratesValues;
/**
* @template TValue
* @extends \Illuminate\Support\Collection<int, TValue>
*/
class Collection extends \Illuminate\Support\Collection
{
/** @phpstan-use EnumeratesValues<TValue> */
use EnumeratesValues;
/**
* @param mixed $key
* @param mixed $default
* @phpstan-return TValue|null
*/
public function find($key, $default = null) {}
/**
* @template TReturn
* @param callable(TValue, int): TReturn $callable
* @return static<TReturn>|\Illuminate\Support\Collection<int, TReturn>
*/
public function map($callable) {}
/**
* @param callable(TValue, int): mixed $callback
* @return \Illuminate\Support\Collection<mixed, mixed>
*/
public function flatMap(callable $callback) {}
/**
* @template TReturn
* @param callable(TValue ...$values): TReturn $callback
* @return static<TReturn>|\Illuminate\Support\Collection<int, TReturn>
*/
public function mapSpread(callable $callback) {}
}

View File

@ -0,0 +1,81 @@
<?php
namespace Illuminate\Database\Eloquent\Factories;
/**
* @template TModel of \Illuminate\Database\Eloquent\Model
*/
class Factory
{
/**
* The name of the factory's corresponding model.
*
* @var class-string<TModel>
*/
protected $model;
/**
* Get a new factory instance for the given attributes.
*
* @param callable|array<model-property<TModel>, mixed> $attributes
* @return static
*/
public static function new($attributes = []) {}
/**
* Create a single model and persist it to the database.
*
* @param array<model-property<TModel>, mixed> $attributes
* @return TModel
*/
public function createOne($attributes = []) {}
/**
* Create a collection of models and persist them to the database.
*
* @param iterable<callable|array<model-property<TModel>, mixed>> $records
* @return \Illuminate\Database\Eloquent\Collection<TModel>
*/
public function createMany(iterable $records) {}
/**
* Create a collection of models and persist them to the database.
*
* @param array<model-property<TModel>, mixed> $attributes
* @param \Illuminate\Database\Eloquent\Model|null $parent
* @return \Illuminate\Database\Eloquent\Collection<TModel>|TModel
*/
public function create($attributes = [], ?\Illuminate\Database\Eloquent\Model $parent = null) {}
/**
* Make a single instance of the model.
*
* @param callable|array<model-property<TModel>, mixed> $attributes
* @return TModel
*/
public function makeOne($attributes = []) {}
/**
* Create a collection of models.
*
* @param array<model-property<TModel>, mixed> $attributes
* @param \Illuminate\Database\Eloquent\Model|null $parent
* @return \Illuminate\Database\Eloquent\Collection<TModel>|TModel
*/
public function make($attributes = [], ?\Illuminate\Database\Eloquent\Model $parent = null) {}
/**
* Make an instance of the model with the given attributes.
*
* @param \Illuminate\Database\Eloquent\Model|null $parent
* @return TModel
*/
protected function makeInstance(?\Illuminate\Database\Eloquent\Model $parent) {}
/**
* Define the model's default state.
*
* @return array<model-property<TModel>, mixed>
*/
abstract public function definition();
}

View File

@ -0,0 +1,31 @@
<?php
namespace Illuminate\Contracts\Auth\Access
{
interface Gate
{
/**
* Get a guard instance for the given user.
*
* @param \Illuminate\Contracts\Auth\Authenticatable|mixed $user
* @return \Illuminate\Contracts\Auth\Access\Gate
*/
public function forUser($user);
}
}
namespace Illuminate\Auth\Access
{
class Gate implements \Illuminate\Contracts\Auth\Access\Gate
{
/**
* Get a guard instance for the given user.
*
* @param \Illuminate\Contracts\Auth\Authenticatable|mixed $user
* @return \Illuminate\Contracts\Auth\Access\Gate
*/
public function forUser($user);
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace Illuminate\Database\Eloquent\Relations;
/**
* @template TRelatedModel of \Illuminate\Database\Eloquent\Model
* @extends HasOneOrMany<TRelatedModel>
*/
class HasMany extends HasOneOrMany
{
/**
* Get the results of the relationship.
*
* @phpstan-return \Illuminate\Database\Eloquent\Collection<TRelatedModel>
*/
public function getResults();
}

View File

@ -0,0 +1,17 @@
<?php
namespace Illuminate\Database\Eloquent\Relations;
/**
* @template TRelatedModel of \Illuminate\Database\Eloquent\Model
* @extends Relation<TRelatedModel>
*/
class HasManyThrough extends Relation
{
/**
* Get the results of the relationship.
*
* @phpstan-return \Illuminate\Database\Eloquent\Collection<TRelatedModel>
*/
public function getResults();
}

View File

@ -0,0 +1,17 @@
<?php
namespace Illuminate\Database\Eloquent\Relations;
/**
* @template TRelatedModel of \Illuminate\Database\Eloquent\Model
* @extends HasOneOrMany<TRelatedModel>
*/
class HasOne extends HasOneOrMany
{
/**
* Get the results of the relationship.
*
* @phpstan-return ?TRelatedModel
*/
public function getResults();
}

View File

@ -0,0 +1,86 @@
<?php
namespace Illuminate\Database\Eloquent\Relations;
/**
* @template TRelatedModel of \Illuminate\Database\Eloquent\Model
* @extends Relation<TRelatedModel>
*/
abstract class HasOneOrMany extends Relation
{
/**
* Create a new has one or many relationship instance.
*
* @param \Illuminate\Database\Eloquent\Builder<TRelatedModel> $query
* @param TRelatedModel $parent
* @param non-empty-string $foreignKey
* @param non-empty-string $localKey
* @return void
*/
public function __construct(\Illuminate\Database\Eloquent\Builder $query, \Illuminate\Database\Eloquent\Model $parent, $foreignKey, $localKey);
/**
* @param array<model-property<TRelatedModel>, mixed> $attributes
* @phpstan-return TRelatedModel
*/
public function make(array $attributes = []);
/**
* Find a model by its primary key or return new instance of the related model.
*
* @param mixed $id
* @param array<int, mixed> $columns
* @return \Illuminate\Support\Collection<int, TRelatedModel>|TRelatedModel
*/
public function findOrNew($id, $columns = ['*']);
/**
* Get the first related model record matching the attributes or instantiate it.
*
* @param array<model-property<TRelatedModel>, mixed> $attributes
* @param array<mixed, mixed> $values
* @return TRelatedModel
*/
public function firstOrNew(array $attributes, array $values = []);
/**
* Get the first related record matching the attributes or create it.
*
* @param array<model-property<TRelatedModel>, mixed> $attributes
* @param array<mixed, mixed> $values
* @return TRelatedModel
*/
public function firstOrCreate(array $attributes, array $values = []);
/**
* Create or update a related record matching the attributes, and fill it with values.
*
* @param array<model-property<TRelatedModel>, mixed> $attributes
* @param array<array-key, mixed> $values
* @return TRelatedModel
*/
public function updateOrCreate(array $attributes, array $values = []);
/**
* Attach a model instance to the parent model.
*
* @param \Illuminate\Database\Eloquent\Model $model
* @return TRelatedModel|false
*/
public function save(\Illuminate\Database\Eloquent\Model $model);
/**
* @phpstan-param array<model-property<TRelatedModel>, mixed> $attributes
*
* @phpstan-return TRelatedModel
*/
public function create(array $attributes = []);
/**
* Create a Collection of new instances of the related model.
*
* @param iterable<mixed> $records
* @return \Illuminate\Database\Eloquent\Collection<TRelatedModel>
*/
public function createMany(iterable $records);
}

View File

@ -0,0 +1,24 @@
<?php
namespace Illuminate\Database\Eloquent\Relations;
/**
* @template TRelatedModel of \Illuminate\Database\Eloquent\Model
* @extends HasManyThrough<TRelatedModel>
*/
class HasOneThrough extends HasManyThrough
{
/**
* @param array<model-property<TRelatedModel>, mixed> $attributes
*
* @phpstan-return TRelatedModel
*/
public function create(array $attributes = []);
/**
* Get the results of the relationship.
*
* @phpstan-return \Illuminate\Database\Eloquent\Collection<TRelatedModel>
*/
public function getResults();
}

View File

@ -0,0 +1,28 @@
<?php
namespace Illuminate\Database\Eloquent;
/**
* @implements \ArrayAccess<string, mixed>
*/
abstract class Model implements \JsonSerializable, \ArrayAccess
{
/**
* Update the model in the database.
*
* @param array<model-property<static>, mixed> $attributes
* @param array<int|string, mixed> $options
* @return bool
*/
public function update(array $attributes = [], array $options = []);
/**
* Begin querying a model with eager loading.
*
* @param non-empty-string|array<int|string, (\Closure)|string> $relations
* @return \Illuminate\Database\Eloquent\Builder<static>
*/
public static function with($relations);
}
class ModelNotFoundException extends \RuntimeException {}

View File

@ -0,0 +1,24 @@
<?php
namespace Illuminate\Database\Eloquent\Relations;
/**
* @template TRelatedModel of \Illuminate\Database\Eloquent\Model
* @extends MorphOneOrMany<TRelatedModel>
*/
class MorphMany extends MorphOneOrMany
{
/**
* @param array<model-property<TRelatedModel>, mixed> $attributes
*
* @phpstan-return TRelatedModel
*/
public function create(array $attributes = []);
/**
* Get the results of the relationship.
*
* @phpstan-return \Illuminate\Database\Eloquent\Collection<TRelatedModel>
*/
public function getResults();
}

View File

@ -0,0 +1,17 @@
<?php
namespace Illuminate\Database\Eloquent\Relations;
/**
* @template TRelatedModel of \Illuminate\Database\Eloquent\Model
* @extends MorphOneOrMany<TRelatedModel>
*/
class MorphOne extends MorphOneOrMany
{
/**
* Get the results of the relationship.
*
* @phpstan-return ?TRelatedModel
*/
public function getResults();
}

View File

@ -0,0 +1,17 @@
<?php
namespace Illuminate\Database\Eloquent\Relations;
/**
* @template TRelatedModel of \Illuminate\Database\Eloquent\Model
* @extends HasOneOrMany<TRelatedModel>
*/
abstract class MorphOneOrMany extends HasOneOrMany
{
/**
* @param array<model-property<TRelatedModel>, mixed> $attributes
*
* @phpstan-return TRelatedModel
*/
public function create(array $attributes = []);
}

View File

@ -0,0 +1,11 @@
<?php
namespace Illuminate\Database\Eloquent\Relations;
/**
* @template TRelatedModel of \Illuminate\Database\Eloquent\Model
* @template TChildModel of \Illuminate\Database\Eloquent\Model
* @extends BelongsTo<TRelatedModel, TChildModel>
*/
class MorphTo extends BelongsTo
{}

View File

@ -0,0 +1,11 @@
<?php
namespace Illuminate\Database\Eloquent\Relations;
/**
* @template TRelatedModel of \Illuminate\Database\Eloquent\Model
* @extends BelongsToMany<TRelatedModel>
*/
class MorphToMany extends BelongsToMany
{
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,24 @@
<?php
namespace Illuminate\Database\Eloquent\Relations;
/**
* @template TRelatedModel of \Illuminate\Database\Eloquent\Model
*/
class Relation
{
/**
* Execute the query as a "select" statement.
*
* @param array<int, string> $columns
* @phpstan-return \Illuminate\Database\Eloquent\Collection<TRelatedModel>
*/
public function get($columns = ['*']);
/**
* @param array<model-property<TRelatedModel>, mixed> $attributes
* @phpstan-return TRelatedModel
*/
public function make(array $attributes = []);
}

View File

@ -0,0 +1,58 @@
<?php
namespace Illuminate\Support;
/**
* @template TKey
* @template TValue
*
* @extends \IteratorAggregate<TKey, TValue>
*/
interface Enumerable extends \Countable, \IteratorAggregate, \JsonSerializable
{
/**
* @param string|callable(TValue, TKey): bool $key
* @param mixed $operator
* @param mixed $value
* @return static<static>
*/
public function partition($key, $operator = null, $value = null);
/**
* @param string|callable(TValue, TKey): mixed $keyBy
* @return static<TValue>
*/
public function keyBy($keyBy);
/**
* @param callable(TValue, TKey): array<mixed> $callback
* @return static<mixed>
*/
public function mapWithKeys(callable $callback);
/**
* @param callable(TValue, TKey): array<mixed> $callback
* @return static<array<mixed>>
*/
public function mapToDictionary(callable $callback);
/**
* @param string|callable(TValue, TKey): bool $key
* @param mixed $operator
* @param mixed $value
* @return bool
*/
public function every($key, $operator = null, $value = null);
/**
* @param int $size
* @return static<static>
*/
public function chunk($size);
/**
* @param callable(static): void $callable
* @return static
*/
public function tap($callable);
}

View File

@ -0,0 +1,36 @@
<?php
namespace Illuminate\Support\Traits;
use Illuminate\Support\HigherOrderCollectionProxy;
/**
* @template TValue
* @property-read HigherOrderCollectionProxy<'average', TValue> $average
* @property-read HigherOrderCollectionProxy<'avg', TValue> $avg
* @property-read HigherOrderCollectionProxy<'contains', TValue> $contains
* @property-read HigherOrderCollectionProxy<'each', TValue> $each
* @property-read HigherOrderCollectionProxy<'every', TValue> $every
* @property-read HigherOrderCollectionProxy<'filter', TValue> $filter
* @property-read HigherOrderCollectionProxy<'first', TValue> $first
* @property-read HigherOrderCollectionProxy<'flatMap', TValue> $flatMap
* @property-read HigherOrderCollectionProxy<'groupBy', TValue> $groupBy
* @property-read HigherOrderCollectionProxy<'keyBy', TValue> $keyBy
* @property-read HigherOrderCollectionProxy<'map', TValue> $map
* @property-read HigherOrderCollectionProxy<'max', TValue> $max
* @property-read HigherOrderCollectionProxy<'min', TValue> $min
* @property-read HigherOrderCollectionProxy<'partition', TValue> $partition
* @property-read HigherOrderCollectionProxy<'reject', TValue> $reject
* @property-read HigherOrderCollectionProxy<'some', TValue> $some
* @property-read HigherOrderCollectionProxy<'sortBy', TValue> $sortBy
* @property-read HigherOrderCollectionProxy<'sortByDesc', TValue> $sortByDesc
* @property-read HigherOrderCollectionProxy<'skipUntil', TValue> $skipUntil
* @property-read HigherOrderCollectionProxy<'skipWhile', TValue> $skipWhile
* @property-read HigherOrderCollectionProxy<'sum', TValue> $sum
* @property-read HigherOrderCollectionProxy<'takeUntil', TValue> $takeUntil
* @property-read HigherOrderCollectionProxy<'takeWhile', TValue> $takeWhile
* @property-read HigherOrderCollectionProxy<'unique', TValue> $unique
* @property-read HigherOrderCollectionProxy<'until', TValue> $until
*/
trait EnumeratesValues
{}

View File

@ -0,0 +1,30 @@
<?php
namespace Illuminate\Support\Facades;
abstract class Facade {}
/**
* @mixin \Redis
* @mixin \Illuminate\Redis\RedisManager
* @mixin \Illuminate\Contracts\Redis\Factory
*/
class Redis {}
/**
* @mixin \Illuminate\Database\DatabaseManager
* @mixin \Illuminate\Database\Connection
* @mixin \Illuminate\Database\ConnectionInterface
*/
class DB extends Facade {}
/**
* @mixin \Illuminate\Queue\QueueManager
* @mixin \Illuminate\Queue\Queue
*/
class Queue extends Facade {}
/**
* @mixin \Illuminate\Log\Logger
*/
class Log extends Facade {}

View File

@ -0,0 +1,48 @@
<?php
/**
* @template TValue
* @template TDefault
*
* @param callable(): TValue $callback
* @param TDefault|(callable(\Throwable): TDefault) $rescue
* @param bool $report
* @return TValue|TDefault
*/
function rescue(callable $callback, $rescue = null, $report = true)
{
}
/**
* @template TValue
* @param int $times
* @param callable(int): TValue $callback
* @param int $sleep
* @param null|callable(\Exception): bool $when
* @phpstan-return TValue
*
* @throws \Exception
*/
function retry($times, callable $callback, $sleep = 0, $when = null)
{
}
/**
* @template TValue
* @param TValue $value
* @param null|callable(TValue): void $callback
* @return mixed
*/
function tap($value, $callback = null)
{
}
/**
* @param view-string|null $view
* @param \Illuminate\Contracts\Support\Arrayable|array<string, mixed> $data
* @param array<string, mixed> $mergeData
* @return mixed
*/
function view($view = null, $data = [], $mergeData = [])
{
}

View File

@ -0,0 +1,24 @@
<?php
namespace Illuminate\Support;
/**
* @template TClass
* @property TClass $target
*/
class HigherOrderTapProxy
{
/**
* @param TClass $target
*/
public function __construct($target)
{
}
}
/**
* @template T
* @template TValue
*/
class HigherOrderCollectionProxy
{}

View File

@ -0,0 +1,14 @@
<?php
namespace Psr\Log {
interface LoggerInterface {}
}
namespace Illuminate\Log {
/**
* @mixin \Illuminate\Log\LogManager
* @mixin \Monolog\Logger
*/
class Logger implements \Psr\Log\LoggerInterface {}
}

View File

@ -0,0 +1,22 @@
<?php
namespace Illuminate\Mail;
class Mailable
{
/**
* @param view-string $view
* @param array<string, mixed> $data
* @return $this
*/
public function markdown($view, array $data = [])
{}
/**
* @param view-string $view
* @param array<string, mixed> $data
* @return $this
*/
public function view($view, array $data = [])
{}
}

View File

@ -0,0 +1,23 @@
<?php
namespace Illuminate\Pagination;
/**
* @mixin \Illuminate\Support\Collection
*/
abstract class AbstractPaginator implements \Illuminate\Contracts\Support\Htmlable
{}
/**
* @implements \ArrayAccess<mixed, mixed>
* @implements \IteratorAggregate<mixed, mixed>
*/
class Paginator extends AbstractPaginator implements \Illuminate\Contracts\Support\Arrayable, \ArrayAccess, \Countable, \IteratorAggregate, \Illuminate\Contracts\Support\Jsonable, \JsonSerializable, \Illuminate\Contracts\Pagination\Paginator
{}
/**
* @implements \ArrayAccess<mixed, mixed>
* @implements \IteratorAggregate<mixed, mixed>
*/
class LengthAwarePaginator extends AbstractPaginator implements \Illuminate\Contracts\Support\Arrayable, \ArrayAccess, \Countable, \IteratorAggregate, \Illuminate\Contracts\Support\Jsonable, \JsonSerializable, \Illuminate\Contracts\Pagination\LengthAwarePaginator
{}

View File

@ -0,0 +1,9 @@
<?php
namespace Illuminate\Redis\Connections;
/**
* @mixin \Redis
*/
abstract class Connection
{}