/
githubmirror
/
framework
Обзор
Документация
Войти
/
githubmirror
/
framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
13.x
tests/Database/stubs/TestValueObject.php
34 строки
774 B
Guram Vashakidze
Fix unsetting model castable attribute when cast to object (#56335) (#56343)
20 июл 2025, 21:34
Не верифицирован
20 июл 2025, 21:34
58ea471
Код
Авторство
О чём код?
<?php namespace Illuminate\Tests\Database\stubs; class TestValueObject { private string $myPropertyA; private string $myPropertyB; public static function make(?array $test): self { $self = new self; if (! empty($test['myPropertyA'])) { $self->myPropertyA = $test['myPropertyA']; } if (! empty($test['myPropertyB'])) { $self->myPropertyB = $test['myPropertyB']; } return $self; } public function toArray(): array { if (isset($this->myPropertyA)) { $result['myPropertyA'] = $this->myPropertyA; } if (isset($this->myPropertyB)) { $result['myPropertyB'] = $this->myPropertyB; } return $result ?? []; } }