Skip to content

Commit d78fd77

Browse files
committed
feature: setup mago foramtter / linter, removed cs-fixer rector
1 parent f2e7440 commit d78fd77

22 files changed

Lines changed: 165 additions & 3794 deletions

.github/workflows/job-static-analyze.yml

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,8 @@ jobs:
2828

2929
- name: "Create cache directories"
3030
run: |
31-
mkdir -p var/cs-fixer
3231
mkdir -p var/phpstan/cache
3332
34-
- name: "Cache cs-fixer results"
35-
uses: "actions/cache@v5"
36-
with:
37-
path: "var/cs-fixer"
38-
key: "php-${{ matrix.php-version }}-cache-cs-fixer-${{ github.run_id }}"
39-
restore-keys: |
40-
php-${{ matrix.php-version }}-cache-cs-fixer-
41-
4233
- name: "Cache phpstan results"
4334
uses: "actions/cache@v5"
4435
with:
@@ -50,11 +41,8 @@ jobs:
5041
- name: "Monorepo Validate"
5142
run: "composer test:monorepo"
5243

53-
- name: "Static Analyze - CS Fixer"
54-
run: "composer static:analyze:cs-fixer"
44+
- name: "Static Analyze - Mago"
45+
run: "composer static:analyze:mago"
5546

5647
- name: "Static Analyze - PHPStan"
57-
run: "composer static:analyze:phpstan -- --error-format=github"
58-
59-
- name: "Static Analyze - Rector"
60-
run: "composer static:analyze:rector"
48+
run: "composer static:analyze:phpstan -- --error-format=github"

.php-cs-fixer.php

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

composer.json

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -339,24 +339,19 @@
339339
"test:monorepo": "tools/monorepo/vendor/bin/monorepo-builder validate",
340340
"static:analyze": [
341341
"./tools/monorepo/vendor/bin/monorepo-builder validate",
342-
"@static:analyze:cs-fixer",
343-
"@static:analyze:phpstan",
344-
"@static:analyze:rector"
342+
"@static:analyze:mago",
343+
"@static:analyze:phpstan"
345344
],
346345
"static:analyze:phpstan": [
347346
"tools/phpstan/vendor/bin/phpstan analyze -c phpstan.neon --memory-limit=-1"
348347
],
349-
"static:analyze:rector": [
350-
"tools/rector/vendor/bin/rector -c ./rector.tests.php --dry-run",
351-
"tools/rector/vendor/bin/rector -c ./rector.src.php --dry-run"
352-
],
353-
"static:analyze:cs-fixer": [
354-
"tools/cs-fixer/vendor/bin/php-cs-fixer fix --dry-run"
348+
"static:analyze:mago": [
349+
"tools/mago/vendor/bin/mago format --check",
350+
"tools/mago/vendor/bin/mago lint"
355351
],
356352
"cs:php:fix": [
357-
"tools/cs-fixer/vendor/bin/php-cs-fixer fix",
358-
"./tools/rector/vendor/bin/rector -c ./rector.src.php",
359-
"./tools/rector/vendor/bin/rector -c ./rector.tests.php"
353+
"tools/mago/vendor/bin/mago format",
354+
"tools/mago/vendor/bin/mago lint --fix"
360355
],
361356
"build:phar": [
362357
"bin/build-phar.sh",
@@ -448,23 +443,21 @@
448443
"tools:install": [
449444
"composer install --working-dir=./tools/blackfire",
450445
"composer install --working-dir=./tools/box",
451-
"composer install --working-dir=./tools/cs-fixer",
452446
"composer install --working-dir=./tools/infection",
447+
"composer install --working-dir=./tools/mago",
453448
"composer install --working-dir=./tools/monorepo",
454449
"composer install --working-dir=./tools/phpstan",
455450
"composer install --working-dir=./tools/phpunit",
456-
"composer install --working-dir=./tools/rector",
457451
"composer install --working-dir=./tools/phpdocumentor"
458452
],
459453
"tools:update": [
460454
"composer update --working-dir=./tools/blackfire",
461455
"composer update --working-dir=./tools/box",
462-
"composer update --working-dir=./tools/cs-fixer",
463456
"composer update --working-dir=./tools/infection",
457+
"composer update --working-dir=./tools/mago",
464458
"composer update --working-dir=./tools/monorepo",
465459
"composer update --working-dir=./tools/phpstan",
466460
"composer update --working-dir=./tools/phpunit",
467-
"composer update --working-dir=./tools/rector",
468461
"composer update --working-dir=./tools/phpdocumentor"
469462
]
470463
}

documentation/contributing/environment.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ If you want to first check what needs to be fixed, you can use:
5959

6060

6161
```shell
62-
composer static:analyze:cs-fixer
63-
composer static:analyze:rector
62+
composer static:analyze:mago
6463
```
6564

6665
## Test everything

documentation/contributing/guidelines.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ There are several tools used in this project to help with development, testing,
119119
Most of them are available as Composer scripts, so you can run them using `composer <script-name>`.
120120

121121
- `composer static:analyze` runs static analysis tools like PHPStan to check the code for errors and potential issues.
122-
- `composer cs:php:fix` runs the PHP CS Fixer and Rector to automatically fix coding standards issues in the code.
122+
- `composer cs:php:fix` runs Mago to automatically fix coding standards and lint issues in the code.
123123
- `composer test` runs all tests in the project, including unit tests, functional tests, and integration tests. It's
124124
a combination of all other test commands:
125125
- `composer test:core`
@@ -137,7 +137,7 @@ Most of them are available as Composer scripts, so you can run them using `compo
137137
# Coding Standards
138138

139139
The whole project is developed as an object oriented code, with a focus on clean code principles.
140-
The coding standards are defined and automatically enforced by the PHP CS Fixer and Rector.
140+
The coding standards are defined and automatically enforced by Mago.
141141

142142
Each package comes with a DSL (Domain Specific Language) that provides an easy, functional API.
143143
All functions defined in DSL (usually in `functions.php` files) are following the same codding standards as PHP code.

mago.toml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
php-version = "8.3"
2+
3+
[source]
4+
paths = [
5+
"bin",
6+
"src",
7+
"web/landing/bin",
8+
"web/landing/src",
9+
"web/landing/tests",
10+
]
11+
excludes = [
12+
"**/vendor/**",
13+
"**/var/**",
14+
"**/extension/*/ext/build/**",
15+
"**/extension/*/ext/run-tests.php",
16+
]
17+
18+
[parser]
19+
enable-short-tags = false
20+
21+
[linter]
22+
integrations = ["symfony", "phpunit"]
23+
24+
[linter.rules]
25+
cyclomatic-complexity = { enabled = false }
26+
excessive-nesting = { enabled = false }
27+
excessive-parameter-list = { enabled = false }
28+
halstead = { enabled = false }
29+
kan-defect = { enabled = false }
30+
too-many-enum-cases = { enabled = false }
31+
too-many-methods = { enabled = false }
32+
too-many-properties = { enabled = false }
33+
class-name = { enabled = false }
34+
constant-name = { enabled = false }
35+
enum-name = { enabled = false }
36+
file-name = { enabled = false }
37+
function-name = { enabled = false }
38+
interface-name = { enabled = false }
39+
trait-name = { enabled = false }
40+
single-class-per-file = { enabled = false }
41+
no-boolean-flag-parameter = { enabled = false }
42+
literal-named-argument = { enabled = false }
43+
tagged-fixme = { enabled = false }
44+
tagged-todo = { enabled = false }
45+
prefer-static-closure = { enabled = false }
46+
prefer-arrow-function = { enabled = false }
47+
prefer-early-continue = { enabled = false }
48+
no-else-clause = { enabled = false }
49+
no-hash-comment = { enabled = false }
50+
no-empty-catch-clause = { enabled = false }
51+
no-isset = { enabled = false }
52+
no-nested-ternary = { enabled = false }
53+
no-assign-in-condition = { enabled = false }
54+
explicit-octal = { enabled = false }
55+
readable-literal = { enabled = false }
56+
no-redundant-final = { enabled = false }
57+
no-empty-loop = { enabled = false }
58+
no-empty = { enabled = false }
59+
loop-does-not-iterate = { enabled = false }
60+
no-debug-symbols = { enabled = false }
61+
no-multi-assignments = { enabled = false }
62+
identity-comparison = { enabled = false }
63+
strict-assertions = { enabled = false }
64+
assert-description = { enabled = false }
65+
use-specific-assertions = { enabled = false }
66+
prefer-first-class-callable = { enabled = false }
67+
final-controller = { enabled = false }
68+
prefer-interface = { enabled = false }
69+
no-redundant-else = { enabled = true, level = "warning" }
70+
no-redundant-variable = { enabled = true, level = "warning" }
71+
strict-types = { enabled = true, level = "error" }

0 commit comments

Comments
 (0)