1
0
Fork 0
mirror of https://github.com/archtechx/laravel-seo.git synced 2025-12-12 09:54:03 +00:00

Correct nullable type

This commit is contained in:
l3aro 2024-11-23 03:55:29 +07:00 committed by GitHub
parent 76d0f9efac
commit 8a39d88584
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 19 deletions

View file

@ -9,20 +9,20 @@ use Illuminate\Support\Arr;
use Illuminate\Support\Str;
/**
* @method $this title(string $title = null, ...$args) Set the title.
* @method $this description(string $description = null, ...$args) Set the description.
* @method $this keywords(string $keywords = null, ...$args) Set the keywords.
* @method $this url(string $url = null, ...$args) Set the canonical URL.
* @method $this site(string $site = null, ...$args) Set the site name.
* @method $this image(string $url = null, ...$args) Set the cover image.
* @method $this type(string $type = null, ...$args) Set the page type.
* @method $this locale(string $locale = null, ...$args) Set the page locale.
* @method $this title(?string $title = null, ...$args) Set the title.
* @method $this description(?string $description = null, ...$args) Set the description.
* @method $this keywords(?string $keywords = null, ...$args) Set the keywords.
* @method $this url(?string $url = null, ...$args) Set the canonical URL.
* @method $this site(?string $site = null, ...$args) Set the site name.
* @method $this image(?string $url = null, ...$args) Set the cover image.
* @method $this type(?string $type = null, ...$args) Set the page type.
* @method $this locale(?string $locale = null, ...$args) Set the page locale.
* @method $this twitter(bool $enabled = true, ...$args) Enable the Twitter extension.
* @method $this twitterCreator(string $username = null, ...$args) Set the Twitter author.
* @method $this twitterSite(string $username = null, ...$args) Set the Twitter author.
* @method $this twitterTitle(string $title = null, ...$args) Set the Twitter title.
* @method $this twitterDescription(string $description = null, ...$args) Set the Twitter description.
* @method $this twitterImage(string $url = null, ...$args) Set the Twitter cover image.
* @method $this twitterCreator(?string $username = null, ...$args) Set the Twitter author.
* @method $this twitterSite(?string $username = null, ...$args) Set the Twitter author.
* @method $this twitterTitle(?string $title = null, ...$args) Set the Twitter title.
* @method $this twitterDescription(?string $description = null, ...$args) Set the Twitter description.
* @method $this twitterImage(?string $url = null, ...$args) Set the Twitter cover image.
*/
class SEOManager
{
@ -135,7 +135,7 @@ class SEOManager
}
/** Configure an extension. */
public function extension(string $name, bool $enabled = true, string $view = null): static
public function extension(string $name, bool $enabled = true, ?string $view = null): static
{
$this->extensions[$name] = $enabled;
@ -159,7 +159,7 @@ class SEOManager
}
/** Configure or use Flipp. */
public function flipp(string $alias, string|array $data = null): string|static
public function flipp(string $alias, string|array|null $data = null): string|static
{
if (is_string($data)) {
$this->meta("flipp.templates.$alias", $data);
@ -185,7 +185,7 @@ class SEOManager
}
/** Configure or use Previewify. */
public function previewify(string $alias, int|string|array $data = null): string|static
public function previewify(string $alias, int|string|array|null $data = null): string|static
{
if (is_string($data) || is_int($data)) {
$this->meta("previewify.templates.$alias", (string) $data);
@ -250,7 +250,7 @@ class SEOManager
}
/** Add a head tag. */
public function rawTag(string $key, string $tag = null): static
public function rawTag(string $key, ?string $tag = null): static
{
$tag ??= $key;
@ -275,7 +275,7 @@ class SEOManager
* @param string|array|null $value The value (if a single key is provided).
* @return $this|string|null
*/
public function meta(string|array $key, string|array $value = null): mixed
public function meta(string|array $key, string|array|null $value = null): mixed
{
if (is_array($key)) {
/** @var array<string, string> $key */

View file

@ -5,7 +5,7 @@ declare(strict_types=1);
use ArchTech\SEO\SEOManager;
if (! function_exists('seo')) {
function seo(string|array $key = null): SEOManager|string|array|null
function seo(string|array|null $key = null): SEOManager|string|array|null
{
if ($key === null) {
return app('seo');