Skip to content

Commit e5ca7ff

Browse files
authored
Merge pull request #6 from mobizel/feature/add-new-rules
Add trailing coma in multiline and doc align left
2 parents 54faba0 + d5f6f1d commit e5ca7ff

File tree

5 files changed

+69
-3
lines changed

5 files changed

+69
-3
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
php: [ 7.4, 8.0 ]
20+
php: [ "8.0", "8.1" ]
2121

2222
steps:
2323
- uses: actions/checkout@v2

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"description": "Battle-tested coding standard configuration used at Mobizel.",
44
"license": "MIT",
55
"require": {
6-
"php": "^7.4 || ^8.0",
7-
"symplify/easy-coding-standard": "^9.0"
6+
"php": "^8.0",
7+
"symplify/easy-coding-standard": "^10.0"
88
},
99
"autoload-dev": {
1010
"psr-4": {

ecs.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
declare(strict_types=1);
44

5+
use PhpCsFixer\Fixer\ControlStructure\TrailingCommaInMultilineFixer;
56
use PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer;
67
use PhpCsFixer\Fixer\Import\NoUnusedImportsFixer;
78
use PhpCsFixer\Fixer\Import\OrderedImportsFixer;
9+
use PhpCsFixer\Fixer\Phpdoc\PhpdocAlignFixer;
810
use PhpCsFixer\Fixer\PhpUnit\PhpUnitInternalClassFixer;
911
use PhpCsFixer\Fixer\PhpUnit\PhpUnitMethodCasingFixer;
1012
use PhpCsFixer\Fixer\PhpUnit\PhpUnitTestClassRequiresCoversFixer;
@@ -22,6 +24,15 @@
2224
$services->set(NoUnusedImportsFixer::class);
2325
$services->set(StrictComparisonFixer::class);
2426

27+
$services->set(PhpdocAlignFixer::class)
28+
->call('configure', [[
29+
'align' => 'left',
30+
'tags' => ['method', 'param', 'property', 'return', 'throws', 'type', 'var'],
31+
]]);
32+
33+
$services->set(TrailingCommaInMultilineFixer::class)
34+
->call('configure', [['elements' => ['arrays', 'arguments', 'parameters']]]);
35+
2536
$parameters = $containerConfigurator->parameters();
2637
$parameters->set('skip', [
2738
VisibilityRequiredFixer::class => ['*Spec.php'],

tests/BookFactory.php

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Soliso project.
5+
*
6+
* (c) Mobizel
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
declare(strict_types=1);
13+
14+
namespace Tests\CodingStandard;
15+
16+
use Zenstruck\Foundry\ModelFactory;
17+
use Zenstruck\Foundry\Proxy;
18+
19+
/**
20+
* @extends ModelFactory<Sample>
21+
*
22+
* @method static Sample|Proxy createOne(array $attributes = [])
23+
* @method static Sample[]|Proxy[] createMany(int $number, array|callable $attributes = [])
24+
* @method static Sample|Proxy find(object|array|mixed $criteria)
25+
* @method static Sample|Proxy findOrCreate(array $attributes)
26+
* @method static Sample|Proxy first(string $sortedField = 'id')
27+
* @method static Sample|Proxy last(string $sortedField = 'id')
28+
* @method static Sample|Proxy random(array $attributes = [])
29+
* @method static Sample|Proxy randomOrCreate(array $attributes = [])
30+
* @method static Sample[]|Proxy[] all()
31+
* @method static Sample[]|Proxy[] findBy(array $attributes)
32+
* @method static Sample[]|Proxy[] randomSet(int $number, array $attributes = [])
33+
* @method static Sample[]|Proxy[] randomRange(int $min, int $max, array $attributes = [])
34+
* @method Sample|Proxy create(array|callable $attributes = [])
35+
*/
36+
final class DealerFactory extends ModelFactory
37+
{
38+
protected function getDefaults(): array
39+
{
40+
return array_merge(parent::getDefaults(), [
41+
'company_name' => self::faker()->company(),
42+
]);
43+
}
44+
45+
protected static function getClass(): string
46+
{
47+
return Dealer::class;
48+
}
49+
}

tests/Sample.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ class Sample
88
{
99
public const BAR = 'bar';
1010

11+
public function __construct(
12+
public string $foo,
13+
public string $bar,
14+
) {
15+
}
16+
1117
public function foo(): void
1218
{
1319
}

0 commit comments

Comments
 (0)