fix: split Builder/HasOneOrMany diffs into 6/8 stubs

This commit is contained in:
Claas Augner 2021-07-07 00:42:39 +02:00
parent 25a9bf7ef0
commit 98a7bd56b1
6 changed files with 108 additions and 31 deletions

View File

@ -0,0 +1,25 @@
<?php
namespace Illuminate\Database\Eloquent;
/**
* @template-covariant TModel of \Illuminate\Database\Eloquent\Model
* @property-read HigherOrderBuilderProxy $orWhere
*
* @mixin \Illuminate\Database\Query\Builder
*/
class Builder
{
/**
* @param array $attributes
* @param array $values
* @return TModel
*/
public function firstOrNew(array $attributes, array $values = []) { }
/**
* @param array $attributes
* @param array $values
* @return TModel
*/
public function firstOrCreate(array $attributes, array $values = []) { }
}

View File

@ -0,0 +1,27 @@
<?php
namespace Illuminate\Database\Eloquent\Relations;
/**
* @template TRelatedModel of Model
* @template-extends Relation<TRelatedModel>
* @mixin \Illuminate\Database\Eloquent\Builder<TRelatedModel>
*/
abstract class HasOneOrMany extends Relation
{
/**
* @param array $attributes
* @param array $values
* @return \Illuminate\Database\Eloquent\Model
* @psalm-return TRelatedModel
*/
public function firstOrNew(array $attributes, array $values = []) { }
/**
* @param array $attributes
* @param array $values
* @return \Illuminate\Database\Eloquent\Model
* @psalm-return TRelatedModel
*/
public function firstOrCreate(array $attributes, array $values = []) { }
}

View File

@ -0,0 +1,26 @@
<?php
namespace Illuminate\Database\Eloquent;
/**
* @template-covariant TModel of \Illuminate\Database\Eloquent\Model
* @property-read HigherOrderBuilderProxy $orWhere
*
* @mixin \Illuminate\Database\Query\Builder
*/
class Builder
{
/**
* @param array $attributes
* @param array $values
* @return TModel
*/
public function firstOrNew(array $attributes = [], array $values = []) { }
/**
* @param array $attributes
* @param array $values
* @return TModel
*/
public function firstOrCreate(array $attributes = [], array $values = []) { }
}

View File

@ -0,0 +1,30 @@
<?php
namespace Illuminate\Database\Eloquent\Relations;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder;
/**
* @template TRelatedModel of Model
* @template-extends Relation<TRelatedModel>
* @mixin \Illuminate\Database\Eloquent\Builder<TRelatedModel>
*/
abstract class HasOneOrMany extends Relation
{
/**
* @param array $attributes
* @param array $values
* @return \Illuminate\Database\Eloquent\Model
* @psalm-return TRelatedModel
*/
public function firstOrNew(array $attributes = [], array $values = []) { }
/**
* @param array $attributes
* @param array $values
* @return \Illuminate\Database\Eloquent\Model
* @psalm-return TRelatedModel
*/
public function firstOrCreate(array $attributes = [], array $values = []) { }
}

View File

@ -136,20 +136,6 @@ class Builder
*/
public function findOrNew($id, $columns = ['*']) { }
/**
* @param array $attributes
* @param array $values
* @return TModel
*/
public function firstOrNew(array $attributes = [], array $values = []) { }
/**
* @param array $attributes
* @param array $values
* @return TModel
*/
public function firstOrCreate(array $attributes = [], array $values = []) { }
/**
* @param array $attributes
* @param array $values

View File

@ -4,7 +4,6 @@ namespace Illuminate\Database\Eloquent\Relations;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
/**
* @template TRelatedModel of Model
@ -46,22 +45,6 @@ abstract class HasOneOrMany extends Relation
*/
public function findOrNew($id, $columns = ['*']) { }
/**
* @param array $attributes
* @param array $values
* @return \Illuminate\Database\Eloquent\Model
* @psalm-return TRelatedModel
*/
public function firstOrNew(array $attributes = [], array $values = []) { }
/**
* @param array $attributes
* @param array $values
* @return \Illuminate\Database\Eloquent\Model
* @psalm-return TRelatedModel
*/
public function firstOrCreate(array $attributes = [], array $values = []) { }
/**
* @param array $attributes
* @param array $values