Skip to content
This repository was archived by the owner on Mar 12, 2024. It is now read-only.

Commit dae91e3

Browse files
Merge pull request #1 from michael-rubel/styling/pint
Use `Laravel Pint` instead of `PHP_CodeSniffer`
2 parents cd593be + 0ace9ab commit dae91e3

13 files changed

+71
-108
lines changed

.github/workflows/phpstan.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ on:
77
branches: [main]
88

99
jobs:
10-
psalm:
11-
name: phpstan
10+
larastan:
11+
name: "Running Larastan check"
1212
runs-on: ubuntu-latest
1313
steps:
1414
- uses: actions/checkout@v2
@@ -17,7 +17,7 @@ jobs:
1717
uses: shivammathur/setup-php@v2
1818
with:
1919
php-version: '8.0'
20-
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
20+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv
2121
coverage: none
2222

2323
- name: Cache composer dependencies
Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
1-
name: php-code-sniffer
2-
1+
name: "Laravel Pint"
32
on:
4-
push:
5-
branches:
6-
- main
73
pull_request:
8-
branches:
9-
- main
4+
types: [opened, synchronize, reopened, ready_for_review]
105

116
jobs:
12-
psalm:
13-
name: phpcs
7+
pint:
8+
name: "Running Laravel Pint check"
149
runs-on: ubuntu-latest
10+
if: github.event.pull_request.draft == false
1511
steps:
1612
- uses: actions/checkout@v2
1713

1814
- name: Setup PHP
1915
uses: shivammathur/setup-php@v2
2016
with:
2117
php-version: '8.1'
22-
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
18+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, intl, gd, exif, iconv
2319
coverage: none
2420

2521
- name: Cache composer dependencies
@@ -31,5 +27,5 @@ jobs:
3127
- name: Run composer install
3228
run: composer install -n --prefer-dist
3329

34-
- name: Run phpcs
35-
run: ./vendor/bin/phpcs
30+
- name: Run Laravel Pint
31+
run: ./vendor/bin/pint --test

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121
"spatie/laravel-package-tools": "^1.9"
2222
},
2323
"require-dev": {
24+
"brianium/paratest": "^6.3",
25+
"laravel/pint": "^0.2.1",
26+
"mockery/mockery": "^1.4.4",
2427
"nunomaduro/collision": "^5.10|^6.0",
2528
"nunomaduro/larastan": "^1.0",
26-
"phpunit/phpunit": "^9.5",
2729
"orchestra/testbench": "^6.6|^7.0",
28-
"brianium/paratest": "^6.3",
29-
"mockery/mockery": "^1.4.4",
30-
"squizlabs/php_codesniffer": "^3.6"
30+
"phpunit/phpunit": "^9.5"
3131
},
3232
"autoload": {
3333
"psr-4": {

phpcs.xml

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

pint.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"preset": "laravel",
3+
"rules": {
4+
"Laravel/laravel_phpdoc_separation": false,
5+
"concat_space": {
6+
"spacing": "one"
7+
}
8+
}
9+
}

src/LoopFunctionServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class LoopFunctionServiceProvider extends PackageServiceProvider
1212
/**
1313
* Configure the package.
1414
*
15-
* @param Package $package
15+
* @param Package $package
1616
*
1717
* @return void
1818
*/

src/Traits/HelpsLoopFunctions.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ trait HelpsLoopFunctions
99
/**
1010
* Assign the value to the property or rescue.
1111
*
12-
* @param int|string $key
13-
* @param mixed $value
14-
* @param mixed|null $rescue
12+
* @param int|string $key
13+
* @param mixed $value
14+
* @param mixed|null $rescue
1515
*
1616
* @return void
1717
* @throws \ReflectionException
@@ -28,7 +28,7 @@ private function assignValue(int|string $key, mixed $value, mixed $rescue = null
2828
}
2929

3030
/**
31-
* @param int|string $key
31+
* @param int|string $key
3232
*
3333
* @return bool
3434
* @throws \ReflectionException
@@ -41,7 +41,7 @@ private function canAssignValue(int|string $key): bool
4141
}
4242

4343
/**
44-
* @param int|string $key
44+
* @param int|string $key
4545
*
4646
* @return bool
4747
*/
@@ -55,7 +55,7 @@ private function checksPropertyExists(int|string $key): bool
5555
}
5656

5757
/**
58-
* @param int|string $key
58+
* @param int|string $key
5959
*
6060
* @return bool
6161
* @throws \ReflectionException
@@ -69,7 +69,7 @@ private function hasDefaultValue(int|string $key): bool
6969
}
7070

7171
/**
72-
* @param mixed $value
72+
* @param mixed $value
7373
*
7474
* @return bool
7575
*/

src/Traits/LoopFunctions.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ trait LoopFunctions
1414
/**
1515
* Choose proper strategy to loop over the data.
1616
*
17-
* @param Model|\ArrayAccess|array|null $data
18-
* @param mixed|null $rescue
17+
* @param Model|\ArrayAccess|array|null $data
18+
* @param mixed|null $rescue
1919
*
2020
* @return void
2121
*/
@@ -32,8 +32,8 @@ public function propertiesFrom(Model|\ArrayAccess|array|null $data = null, mixed
3232
/**
3333
* Maps your model attributes to local class properties.
3434
*
35-
* @param Model|null $model
36-
* @param mixed $rescue
35+
* @param Model|null $model
36+
* @param mixed $rescue
3737
*
3838
* @return void
3939
*/
@@ -53,8 +53,8 @@ public function attributesToProperties(?Model $model = null, mixed $rescue = nul
5353
/**
5454
* Map array data to class properties.
5555
*
56-
* @param array|\ArrayAccess|null $data
57-
* @param mixed|null $rescue
56+
* @param array|\ArrayAccess|null $data
57+
* @param mixed|null $rescue
5858
*
5959
* @return void
6060
*/
@@ -74,9 +74,9 @@ public function arrayToProperties(array|\ArrayAccess|null $data, mixed $rescue =
7474
/**
7575
* Dump class properties as key-valued array.
7676
*
77-
* @param string|object|null $class
78-
* @param int|null $filter
79-
* @param bool $asCollection
77+
* @param string|object|null $class
78+
* @param int|null $filter
79+
* @param bool $asCollection
8080
*
8181
* @return array|Collection
8282
* @throws \ReflectionException

src/Traits/WithDynamicProperties.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
trait WithDynamicProperties
66
{
77
/**
8-
* @param string $name
8+
* @param string $name
99
*
1010
* @return mixed
1111
*/
@@ -15,8 +15,8 @@ public function __get(string $name): mixed
1515
}
1616

1717
/**
18-
* @param string $name
19-
* @param mixed $value
18+
* @param string $name
19+
* @param mixed $value
2020
*
2121
* @return void
2222
*/

tests/ArrayMappingTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,17 @@ class ArrayMappingTest extends TestCase
1111
use LoopFunctions;
1212

1313
public bool $test = false;
14+
1415
public ?string $name = null;
16+
1517
public ?string $password = null;
18+
1619
public ?array $additional_data = [];
20+
1721
public ?array $array = [];
22+
1823
public ?Collection $supportCollection = null;
24+
1925
public ?EloquentCollection $eloquentCollection = null;
2026

2127
public function setUp(): void
@@ -76,7 +82,6 @@ public function testAlreadyInitializedPropertiesArentOverridenByNestedArrays()
7682
],
7783
];
7884

79-
8085
$this->arrayToProperties($array);
8186

8287
$this->assertStringContainsString('Michael', $this->name);

0 commit comments

Comments
 (0)