Skip to content

Commit a597340

Browse files
authored
Merge pull request #1 from PHPOffice/phpCSFixer
Github Action : PHPCSFixer
2 parents 1da42eb + df302a6 commit a597340

24 files changed

+164
-82
lines changed

.github/workflows/php.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,30 @@ on:
66
pull_request:
77

88
jobs:
9+
php-cs-fixer:
10+
name: PHP CS Fixer
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Setup PHP
14+
uses: shivammathur/setup-php@v2
15+
with:
16+
php-version: '7.4'
17+
extensions: xml
18+
19+
- uses: actions/checkout@v2
20+
21+
- name: Validate composer config
22+
run: composer validate --strict
23+
24+
- name: Composer Install
25+
run: composer global require friendsofphp/php-cs-fixer
26+
27+
- name: Add environment path
28+
run: export PATH="$PATH:$HOME/.composer/vendor/bin"
29+
30+
- name: Run PHPCSFixer
31+
run: php-cs-fixer fix --dry-run --diff
32+
933
phpunit:
1034
name: PHPUnit
1135
runs-on: ubuntu-latest

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.php_cs.cache
12
.phpunit.cache
23
.phpunit.result.cache
34
composer.lock

.php-cs-fixer.dist.php

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
$config = new PhpCsFixer\Config();
4+
5+
$config
6+
->setUsingCache(true)
7+
->setRiskyAllowed(true)
8+
->setRules([
9+
'@Symfony' => true,
10+
'array_indentation' => true,
11+
'cast_spaces' => [
12+
'space' => 'single',
13+
],
14+
'combine_consecutive_issets' => true,
15+
'concat_space' => [
16+
'spacing' => 'one',
17+
],
18+
'error_suppression' => [
19+
'mute_deprecation_error' => false,
20+
'noise_remaining_usages' => false,
21+
'noise_remaining_usages_exclude' => [],
22+
],
23+
'function_to_constant' => false,
24+
'global_namespace_import' => true,
25+
'method_chaining_indentation' => true,
26+
'no_alias_functions' => false,
27+
'no_superfluous_phpdoc_tags' => false,
28+
'non_printable_character' => [
29+
'use_escape_sequences_in_strings' => true,
30+
],
31+
'phpdoc_align' => [
32+
'align' => 'left',
33+
],
34+
'phpdoc_summary' => false,
35+
'protected_to_private' => false,
36+
'self_accessor' => false,
37+
'yoda_style' => false,
38+
'single_line_throw' => false,
39+
'no_alias_language_construct_call' => false,
40+
])
41+
->getFinder()
42+
->in(__DIR__)
43+
->exclude('vendor');
44+
45+
return $config;

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
],
1919
"require": {
2020
"php": "^7.1|^8.0",
21-
"ext-xml": "*"
21+
"ext-xml": "*",
22+
"friendsofphp/php-cs-fixer": "^2.1"
2223
},
2324
"require-dev": {
2425
"phpunit/phpunit": ">=7.0"

src/Math/Element/AbstractElement.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ abstract class AbstractElement
88
* @var string
99
*/
1010
protected $parent;
11-
11+
1212
public function setParent($parent): self
1313
{
1414
$this->parent = $parent;
1515

1616
return $this;
1717
}
18-
18+
1919
public function getParent()
2020
{
2121
return $this->parent;
2222
}
23-
}
23+
}

src/Math/Element/AbstractGroupElement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ public function getElements(): array
3535
{
3636
return $this->elements;
3737
}
38-
}
38+
}

src/Math/Element/Fraction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ public function setNumerator(AbstractElement $element): self
3737

3838
return $this;
3939
}
40-
}
40+
}

src/Math/Element/Identifier.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ public function getValue(): string
1818
{
1919
return $this->value;
2020
}
21-
}
21+
}

src/Math/Element/Numeric.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ public function getValue(): float
1818
{
1919
return $this->value;
2020
}
21-
}
21+
}

src/Math/Element/Operator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ public function getValue(): string
1818
{
1919
return $this->value;
2020
}
21-
}
21+
}

0 commit comments

Comments
 (0)