Skip to content
This repository has been archived by the owner on Jan 7, 2024. It is now read-only.

Commit

Permalink
update php-cs-fixer, improve docs, make test pass
Browse files Browse the repository at this point in the history
  • Loading branch information
jspaetzel committed Apr 8, 2022
1 parent f27e3aa commit b955ca0
Show file tree
Hide file tree
Showing 4 changed files with 207 additions and 192 deletions.
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,32 @@ A slim, opinionated wrapper around PHPCSFixer.
This comes preloaded with sane style choices for most PHP applications. You should be able to safely run it on most code out of the box.

## 🏗 Setup

1. Require the package
```neon
```bash
composer require jspaetzel/phpstyle --dev
```

2. Run the setup script to download php-cs-fixer and create default configs:
2. Run the [setup script](https://github.com/jspaetzel/phpstyle/blob/main/phpstyle-setup):

```
```bash
./vendor/bin/phpstyle-setup
```

3. Review the `phpstyle.neon` configuration file and make changes if necessary
> 🗒 Note: This script is for convenience, you can alternatively do the same steps manually by [installing php-cs-fixer](https://cs.symfony.com/#installation), and copying two files ([.php-cs-fixer.dist.php](https://github.com/jspaetzel/phpstyle/blob/main/.php-cs-fixer.dist.php) and [phpstyle.neon](https://raw.githubusercontent.com/jspaetzel/phpstyle/main/phpstyle.neon)) to your project root.
4. Run the php-cs-fixer to fix your code
3. Review the `phpstyle.neon` configuration file. Feel free to make changes to this file at any time.


4. Run php-cs-fixer to fix your code
```bash
./vendor/bin/php-cs-fixer fix
```

> 🗒 Note: php-cs-fixer is integrated with PHPStorm and other editors and so PHPStyle should work with them as well.
That's it, your code is styled!

## ⚙ Configuration

The configuration for [PHPStyle](https://github.com/jspaetzel/phpstyle) takes inspiration from [PHPStan](https://github.com/phpstan/phpstan) and is a very simple neon configuration file. Just adjust your paths and php versions if needed, and you'll be good to go.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
}
},
"require-dev": {
"friendsofphp/php-cs-fixer": "3.5",
"friendsofphp/php-cs-fixer": "3.8",
"phpunit/phpunit": "^9"
}
}
Loading

0 comments on commit b955ca0

Please sign in to comment.