Skip to content

Commit a67cb95

Browse files
authored
Add Laravel pint and run (#241)
* Add Laravel pint and run * StyleCI * Lower pint version requirement * Add pint lint workflow from core * Remove .styleCI.yaml
1 parent 277bf46 commit a67cb95

File tree

14 files changed

+81
-66
lines changed

14 files changed

+81
-66
lines changed

.github/workflows/pint-lint.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Lint PHP code style issues
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '**.php'
7+
8+
jobs:
9+
lint-php-code-styling:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v3
15+
16+
- name: Check PHP code style issues
17+
uses: aglipanci/[email protected]
18+
with:
19+
testMode: true
20+
verboseMode: true

.styleci.yml

Lines changed: 0 additions & 2 deletions
This file was deleted.

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
},
3030
"require-dev": {
3131
"doctrine/dbal": "^3.3",
32+
"laravel/pint": "^1.0",
3233
"orchestra/testbench": "^7.0 || ^8.0",
3334
"phpunit/phpunit": "^9.4"
3435
},

src/Assets/Asset.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ public function metaExists()
7575
{
7676
return Blink::once('eloquent-asset-meta-exists-'.$this->id(), function () {
7777
return app('statamic.eloquent.assets.model')::query()
78-
->where([
79-
'container' => $this->containerHandle(),
80-
'folder' => $this->folder(),
81-
'basename' => $this->basename(),
82-
])->count() > 0;
78+
->where([
79+
'container' => $this->containerHandle(),
80+
'folder' => $this->folder(),
81+
'basename' => $this->basename(),
82+
])->count() > 0;
8383
});
8484
}
8585

src/Assets/AssetContainerRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function findByHandle(string $handle): ?AssetContainerContract
3636
});
3737
}
3838

39-
public function make(string $handle = null): AssetContainerContract
39+
public function make(?string $handle = null): AssetContainerContract
4040
{
4141
return app(AssetContainerContract::class)->handle($handle);
4242
}

src/Database/BaseMigration.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ public function getConnection()
2222

2323
/**
2424
* Prefixes table if defined.
25-
*
26-
* @param string $table
27-
* @return string
2825
*/
2926
protected function prefix(string $table): string
3027
{

src/Entries/EntryRepository.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public static function bindings(): array
1313
{
1414
return [
1515
EntryContract::class => app('statamic.eloquent.entries.entry'),
16-
QueryBuilder::class => EntryQueryBuilder::class,
16+
QueryBuilder::class => EntryQueryBuilder::class,
1717
];
1818
}
1919

@@ -33,7 +33,7 @@ public function find($id): ?EntryContract
3333
return $this->substitutionsById[$item->id()] ?? $item;
3434
}
3535

36-
public function findByUri(string $uri, string $site = null): ?EntryContract
36+
public function findByUri(string $uri, ?string $site = null): ?EntryContract
3737
{
3838
$blinkKey = 'eloquent-entry-'.md5(urlencode($uri)).($site ? '-'.$site : '');
3939
$item = Blink::once($blinkKey, function () use ($uri, $site) {

src/Globals/GlobalVariablesRepository.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ public function all(): VariablesCollection
1313
{
1414
return VariablesCollection::make(
1515
VariablesModel::all()
16-
->each(function ($model) {
17-
return app(Variables::class)::fromModel($model);
18-
})
16+
->each(function ($model) {
17+
return app(Variables::class)::fromModel($model);
18+
})
1919
);
2020
}
2121

src/Taxonomies/TaxonomyRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function findByHandle($handle): ?TaxonomyContract
4646
return $taxonomyModel ? app(TaxonomyContract::class)->fromModel($taxonomyModel) : null;
4747
}
4848

49-
public function findByUri(string $uri, string $site = null): ?Taxonomy
49+
public function findByUri(string $uri, ?string $site = null): ?Taxonomy
5050
{
5151
$collection = Facades\Collection::all()
5252
->first(function ($collection) use ($uri, $site) {

src/Taxonomies/TermRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function find($id): ?TermContract
4040
return $term;
4141
}
4242

43-
public function findByUri(string $uri, string $site = null): ?TermContract
43+
public function findByUri(string $uri, ?string $site = null): ?TermContract
4444
{
4545
$site = $site ?? $this->stache->sites()->first();
4646

0 commit comments

Comments
 (0)