Skip to content

Commit

Permalink
#15 - docker improvement, default rules set improvement (#16)
Browse files Browse the repository at this point in the history
* Added default value for CURRENT_UID_AND_GID in docker, added .env.example, improved readme.md, bump docker image to 8.0.3.1

* Half fixed BinaryOperatorSpacesFixer, Added PhpdocLineSpanFixer

* ecs fix

* tests fix

* revert docker-compose user value

* pr fixes

* Added PhpdocLineSpanFixer
  • Loading branch information
Marcin Tracz authored Apr 12, 2021
1 parent bbd1c1e commit 6183605
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 2 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CURRENT_UID=1000
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
/vendor

composer.lock
.env
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"scripts": {
"ecs": "./vendor/bin/ecs check",
"ecsf": "./vendor/bin/ecs check --fix",
"test": "./vendor/bin/phpunit tests"
"test": "./vendor/bin/phpunit tests --colors always"
},
"require-dev": {
"phpunit/phpunit": "^9.5"
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3.7"

services:
php:
image: ghcr.io/blumilksoftware/php:8.0.2.1
image: ghcr.io/blumilksoftware/php:8.0.3.1
container_name: blumilk-codestyle-php
working_dir: /application
user: ${CURRENT_UID}
Expand Down
26 changes: 26 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,29 @@ Then run:
```shell
composer ecs
```

# Contributing

### Requirements
- docker
- docker-compose

### installation

```shell
cp .env.example .env
# adjust '.env' file
docker-compose up -d
docker-compose exec php composer install
```
### shell
```shell
docker-compose exec php ash
```

### scripts
```shell
docker-compose exec php composer ecs
docker-compose exec php composer ecsf
docker-compose exec php composer test
```
5 changes: 5 additions & 0 deletions src/Configuration/Defaults/CommonAdditionalRules.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use PhpCsFixer\Fixer\FunctionNotation\VoidReturnFixer;
use PhpCsFixer\Fixer\Import\FullyQualifiedStrictTypesFixer;
use PhpCsFixer\Fixer\Import\OrderedImportsFixer;
use PhpCsFixer\Fixer\Phpdoc\PhpdocLineSpanFixer;
use PhpCsFixer\Fixer\Strict\DeclareStrictTypesFixer;

class CommonAdditionalRules extends Rules implements AdditionalRules
Expand All @@ -29,5 +30,9 @@ class CommonAdditionalRules extends Rules implements AdditionalRules
FullyQualifiedStrictTypesFixer::class => null,
OrderedImportsFixer::class => null,
BinaryOperatorSpacesFixer::class => null,
PhpdocLineSpanFixer::class => [
"const" => "single",
"property" => "single",
],
];
}
17 changes: 17 additions & 0 deletions tests/AdditionalRulesConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use PhpCsFixer\Fixer\FunctionNotation\VoidReturnFixer;
use PhpCsFixer\Fixer\Import\FullyQualifiedStrictTypesFixer;
use PhpCsFixer\Fixer\Import\OrderedImportsFixer;
use PhpCsFixer\Fixer\Phpdoc\PhpdocLineSpanFixer;
use PhpCsFixer\Fixer\Strict\DeclareStrictTypesFixer;
use PhpCsFixer\Fixer\StringNotation\HeredocToNowdocFixer;
use PHPUnit\Framework\TestCase;
Expand All @@ -38,6 +39,10 @@ public function testAdditionalRulesConfiguration(): void
FullyQualifiedStrictTypesFixer::class => null,
OrderedImportsFixer::class => null,
BinaryOperatorSpacesFixer::class => null,
PhpdocLineSpanFixer::class => [
"const" => "single",
"property" => "single",
],
],
$config->options()["rules"]
);
Expand Down Expand Up @@ -66,6 +71,10 @@ public function testFilteringAdditionalRulesConfiguration(): void
FullyQualifiedStrictTypesFixer::class => null,
OrderedImportsFixer::class => null,
BinaryOperatorSpacesFixer::class => null,
PhpdocLineSpanFixer::class => [
"const" => "single",
"property" => "single",
],
],
$config->options()["rules"]
);
Expand All @@ -91,6 +100,10 @@ public function testExtendingAdditionalRulesConfiguration(): void
FullyQualifiedStrictTypesFixer::class => null,
OrderedImportsFixer::class => null,
BinaryOperatorSpacesFixer::class => null,
PhpdocLineSpanFixer::class => [
"const" => "single",
"property" => "single",
],
HeredocToNowdocFixer::class => null,
],
$config->options()["rules"]
Expand Down Expand Up @@ -121,6 +134,10 @@ public function testExtendingWithOptionsAdditionalRulesConfiguration(): void
FullyQualifiedStrictTypesFixer::class => null,
OrderedImportsFixer::class => null,
BinaryOperatorSpacesFixer::class => null,
PhpdocLineSpanFixer::class => [
"const" => "single",
"property" => "single",
],
NoMixedEchoPrintFixer::class => [
"use" => "echo",
],
Expand Down

0 comments on commit 6183605

Please sign in to comment.