Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 8 additions & 27 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,45 +8,26 @@ on:

jobs:
test:
name: Test & Upload coverage.xml to Codecov
name: Run tests (PHP ${{ matrix.php }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [ '8.3', '8.4' ]

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Setup PHP 8.3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
php-version: ${{ matrix.php }}
extensions: mbstring, pdo, sqlite, pdo_sqlite
ini-values: max_execution_time=180

- name: Install PHP extensions
run: |
sudo apt update
sudo apt-get install -y php-phpdbg

- name: Install Composer Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

- name: Run tests via PHPUnit
env:
XDEBUG_MODE: coverage
run: |
vendor/bin/phpunit --coverage-clover=coverage.xml
cat ./coverage.xml

- name: Show coverage.xml
run: cat ./coverage.xml

- name: Upload coverage.xml to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
fail_ci_if_error: true
flags: unittests
name: codecov-umbrella
verbose: true
env_vars: PHP
run: vendor/bin/phpunit
6 changes: 3 additions & 3 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

declare(strict_types=1);

use Gomzyakov\CS\Finder;
use Gomzyakov\CS\Config;
use Gomzyakov\CodeStyleFinder;
use Gomzyakov\CodeStyleConfig;

// Routes for analysis with `php-cs-fixer`
$routes = ['./src', './tests'];

return Config::createWithFinder(Finder::createWithRoutes($routes));
return CodeStyleConfig::createWithFinder(CodeStyleFinder::createWithRoutes($routes));
31 changes: 14 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
> [!CAUTION]
> This package is abandoned and no longer maintained. The author suggests using the [gomzyakov/pint](https://github.com/gomzyakov/pint) package instead.

# Code-style configuration for `php-cs-fixer`

[![packagist](https://img.shields.io/packagist/v/gomzyakov/php-cs-fixer-config.svg)](https://packagist.org/packages/gomzyakov/php-cs-fixer-config)
[![downloads_count](https://img.shields.io/packagist/dt/gomzyakov/php-cs-fixer-config.svg)](https://packagist.org/packages/gomzyakov/php-cs-fixer-config)
[![license](https://img.shields.io/badge/License-MIT-green.svg)](https://github.com/gomzyakov/php-cs-fixer-config/blob/development/LICENSE)
[![codecov](https://codecov.io/gh/gomzyakov/php-cs-fixer-config/branch/main/graph/badge.svg?token=4CYTVMVUYV)](https://codecov.io/gh/gomzyakov/php-cs-fixer-config)
[![packagist](https://img.shields.io/packagist/v/gomzyakov/code-style.svg)](https://packagist.org/packages/gomzyakov/code-style)
[![downloads_count](https://img.shields.io/packagist/dt/gomzyakov/code-style.svg)](https://packagist.org/packages/gomzyakov/code-style)
[![license](https://img.shields.io/badge/License-MIT-green.svg)](https://github.com/gomzyakov/code-style/blob/development/LICENSE)
[![codecov](https://codecov.io/gh/gomzyakov/code-style/branch/main/graph/badge.svg?token=4CYTVMVUYV)](https://codecov.io/gh/gomzyakov/code-style)

This package allows sharing identical [php-cs-fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer) formatting rules across all of your projects without copy-and-pasting configuration files.

Expand All @@ -17,7 +14,7 @@ This package allows sharing identical [php-cs-fixer](https://github.com/PHP-CS-F
Install [`friendsofphp/php-cs-fixer`](https://github.com/FriendsOfPHP/PHP-CS-Fixer) & this package via Composer:

```sh
composer require --dev friendsofphp/php-cs-fixer gomzyakov/php-cs-fixer-config
composer require --dev friendsofphp/php-cs-fixer gomzyakov/code-style
```

### Step 2 of 3
Expand All @@ -27,13 +24,13 @@ Then create file `.php-cs-fixer.dist.php` at the root of your project with follo
```php
<?php

use Gomzyakov\CS\Finder;
use Gomzyakov\CS\Config;
use Gomzyakov\CodeStyleFinder;
use Gomzyakov\CodeStyleConfig;

// Routes for analysis with `php-cs-fixer`
$routes = ['./src', './tests'];

return Config::createWithFinder(Finder::createWithRoutes($routes));
return CodeStyleConfig::createWithFinder(CodeStyleFinder::createWithRoutes($routes));
```

Change the value of `$routes` depending on where your project's source code is.
Expand All @@ -54,28 +51,28 @@ And then completely fix them all with:

## Configuration

You must pass a set of routes to the `Finder::createWithRoutes()` call. For example, for [Laravel](https://laravel.com) projects, this would be:
You must pass a set of routes to the `CodeStyleFinder::createWithRoutes()` call. For example, for [Laravel](https://laravel.com) projects, this would be:

```php
Finder::createWithRoutes(['./app', './config', './database', './routes', './tests'])
CodeStyleFinder::createWithRoutes(['./app', './config', './database', './routes', './tests'])
```

Also, you can pass a custom set of rules to the `Config::createWithFinder()` call:
Also, you can pass a custom set of rules to the `CodeStyleConfig::createWithFinder()` call:

```php
Config::createWithFinder($finder, [
CodeStyleConfig::createWithFinder($finder, [
'@PHP81Migration' => true,
'array_indentation' => false
])
```

## Support

If you find any package errors, please, [make an issue](https://github.com/gomzyakov/php-cs-fixer-config/issues) in current repository.
If you find any package errors, please, [make an issue](https://github.com/gomzyakov/code-style/issues) in current repository.

## License

This is open-sourced software licensed under the [MIT License](https://github.com/gomzyakov/php-cs-fixer-config/blob/main/LICENSE).
This is open-sourced software licensed under the [MIT License](https://github.com/gomzyakov/code-style/blob/main/LICENSE).

## Special thanks

Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "gomzyakov/php-cs-fixer-config",
"name": "gomzyakov/code-style",
"description": "Code style configuration for `php-cs-fixer` based on PSR-12.",
"type": "package",
"license": "MIT",
Expand All @@ -8,7 +8,7 @@
"php-cs-fixer",
"code-style"
],
"homepage": "https://github.com/gomzyakov/php-cs-fixer-config",
"homepage": "https://github.com/gomzyakov/code-style",
"authors": [
{
"name": "Alexander Gomzyakov",
Expand All @@ -27,7 +27,7 @@
},
"autoload": {
"psr-4": {
"Gomzyakov\\CS\\": "src/"
"Gomzyakov\\": "src/"
}
},
"autoload-dev": {
Expand All @@ -36,7 +36,7 @@
}
},
"scripts": {
"cs-fix": "@php ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php",
"fix": "@php ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php",
"cs-check": "@php ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php --dry-run",
"phpstan": "@php ./vendor/bin/phpstan analyze -c ./phpstan.neon.dist --no-progress --ansi",
"phpunit": "@php ./vendor/bin/phpunit ./tests --no-coverage --color=always",
Expand Down
Loading