Skip to content

Commit 3b53313

Browse files
committed
Use Laravel Pint
1 parent eff605f commit 3b53313

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+246
-218
lines changed

.github/workflows/lint.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Lint
2+
on:
3+
- push
4+
- pull_request
5+
jobs:
6+
lint:
7+
name: Lint
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v2
12+
- name: Setup PHP
13+
uses: shivammathur/setup-php@v2
14+
with:
15+
php-version: '8.0'
16+
tools: phplint, laravel/pint
17+
- name: Check syntax
18+
run: phplint .
19+
- name: Check code style
20+
run: pint --test

.github/workflows/phplint.yml

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

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"symfony/yaml": "^6.0"
1717
},
1818
"require-dev": {
19+
"laravel/pint": "^1.2",
1920
"mockery/mockery": "^1.4.4",
2021
"orchestra/testbench": "^7.0",
2122
"phpunit/phpunit": "^9.5.10"

pint.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"preset": "laravel",
3+
"rules": {
4+
"blank_line_before_statement": {
5+
"statements": ["return", "try"]
6+
},
7+
"cast_spaces": {
8+
"space": "none"
9+
},
10+
"concat_space": {
11+
"spacing": "one"
12+
},
13+
"not_operator_with_successor_space": false,
14+
"logical_operators": true
15+
},
16+
"notPath": [
17+
"tests/fixtures"
18+
]
19+
}

src/Blueprint.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
class Blueprint
1111
{
1212
private $lexers = [];
13+
1314
private $generators = [];
1415

1516
public static function relativeNamespace(string $fullyQualifiedClassName)

src/Commands/BuildCommand.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ class BuildCommand extends Command
3737
private $builder;
3838

3939
/**
40-
* @param Filesystem $filesystem
41-
* @param Builder $builder
40+
* @param Filesystem $filesystem
41+
* @param Builder $builder
4242
*/
4343
public function __construct(Filesystem $filesystem, Builder $builder)
4444
{
@@ -54,6 +54,7 @@ public function handle()
5454

5555
if (!$this->filesystem->exists($file)) {
5656
$this->error('Draft file could not be found: ' . ($file ?: 'draft.yaml'));
57+
5758
return 1;
5859
}
5960

src/Commands/EraseCommand.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use Blueprint\Blueprint;
66
use Illuminate\Console\Command;
77
use Illuminate\Filesystem\Filesystem;
8-
use Illuminate\Support\Facades\Artisan;
98

109
class EraseCommand extends Command
1110
{

src/Commands/NewCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ class NewCommand extends Command
2424
*/
2525
protected $description = 'Create a draft.yaml file and load existing models';
2626

27-
/** @var Filesystem $files */
27+
/** @var Filesystem */
2828
protected $filesystem;
2929

3030
/**
31-
* @param Filesystem $filesystem
31+
* @param Filesystem $filesystem
3232
*/
3333
public function __construct(Filesystem $filesystem)
3434
{

src/Commands/TraceCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ class TraceCommand extends Command
2626
*/
2727
protected $description = 'Create definitions for existing models to reference in new drafts';
2828

29-
/** @var Filesystem $files */
29+
/** @var Filesystem */
3030
protected $filesystem;
3131

3232
/** @var Tracer */
3333
private $tracer;
3434

3535
/**
36-
* @param Filesystem $filesystem
37-
* @param Tracer $tracer
36+
* @param Filesystem $filesystem
37+
* @param Tracer $tracer
3838
*/
3939
public function __construct(Filesystem $filesystem, Tracer $tracer)
4040
{

src/EnumType.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function getSQLDeclaration(array $column, AbstractPlatform $platform)
1818
$this->values
1919
);
2020

21-
return "ENUM(" . implode(", ", $values) . ")";
21+
return 'ENUM(' . implode(', ', $values) . ')';
2222
}
2323

2424
public function convertToPHPValue($value, AbstractPlatform $platform)
@@ -31,6 +31,7 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform)
3131
if (!in_array($value, $this->values)) {
3232
throw new \InvalidArgumentException("Invalid '" . $this->getName() . "' value.");
3333
}
34+
3435
return $value;
3536
}
3637

0 commit comments

Comments
 (0)