Upgrade to 4.0.0

This commit is contained in:
Bastian Allgeier
2023-11-28 09:33:56 +01:00
parent f96b96af76
commit 3b0b6546ca
480 changed files with 21371 additions and 13327 deletions

View File

@@ -18,24 +18,15 @@ class Section extends Component
{
/**
* Registry for all component mixins
*
* @var array
*/
public static $mixins = [];
public static array $mixins = [];
/**
* Registry for all component types
*
* @var array
*/
public static $types = [];
public static array $types = [];
/**
* Section constructor.
*
* @param string $type
* @param array $attrs
* @throws \Kirby\Exception\InvalidArgumentException
*/
public function __construct(string $type, array $attrs = [])
@@ -44,7 +35,7 @@ class Section extends Component
throw new InvalidArgumentException('Undefined section model');
}
if ($attrs['model'] instanceof Model === false) {
if ($attrs['model'] instanceof ModelWithContent === false) {
throw new InvalidArgumentException('Invalid section model');
}
@@ -64,25 +55,16 @@ class Section extends Component
return $this->errors ?? [];
}
/**
* @return \Kirby\Cms\App
*/
public function kirby()
public function kirby(): App
{
return $this->model()->kirby();
}
/**
* @return \Kirby\Cms\Model
*/
public function model()
public function model(): ModelWithContent
{
return $this->model;
}
/**
* @return array
*/
public function toArray(): array
{
$array = parent::toArray();
@@ -92,9 +74,6 @@ class Section extends Component
return $array;
}
/**
* @return array
*/
public function toResponse(): array
{
return array_merge([