From 0743d45204b16f25ca512fa22b9f95bf76e10a8a Mon Sep 17 00:00:00 2001 From: Quentin Gabriele Date: Sat, 25 May 2024 22:23:46 +0200 Subject: [PATCH] install pint and format --- composer.json | 84 ++++++++++--------- src/Schema/CustomSchema.php | 5 +- src/SchemaCollection.php | 13 ++- src/Support/SchemaTagCollection.php | 3 +- src/Support/SitemapTag.php | 1 - src/Support/Tag.php | 2 +- src/Tags/DescriptionTag.php | 2 +- src/Tags/TitleTag.php | 2 +- tests/Feature/JSON-LD/ArticleTest.php | 2 +- .../Feature/JSON-LD/SchemaCollectionTest.php | 15 ++-- tests/Unit/Support/TagTest.php | 18 ++-- 11 files changed, 70 insertions(+), 77 deletions(-) diff --git a/composer.json b/composer.json index 4b81210..7cb26e0 100644 --- a/composer.json +++ b/composer.json @@ -1,70 +1,72 @@ { - "name" : "ralphjsmit/laravel-seo", - "description" : "A package to handle the SEO in any Laravel application, big or small.", - "keywords" : [ + "name": "ralphjsmit/laravel-seo", + "description": "A package to handle the SEO in any Laravel application, big or small.", + "keywords": [ "ralphjsmit", "laravel", "laravel-seo" ], - "homepage" : "https://github.com/ralphjsmit/laravel-seo", - "license" : "MIT", - "authors" : [ + "homepage": "https://github.com/ralphjsmit/laravel-seo", + "license": "MIT", + "authors": [ { - "name" : "Ralph J. Smit", - "email" : "rjs@ralphjsmit.com", - "role" : "Developer" + "name": "Ralph J. Smit", + "email": "rjs@ralphjsmit.com", + "role": "Developer" } ], - "require" : { + "require": { "php": "^8.0", "illuminate/contracts": "^9.0|^10.0|^11.0", "ralphjsmit/laravel-helpers": "^1.9", "spatie/laravel-package-tools": "^1.9.2" }, - "require-dev" : { - "nesbot/carbon" : "^2.66|^3.0", - "nunomaduro/collision" : "^5.10|^6.0|^7.0|^8.0", - "orchestra/testbench" : "^7.0|^8.0|^9.0", - "pestphp/pest" : "^1.21|^2.0", - "pestphp/pest-plugin-laravel" : "^1.1|^2.0", - "phpunit/phpunit" : "^9.5|^10.5", - "spatie/laravel-ray" : "^1.26", - "spatie/pest-plugin-test-time" : "^1.0|^2.0" + "require-dev": { + "laravel/pint": "^1.16", + "nesbot/carbon": "^2.66|^3.0", + "nunomaduro/collision": "^5.10|^6.0|^7.0|^8.0", + "orchestra/testbench": "^7.0|^8.0|^9.0", + "pestphp/pest": "^1.21|^2.0", + "pestphp/pest-plugin-laravel": "^1.1|^2.0", + "phpunit/phpunit": "^9.5|^10.5", + "spatie/laravel-ray": "^1.26", + "spatie/pest-plugin-test-time": "^1.0|^2.0" }, - "autoload" : { - "psr-4" : { - "RalphJSmit\\Laravel\\SEO\\" : "src", - "RalphJSmit\\Laravel\\SEO\\Database\\Factories\\" : "database/factories" + "autoload": { + "psr-4": { + "RalphJSmit\\Laravel\\SEO\\": "src", + "RalphJSmit\\Laravel\\SEO\\Database\\Factories\\": "database/factories" }, - "files" : [ + "files": [ "src/helpers.php" ] }, - "autoload-dev" : { - "psr-4" : { - "RalphJSmit\\Laravel\\SEO\\Tests\\" : "tests" + "autoload-dev": { + "psr-4": { + "RalphJSmit\\Laravel\\SEO\\Tests\\": "tests" } }, - "scripts" : { - "test" : "vendor/bin/pest", - "test-coverage" : "vendor/bin/pest --coverage" + "scripts": { + "test": "vendor/bin/pest", + "test-coverage": "vendor/bin/pest --coverage", + "format": "vendor/bin/pint" }, - "config" : { - "sort-packages" : true, - "allow-plugins" : { - "pestphp/pest-plugin" : true + "config": { + "sort-packages": true, + "allow-plugins": { + "pestphp/pest-plugin": true } }, - "extra" : { - "laravel" : { - "providers" : [ + "extra": { + "laravel": { + "providers": [ "RalphJSmit\\Laravel\\SEO\\LaravelSEOServiceProvider" ], - "aliases" : { - "SEOManager" : "RalphJSmit\\Laravel\\SEO\\Facades\\SEOManager" + "aliases": { + "SEOManager": "RalphJSmit\\Laravel\\SEO\\Facades\\SEOManager" } } }, - "minimum-stability" : "dev", - "prefer-stable" : true + "minimum-stability": "dev", + "prefer-stable": true } diff --git a/src/Schema/CustomSchema.php b/src/Schema/CustomSchema.php index 0a62668..af87577 100644 --- a/src/Schema/CustomSchema.php +++ b/src/Schema/CustomSchema.php @@ -2,12 +2,9 @@ namespace RalphJSmit\Laravel\SEO\Schema; -use Closure; use Illuminate\Contracts\Support\Arrayable; -use Illuminate\Support\Collection; use Illuminate\Support\HtmlString; use RalphJSmit\Helpers\Laravel\Pipe\Pipeable; -use RalphJSmit\Laravel\SEO\Support\SEOData; use RalphJSmit\Laravel\SEO\Support\Tag; class CustomSchema extends Tag @@ -20,7 +17,7 @@ class CustomSchema extends Tag 'type' => 'application/ld+json', ]; - function __construct(iterable|Arrayable $inner) + public function __construct(iterable | Arrayable $inner) { $this->inner = new HtmlString( collect($inner)->toJson() diff --git a/src/SchemaCollection.php b/src/SchemaCollection.php index 75384ca..ec48479 100644 --- a/src/SchemaCollection.php +++ b/src/SchemaCollection.php @@ -13,7 +13,7 @@ /** * @template TKey of array-key - * + * * @extends Collection */ class SchemaCollection extends Collection @@ -44,9 +44,9 @@ public function addBreadcrumbs(?Closure $builder = null): static } /** - * @param null|(Closure(SEOData $SEOData, Collection $article): Collection) $builder + * @param null|(Closure(SEOData $SEOData, Collection $article): Collection) $builder */ - function withArticle(null|array|Closure $builder = null): static + public function withArticle(null | array | Closure $builder = null): static { return $this->add(function (SEOData $SEOData) use ($builder) { $schema = collect([ @@ -75,9 +75,9 @@ function withArticle(null|array|Closure $builder = null): static } /** - * @param null|(Closure(SEOData $SEOData, Collection $breadcrumbList): Collection) $builder + * @param null|(Closure(SEOData $SEOData, Collection $breadcrumbList): Collection) $builder */ - function withBreadcrumbList(null|array|Closure $builder = null): static + public function withBreadcrumbList(null | array | Closure $builder = null): static { return $this->add(function (SEOData $SEOData) use ($builder) { $schema = collect([ @@ -89,7 +89,7 @@ function withBreadcrumbList(null|array|Closure $builder = null): static 'name' => $SEOData->title, 'item' => $SEOData->url, 'position' => 1, - ] + ], ]), ]); @@ -107,7 +107,6 @@ function withBreadcrumbList(null|array|Closure $builder = null): static ); } - return $schema->filter(); }); } diff --git a/src/Support/SchemaTagCollection.php b/src/Support/SchemaTagCollection.php index 3546868..1f90de8 100644 --- a/src/Support/SchemaTagCollection.php +++ b/src/Support/SchemaTagCollection.php @@ -2,7 +2,6 @@ namespace RalphJSmit\Laravel\SEO\Support; -use Closure; use Illuminate\Contracts\Support\Renderable; use Illuminate\Support\Collection; use RalphJSmit\Laravel\SEO\Schema\CustomSchema; @@ -15,7 +14,7 @@ public static function initialize(?SEOData $SEOData = null): ?static { $schemas = $SEOData?->schema; - if (!$schemas) { + if (! $schemas) { return null; } diff --git a/src/Support/SitemapTag.php b/src/Support/SitemapTag.php index e04fa6c..c55944a 100644 --- a/src/Support/SitemapTag.php +++ b/src/Support/SitemapTag.php @@ -10,7 +10,6 @@ class SitemapTag extends LinkTag 'title' => 'Sitemap', ]; - public function __construct( string $href ) { diff --git a/src/Support/Tag.php b/src/Support/Tag.php index ccd20a0..838648a 100644 --- a/src/Support/Tag.php +++ b/src/Support/Tag.php @@ -27,7 +27,7 @@ abstract class Tag implements Renderable /** * The content of the tag */ - public null|string|HtmlString $inner = null; + public null | string | HtmlString $inner = null; public array $attributesPipeline = []; diff --git a/src/Tags/DescriptionTag.php b/src/Tags/DescriptionTag.php index 6b1e5df..caed7f3 100644 --- a/src/Tags/DescriptionTag.php +++ b/src/Tags/DescriptionTag.php @@ -11,7 +11,7 @@ public static function initialize(?SEOData $SEOData): ?MetaTag { $description = $SEOData?->description; - if (!$description) { + if (! $description) { return null; } diff --git a/src/Tags/TitleTag.php b/src/Tags/TitleTag.php index 843617d..64793d5 100644 --- a/src/Tags/TitleTag.php +++ b/src/Tags/TitleTag.php @@ -19,7 +19,7 @@ public static function initialize(?SEOData $SEOData): ?Tag { $title = $SEOData?->title; - if (!$title) { + if (! $title) { return null; } diff --git a/tests/Feature/JSON-LD/ArticleTest.php b/tests/Feature/JSON-LD/ArticleTest.php index 276e873..53352d9 100644 --- a/tests/Feature/JSON-LD/ArticleTest.php +++ b/tests/Feature/JSON-LD/ArticleTest.php @@ -7,7 +7,7 @@ use function Pest\Laravel\get; beforeEach(function () { - if (!file_exists($dir = public_path('images'))) { + if (! file_exists($dir = public_path('images'))) { mkdir($dir, 0777, true); } diff --git a/tests/Feature/JSON-LD/SchemaCollectionTest.php b/tests/Feature/JSON-LD/SchemaCollectionTest.php index a51e476..98860a7 100644 --- a/tests/Feature/JSON-LD/SchemaCollectionTest.php +++ b/tests/Feature/JSON-LD/SchemaCollectionTest.php @@ -48,7 +48,7 @@ [ '@type' => 'Person', 'name' => $SEOData->author, - ] + ], ], ]), ]; @@ -70,7 +70,7 @@ [ '@type' => 'Person', 'name' => 'Ralph J. Smit', - ] + ], ], ]) . '', false @@ -97,8 +97,8 @@ [ '@type' => 'Person', 'name' => 'Second author', - ] - ] + ], + ], ]); }), ]; @@ -134,7 +134,6 @@ ); }); - it('can correctly render the JSON-LD Schema markup: BreadcrumbList', function () { config()->set('seo.title.suffix', ' | Laravel SEO'); @@ -165,7 +164,7 @@ '@type' => 'ListItem', 'name' => 'Subarticle', 'item' => 'https://example.com/test/article/2', - ] + ], ], ); @@ -241,7 +240,7 @@ [ '@type' => 'Person', 'name' => $SEOData->author, - ] + ], ], ]), ]; @@ -264,7 +263,7 @@ [ '@type' => 'Person', 'name' => 'Ralph J. Smit', - ] + ], ], ]) . '', false diff --git a/tests/Unit/Support/TagTest.php b/tests/Unit/Support/TagTest.php index 229d327..cde0dcc 100644 --- a/tests/Unit/Support/TagTest.php +++ b/tests/Unit/Support/TagTest.php @@ -1,26 +1,24 @@ attributes = [ - 'hreflang' => "hreflang", - 'description' => "description", + 'hreflang' => 'hreflang', + 'description' => 'description', 'title' => 'title', - 'content' => "content", + 'content' => 'content', 'name' => 'name', 'href' => 'href', - 'foo' => "foo", - 'property' => "property", - 'bar' => "bar", - 'rel' => "rel", + 'foo' => 'foo', + 'property' => 'property', + 'bar' => 'bar', + 'rel' => 'rel', ]; expect((string) $tag->render())