diff --git a/bin/Console.php b/bin/Console.php index dfd4be5d..a99eab55 100644 --- a/bin/Console.php +++ b/bin/Console.php @@ -79,11 +79,11 @@ protected function init() /** * execute * - * @param \Closure|null $callback + * @param \Closure|null $callback * * @return int */ - public function execute(\Closure $callback = null) + public function execute(?\Closure $callback = null) { try { if ($this->getOption($this->helpOptions)) { diff --git a/src/Attributes/Author.php b/src/Attributes/Author.php index fd55f6a1..e98de140 100644 --- a/src/Attributes/Author.php +++ b/src/Attributes/Author.php @@ -17,7 +17,7 @@ class Author extends CastForSave { protected function getDefaultCaster(): callable { - return function (mixed $value, ORM $orm, object $entity, UserService $userService = null) { + return function (mixed $value, ORM $orm, object $entity, ?UserService $userService = null) { if (!$value && $userService) { $mapper = $orm->mapper($entity::class); diff --git a/src/Attributes/Modifier.php b/src/Attributes/Modifier.php index a9617213..ab487c6d 100644 --- a/src/Attributes/Modifier.php +++ b/src/Attributes/Modifier.php @@ -17,7 +17,7 @@ class Modifier extends CastForSave { protected function getDefaultCaster(): callable { - return function (mixed $value, ORM $orm, object $entity, UserService $userService = null) { + return function (mixed $value, ORM $orm, object $entity, ?UserService $userService = null) { if (!$userService) { return $value; } diff --git a/src/Auth/LunaAuthMethod.php b/src/Auth/LunaAuthMethod.php index 43837c3a..9ae405fb 100644 --- a/src/Auth/LunaAuthMethod.php +++ b/src/Auth/LunaAuthMethod.php @@ -206,7 +206,7 @@ protected function getUsernames(array $credential): array|object return Arr::only($credential, $loginNames); } - protected function isSRPEnabled(array $credential, array &$srp = null): bool + protected function isSRPEnabled(array $credential, ?array &$srp = null): bool { if (!$this->srpService->isEnabled()) { return false; diff --git a/src/Captcha/Recaptcha/WindwalkerRequestMethod.php b/src/Captcha/Recaptcha/WindwalkerRequestMethod.php index 9e73e92d..8d2b213a 100644 --- a/src/Captcha/Recaptcha/WindwalkerRequestMethod.php +++ b/src/Captcha/Recaptcha/WindwalkerRequestMethod.php @@ -34,7 +34,7 @@ class WindwalkerRequestMethod implements RequestMethod * @param HttpClient|null $http * @param null $url */ - public function __construct(HttpClient $http = null, $url = null) + public function __construct(?HttpClient $http = null, $url = null) { $this->http = $http ?: new HttpClient(); $this->url = $url ?: ReCaptcha::SITE_VERIFY_URL; diff --git a/src/Helper/PravatarHelper.php b/src/Helper/PravatarHelper.php index baddbf86..108aac3f 100644 --- a/src/Helper/PravatarHelper.php +++ b/src/Helper/PravatarHelper.php @@ -30,7 +30,7 @@ class PravatarHelper * * @return string */ - public static function url(int $size = 300, int $id = null, string $u = null): string + public static function url(int $size = 300, ?int $id = null, ?string $u = null): string { $uri = new Uri(static::$host); @@ -58,7 +58,7 @@ public static function url(int $size = 300, int $id = null, string $u = null): s * @return string * @throws Exception */ - public static function unique(int $size = 300, string $u = null): string + public static function unique(int $size = 300, ?string $u = null): string { if ((string) $u === '') { $u = uid(); diff --git a/src/Menu/Tree/MenuNode.php b/src/Menu/Tree/MenuNode.php index 4c081da6..4e8f38f9 100644 --- a/src/Menu/Tree/MenuNode.php +++ b/src/Menu/Tree/MenuNode.php @@ -14,6 +14,7 @@ use Windwalker\Core\Router\RouteUri; use Windwalker\DI\Attributes\Inject; use Windwalker\DOM\DOMElement; +use Windwalker\DOM\HTMLElement; use Windwalker\Uri\Uri; /** @@ -33,7 +34,7 @@ class MenuNode extends Node implements MenuNodeInterface protected string $layout = 'link.link'; - protected ?DOMElement $element = null; + protected ?HTMLElement $element = null; protected ?bool $forceActive = null; @@ -283,9 +284,9 @@ public function getHTMLAttributes(array $merge = []): array ); } - public function getElement(): DOMElement + public function getElement(): HTMLElement { - return $this->element ??= DOMElement::create('div'); + return $this->element ??= HTMLElement::new('div'); } public function attr(string $name, string $value): static diff --git a/src/PageBuilder/Renderer/Style/StyleContainer.php b/src/PageBuilder/Renderer/Style/StyleContainer.php index 84e15cf2..bc3414e3 100644 --- a/src/PageBuilder/Renderer/Style/StyleContainer.php +++ b/src/PageBuilder/Renderer/Style/StyleContainer.php @@ -57,7 +57,7 @@ public function self(string $suffix = ''): StyleRules * * @since 1.5.2 */ - public function select(string $selector, callable $callback = null): StyleRules + public function select(string $selector, ?callable $callback = null): StyleRules { $k = trim($this->prefix . ' ' . $selector); @@ -74,7 +74,7 @@ public function select(string $selector, callable $callback = null): StyleRules * * @since 1.5.2 */ - public function selectAppend(string $selector, callable $callback = null): StyleRules + public function selectAppend(string $selector, ?callable $callback = null): StyleRules { $k = trim($this->prefix . $selector); @@ -91,7 +91,7 @@ public function selectAppend(string $selector, callable $callback = null): Style * * @since 1.5.2 */ - protected function doSelect(string $selector, callable $callback = null): StyleRules + protected function doSelect(string $selector, ?callable $callback = null): StyleRules { if (!isset($this->selectors[$selector])) { $this->selectors[$selector] = new StyleRules(); @@ -116,7 +116,7 @@ protected function doSelect(string $selector, callable $callback = null): StyleR * * @since 1.5.2 */ - public function wrap(string $selector, callable $callback = null): StyleContainer + public function wrap(string $selector, ?callable $callback = null): StyleContainer { if (!isset($this->selectors[$selector])) { $this->selectors[$selector] = new StyleRules(); diff --git a/src/Services/TagService.php b/src/Services/TagService.php index 022e9bbf..f1c4a470 100644 --- a/src/Services/TagService.php +++ b/src/Services/TagService.php @@ -24,7 +24,7 @@ public function __construct(protected ORM $orm) { } - public function createTagsIfNew(iterable $tagIds, callable $configure = null): array + public function createTagsIfNew(iterable $tagIds, ?callable $configure = null): array { $r = []; @@ -68,7 +68,7 @@ public function flushTagMapsFromInput( string|\BackedEnum $type, mixed $targetId, iterable $tagIds, - callable $configureNewTag = null + ?callable $configureNewTag = null ): iterable { $tagIds = $this->createTagsIfNew($tagIds, $configureNewTag); diff --git a/src/User/Exception/LoginFailException.php b/src/User/Exception/LoginFailException.php index a8d8b88b..43fff20b 100644 --- a/src/User/Exception/LoginFailException.php +++ b/src/User/Exception/LoginFailException.php @@ -14,12 +14,12 @@ class LoginFailException extends AuthenticateFailException /** * Class init. * - * @param string $mainMessage - * @param string|array $messages - * @param int $code - * @param Throwable $previous + * @param string $mainMessage + * @param string|array $messages + * @param int $code + * @param Throwable|null $previous */ - public function __construct(string $mainMessage, $messages = [], int $code = 0, Throwable $previous = null) + public function __construct(string $mainMessage, $messages = [], int $code = 0, ?Throwable $previous = null) { parent::__construct($messages, $code, $previous); diff --git a/src/User/UserService.php b/src/User/UserService.php index 848ebef1..e9295da0 100644 --- a/src/User/UserService.php +++ b/src/User/UserService.php @@ -137,7 +137,7 @@ public function mustLoad(mixed $conditions = null): UserEntityInterface public function attemptToLogin( array $credential, array $options = [], - ResultSet &$resultSet = null + ?ResultSet &$resultSet = null ): false|AuthResult { $event = $this->emit( BeforeLoginEvent::class, @@ -206,7 +206,7 @@ public function can(string $action, mixed $user = null, ...$args): bool return $this->getAuthService()->authorize($action, $user, ...$args); } - public function authenticate(array $credential, ResultSet &$resultSet = null): false|AuthResult + public function authenticate(array $credential, ?ResultSet &$resultSet = null): false|AuthResult { return $this->getAuthService()->authenticate($credential, $resultSet); }