Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct nullable type #40

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions src/SEOManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@
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
{
Expand Down Expand Up @@ -135,7 +135,7 @@ public function raw(string $key): string|null
}

/** 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;

Expand All @@ -159,7 +159,7 @@ public function extensions(): array
}

/** 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);
Expand All @@ -185,7 +185,7 @@ public function flipp(string $alias, string|array $data = null): string|static
}

/** 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);
Expand Down Expand Up @@ -250,7 +250,7 @@ public function hasTag(string $property): bool
}

/** Add a head tag. */
public function rawTag(string $key, string $tag = null): static
public function rawTag(string $key, ?string $tag = null): static
{
$tag ??= $key;

Expand All @@ -275,7 +275,7 @@ public function tag(string $property, string $content): static
* @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 */
Expand Down
2 changes: 1 addition & 1 deletion src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
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');
Expand Down
Loading