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

@@ -2,6 +2,7 @@
namespace Kirby\Cms;
use Closure;
use Kirby\Exception\BadMethodCallException;
/**
@@ -17,22 +18,17 @@ trait HasMethods
{
/**
* All registered methods
*
* @var array
*/
public static $methods = [];
public static array $methods = [];
/**
* Calls a registered method class with the
* passed arguments
*
* @internal
* @param string $method
* @param array $args
* @return mixed
*
* @throws \Kirby\Exception\BadMethodCallException
*/
public function callMethod(string $method, array $args = [])
public function callMethod(string $method, array $args = []): mixed
{
$closure = $this->getMethod($method);
@@ -45,10 +41,7 @@ trait HasMethods
/**
* Checks if the object has a registered method
*
* @internal
* @param string $method
* @return bool
*/
public function hasMethod(string $method): bool
{
@@ -59,11 +52,8 @@ trait HasMethods
* Returns a registered method by name, either from
* the current class or from a parent class ordered by
* inheritance order (top to bottom)
*
* @param string $method
* @return \Closure|null
*/
protected function getMethod(string $method)
protected function getMethod(string $method): Closure|null
{
if (isset(static::$methods[$method]) === true) {
return static::$methods[$method];