Skip to content

Commit 56679da

Browse files
committed
feat: adding php-cs-fixer-config code
1 parent 189c4c2 commit 56679da

File tree

15 files changed

+446
-61
lines changed

15 files changed

+446
-61
lines changed

.github/workflows/ci.yml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,34 @@ on: # yamllint disable-line rule:truthy
1111
- master
1212

1313
jobs:
14-
job_one:
15-
name: job_one
14+
tests:
15+
name: PHP ${{ matrix.php }} - ${{ matrix.os }}
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
fail-fast: true
19+
matrix:
20+
os: ["ubuntu-22.04"]
21+
php: ["8.1"]
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v3
25+
26+
- name: Setup PHP
27+
uses: shivammathur/setup-php@v2
28+
with:
29+
php-version: ${{ matrix.php }}
30+
extensions: dom, curl, libxml, mbstring, zip, fileinfo
31+
ini-values: error_reporting=E_ALL
32+
tools: composer:v2
33+
coverage: none
34+
35+
- name: Install dependencies
36+
run: composer install
37+
38+
- name: Execute tests
39+
run: make test
40+
41+
- name: Run phpstan
42+
run: make stan
1643

1744
...

.github/workflows/release-please.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
with:
1919
token: ${{ secrets.GITHUB_TOKEN }}
2020
release-type: node
21-
package-name: php-package-tpl
21+
package-name: php-cs-fixer-config
2222
default-branch: master
2323
changelog-types: |
2424
[

.php-cs-fixer.dist.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,17 @@
22

33
declare(strict_types=1);
44

5+
use WayOfDev\PhpCsFixer\Config\RuleSets\DefaultSet;
6+
7+
require_once 'vendor/autoload.php';
8+
9+
$config = WayOfDev\PhpCsFixer\Config\ConfigBuilder::createFromRuleSet(new DefaultSet())
10+
->inDir(__DIR__ . '/src')
11+
->inDir(__DIR__ . '/tests')
12+
->addFiles([__FILE__])
13+
->getConfig()
14+
;
15+
16+
$config->setCacheFile(__DIR__ . '/.build/php-cs-fixer/php-cs-fixer.cache');
17+
18+
return $config;

.yamllint.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ rules:
5151
require-starting-space: true
5252
min-spaces-from-content: 1
5353

54+
line-length: disable
55+
5456
yaml-files:
5557
- "*.yaml"
5658
- "*.yml"

CHANGELOG.md

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

Makefile

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ else
2929
WHITE := ""
3030
RST := ""
3131
endif
32-
MAKE_LOGFILE = /tmp/wayofdev-php-package-tpl.log
32+
MAKE_LOGFILE = /tmp/wayofdev-php-cs-fixer-config.log
3333
MAKE_CMD_COLOR := $(BLUE)
3434

3535
help:
@@ -40,14 +40,18 @@ help:
4040
@echo
4141
@echo ' 📑 Logs are stored in $(MAKE_LOGFILE)'
4242
@echo
43-
@echo ' 📦 Package php-package-tpl (github.com/wayofdev/php-package-tpl)'
43+
@echo ' 📦 Package php-cs-fixer-config (github.com/wayofdev/php-cs-fixer-config)'
4444
@echo ' 🤠 Author Andrij Orlenko (github.com/lotyp)'
4545
@echo ' 🏢 ${YELLOW}Org wayofdev (github.com/wayofdev)${RST}'
4646
.PHONY: help
4747

48-
all: install hooks
48+
all: prepare install hooks
4949
.PHONY: all
5050

51+
prepare:
52+
mkdir -p .build/php-cs-fixer
53+
.PHONY: prepare
54+
5155
# Composer
5256
# ------------------------------------------------------------------------------------
5357
install: ## Installs composer dependencies
@@ -60,11 +64,11 @@ update: ## Updates composer dependencies by running composer update command
6064

6165
# Testing
6266
# ------------------------------------------------------------------------------------
63-
cs-diff: ## Runs php-cs-fixer in dry-run mode and shows diff which will by applied
67+
cs-diff: prepare ## Runs php-cs-fixer in dry-run mode and shows diff which will by applied
6468
$(COMPOSER_RUN) cs-diff
6569
.PHONY: cs-diff
6670

67-
cs-fix: ## Fixes code to follow coding standards using php-cs-fixer
71+
cs-fix: prepare ## Fixes code to follow coding standards using php-cs-fixer
6872
$(COMPOSER_RUN) cs-fix
6973
.PHONY: cs-fix
7074

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
<br>
1313

1414
<div align="center">
15-
<a href="https://actions-badge.atrox.dev/wayofdev/php-package-tpl/goto"><img alt="Build Status" src="https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Flotyp%2Fdotfiles%2Fbadge&style=flat-square"/></a>
16-
<a href="https://github.com/wayofdev/php-package-tpl/tags"><img src="https://img.shields.io/github/v/tag/wayofdev/php-package-tpl?sort=semver&style=flat-square" alt="Latest Version"></a>
17-
<a href="LICENSE"><img src="https://img.shields.io/github/license/wayofdev/php-package-tpl.svg?style=flat-square&color=blue" alt="Software License"/></a>
18-
<a href="#"><img alt="Commits since latest release" src="https://img.shields.io/github/commits-since/wayofdev/php-package-tpl/latest?style=flat-square"></a>
15+
<a href="https://actions-badge.atrox.dev/wayofdev/php-cs-fixer-config/goto"><img alt="Build Status" src="https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Flotyp%2Fdotfiles%2Fbadge&style=flat-square"/></a>
16+
<a href="https://github.com/wayofdev/php-cs-fixer-config/tags"><img src="https://img.shields.io/github/v/tag/wayofdev/php-cs-fixer-config?sort=semver&style=flat-square" alt="Latest Version"></a>
17+
<a href="LICENSE"><img src="https://img.shields.io/github/license/wayofdev/php-cs-fixer-config.svg?style=flat-square&color=blue" alt="Software License"/></a>
18+
<a href="#"><img alt="Commits since latest release" src="https://img.shields.io/github/commits-since/wayofdev/php-cs-fixer-config/latest?style=flat-square"></a>
1919
</div>
2020

2121
<br>
@@ -26,7 +26,7 @@ This is minimal PHP template which is used by other PHP projects in wayofdev org
2626

2727
If you **like/use** this package, please consider **starring** it. Thanks!
2828

29-
![Screenshot](assets/screenshot.png)
29+
<br>
3030

3131
## 💿 Installation
3232

@@ -70,7 +70,7 @@ $ make cs-fix
7070

7171
## 🤝 License
7272

73-
[![Licence](https://img.shields.io/github/license/wayofdev/php-package-tpl?style=for-the-badge&color=blue)](./LICENSE)
73+
[![Licence](https://img.shields.io/github/license/wayofdev/php-cs-fixer-config?style=for-the-badge&color=blue)](./LICENSE)
7474

7575
<br>
7676

assets/screenshot.png

-485 KB
Binary file not shown.

composer.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
{
2-
"name": "wayofdev/package-tpl",
3-
"description": "PHP package template with GitHub Actions",
2+
"name": "wayofdev/cs-fixer-config",
3+
"description": "Package adds custom rule-sets to php-cs-fixer",
44
"type": "library",
55
"license": "MIT",
66
"homepage": "https://wayof.dev",
77
"support": {
8-
"issues": "https://github.com/wayofdev/php-package-tpl/issues",
9-
"source": "https://github.com/wayofdev/php-package-tpl"
8+
"issues": "https://github.com/wayofdev/php-cs-fixer-config/issues",
9+
"source": "https://github.com/wayofdev/php-cs-fixer-config"
1010
},
1111
"authors": [
1212
{
13-
"name": "lotyp",
13+
"name": "Andrij Orlenko",
1414
"email": "the@wayof.dev"
1515
}
1616
],
1717
"require": {
18-
"php": "^8.1"
18+
"php": "^8.1",
19+
"friendsofphp/php-cs-fixer": "^3.9.3"
1920
},
2021
"require-dev": {
2122
"ergebnis/composer-normalize": "^2.28",
@@ -29,12 +30,12 @@
2930
},
3031
"autoload": {
3132
"psr-4": {
32-
"WayOfDev\\PackageTpl\\": "src/"
33+
"WayOfDev\\PhpCsFixer\\Config\\": "src/"
3334
}
3435
},
3536
"autoload-dev": {
3637
"psr-4": {
37-
"WayOfDev\\PackageTpl\\Tests\\": "tests/"
38+
"WayOfDev\\PhpCsFixer\\Config\\Tests\\": "tests/"
3839
}
3940
},
4041
"scripts": {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"version": "1.0.0",
33
"repository": {
4-
"url": "https://github.com/wayofdev/php-package-tpl.git"
4+
"url": "https://github.com/wayofdev/php-cs-fixer-config.git"
55
}
66
}

0 commit comments

Comments
 (0)