Skip to content

Commit

Permalink
install pint and format
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinGab committed May 25, 2024
1 parent 703486d commit 0743d45
Show file tree
Hide file tree
Showing 11 changed files with 70 additions and 77 deletions.
84 changes: 43 additions & 41 deletions composer.json
Original file line number Diff line number Diff line change
@@ -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" : "[email protected]",
"role" : "Developer"
"name": "Ralph J. Smit",
"email": "[email protected]",
"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
}
5 changes: 1 addition & 4 deletions src/Schema/CustomSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand Down
13 changes: 6 additions & 7 deletions src/SchemaCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

/**
* @template TKey of array-key
*
*
* @extends Collection<TKey, iterable|Arrayable|(Closure(SEOData $SEOData):iterable|Arrayable)>
*/
class SchemaCollection extends Collection
Expand Down Expand Up @@ -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([
Expand Down Expand Up @@ -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([
Expand All @@ -89,7 +89,7 @@ function withBreadcrumbList(null|array|Closure $builder = null): static
'name' => $SEOData->title,
'item' => $SEOData->url,
'position' => 1,
]
],
]),
]);

Expand All @@ -107,7 +107,6 @@ function withBreadcrumbList(null|array|Closure $builder = null): static
);
}


return $schema->filter();
});
}
Expand Down
3 changes: 1 addition & 2 deletions src/Support/SchemaTagCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -15,7 +14,7 @@ public static function initialize(?SEOData $SEOData = null): ?static
{
$schemas = $SEOData?->schema;

if (!$schemas) {
if (! $schemas) {
return null;
}

Expand Down
1 change: 0 additions & 1 deletion src/Support/SitemapTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class SitemapTag extends LinkTag
'title' => 'Sitemap',
];


public function __construct(
string $href
) {
Expand Down
2 changes: 1 addition & 1 deletion src/Support/Tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];

Expand Down
2 changes: 1 addition & 1 deletion src/Tags/DescriptionTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public static function initialize(?SEOData $SEOData): ?MetaTag
{
$description = $SEOData?->description;

if (!$description) {
if (! $description) {
return null;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Tags/TitleTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static function initialize(?SEOData $SEOData): ?Tag
{
$title = $SEOData?->title;

if (!$title) {
if (! $title) {
return null;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/JSON-LD/ArticleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
15 changes: 7 additions & 8 deletions tests/Feature/JSON-LD/SchemaCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
[
'@type' => 'Person',
'name' => $SEOData->author,
]
],
],
]),
];
Expand All @@ -70,7 +70,7 @@
[
'@type' => 'Person',
'name' => 'Ralph J. Smit',
]
],
],
]) . '</script>',
false
Expand All @@ -97,8 +97,8 @@
[
'@type' => 'Person',
'name' => 'Second author',
]
]
],
],
]);
}),
];
Expand Down Expand Up @@ -134,7 +134,6 @@
);
});


it('can correctly render the JSON-LD Schema markup: BreadcrumbList', function () {
config()->set('seo.title.suffix', ' | Laravel SEO');

Expand Down Expand Up @@ -165,7 +164,7 @@
'@type' => 'ListItem',
'name' => 'Subarticle',
'item' => 'https://example.com/test/article/2',
]
],
],
);

Expand Down Expand Up @@ -241,7 +240,7 @@
[
'@type' => 'Person',
'name' => $SEOData->author,
]
],
],
]),
];
Expand All @@ -264,7 +263,7 @@
[
'@type' => 'Person',
'name' => 'Ralph J. Smit',
]
],
],
]) . '</script>',
false
Expand Down
18 changes: 8 additions & 10 deletions tests/Unit/Support/TagTest.php
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
<?php

use RalphJSmit\Laravel\SEO\Support\LinkTag;
use RalphJSmit\Laravel\SEO\Support\MetaTag;
use RalphJSmit\Laravel\SEO\Support\Tag;

it('orders tag attributes', function () {
$tag = new class extends Tag
{
public string $tag = "link";
public string $tag = 'link';
};

$tag->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())
Expand Down

0 comments on commit 0743d45

Please sign in to comment.