Skip to content

Commit

Permalink
Fix linters
Browse files Browse the repository at this point in the history
  • Loading branch information
romanzipp committed Jul 9, 2024
1 parent 9607730 commit 88ebaf6
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ See the [Schema.org integration docs](/schema-org.html) for more information.
| `seo()->charset()` | `<meta charset="utf-8" />` |
| `seo()->viewport()` | `<meta name="viewport" content="width=device-width, ..." />` |
| `seo()->csrfToken()` | `<meta name="csrf-token" content="..." />` |
| `seo()->jsonLd([...])` | `<script type="application/ld+json">...</scrit>` |
| `seo()->ldJson([...])` | `<script type="application/ld+json">...</scrit>` |
| **Adding Structs** | |
| `seo()->add(...)` | `<meta name="foo" />` |
| `seo()->addMany([...])` | `<meta name="foo" />` |
Expand Down
2 changes: 1 addition & 1 deletion docs/structs.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ seo()->add(
### JSON-LD

```php
seo()->jsonLd(array $data, bool $pretty = false);
seo()->ldJson(array $data, bool $pretty = false);
```

<details>
Expand Down
6 changes: 3 additions & 3 deletions src/Services/Traits/ShorthandSetterTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,12 @@ public function csrfToken(string $token = null): self
*
* @see https://developers.google.com/search/docs/appearance/structured-data/intro-structured-data
*
* @param array $structuredData
* @param array<string, array|string> $structuredData
* @param bool $pretty
*
* @return \romanzipp\Seo\Services\Traits\ShorthandSetterTrait|\romanzipp\Seo\Services\SeoService
* @return $this
*/
public function jsonLd(array $structuredData, bool $pretty = false): self
public function ldJson(array $structuredData, bool $pretty = false): self
{
return $this->add(
LinkedData::make()->data($structuredData, $pretty)
Expand Down
6 changes: 6 additions & 0 deletions src/Structs/LinkedData.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ protected function tag(): string
return 'script';
}

/**
* @param array<string, array|string> $structuredData
* @param bool $pretty
*
* @return $this
*/
public function data(array $structuredData, bool $pretty = false): self

Check failure on line 23 in src/Structs/LinkedData.php

View workflow job for this annotation

GitHub Actions / phpstan

Method romanzipp\Seo\Structs\LinkedData::data() has parameter $structuredData with no value type specified in iterable type array.

Check failure on line 23 in src/Structs/LinkedData.php

View workflow job for this annotation

GitHub Actions / phpstan

Method romanzipp\Seo\Structs\LinkedData::data() has parameter $structuredData with no value type specified in iterable type array.
{
$this->body(
Expand Down
2 changes: 1 addition & 1 deletion tests/ShorthandSettersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public function testCanonicalSetter()

public function testLinkedDataSetter()
{
seo()->jsonLd(['@context' => 'https://schema.org/']);
seo()->ldJson(['@context' => 'https://schema.org/']);

$contents = seo()->render()->toArray();

Expand Down
1 change: 1 addition & 0 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public static function assertMatchesRegularExpressionCustom(string $pattern, str
// If parent has method assertMatchesRegularExpression, call it
if (method_exists(BaseTestCase::class, 'assertMatchesRegularExpression')) {
parent::assertMatchesRegularExpression($pattern, $string, $message);

return;
}

Expand Down

0 comments on commit 88ebaf6

Please sign in to comment.