Use more standardized phpcs

This commit is contained in:
Dane Everitt 2021-01-23 12:33:34 -08:00
parent a043071e3c
commit c449ca5155
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
493 changed files with 1116 additions and 3903 deletions

View file

@ -59,7 +59,7 @@ abstract class Model extends IlluminateModel
static::$validatorFactory = Container::getInstance()->make(Factory::class);
static::saving(function (Model $model) {
if (! $model->validate()) {
if (!$model->validate()) {
throw new DataValidationException($model->getValidator());
}
@ -89,7 +89,10 @@ abstract class Model extends IlluminateModel
$rules = $this->getKey() ? static::getRulesForUpdate($this) : static::getRules();
return $this->validator ?: $this->validator = static::$validatorFactory->make(
[], $rules, [], []
[],
$rules,
[],
[]
);
}
@ -113,7 +116,7 @@ abstract class Model extends IlluminateModel
* rather than just creating it.
*
* @param \Illuminate\Database\Eloquent\Model|int|string $id
* @param string $primaryKey
*
* @return array
*/
public static function getRulesForUpdate($id, string $primaryKey = 'id')
@ -129,7 +132,7 @@ abstract class Model extends IlluminateModel
// working model so we don't run into errors due to the way that field validation
// works.
foreach ($data as &$datum) {
if (! is_string($datum) || ! Str::startsWith($datum, 'unique')) {
if (!is_string($datum) || !Str::startsWith($datum, 'unique')) {
continue;
}
@ -159,7 +162,8 @@ abstract class Model extends IlluminateModel
// for that model. Doing this will return all of the attributes in a format that can
// properly be validated.
$this->addCastAttributesToArray(
$this->getAttributes(), $this->getMutatedAttributes()
$this->getAttributes(),
$this->getMutatedAttributes()
)
)->passes();
}
@ -168,11 +172,12 @@ abstract class Model extends IlluminateModel
* Return a timestamp as DateTime object.
*
* @param mixed $value
*
* @return \Illuminate\Support\Carbon|\Carbon\CarbonImmutable
*/
protected function asDateTime($value)
{
if (! $this->immutableDates) {
if (!$this->immutableDates) {
return parent::asDateTime($value);
}