Skip to content

Commit a18a6f7

Browse files
authored
Merge pull request #619 from nicolasmure/fix/apply-cs-fix-on-1.x
merge master on 1.x and apply cs fix on 1.x
2 parents 15d250c + 776b261 commit a18a6f7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+606
-568
lines changed

.editorconfig

+3
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ trim_trailing_whitespace = false
1313

1414
[*.yml]
1515
indent_size = 2
16+
17+
[Makefile]
18+
indent_style = tab

.env.dist

+10-10
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@ AWS_KEY=
22
AWS_SECRET=
33
AWS_BUCKET=
44

5+
AZURE_ACCOUNT=
6+
AZURE_KEY=
7+
AZURE_CONTAINER=
8+
9+
FTP_HOST=ftp
10+
FTP_PORT=21
11+
FTP_USER=gaufrette
12+
FTP_PASSWORD=gaufrette
13+
FTP_BASE_DIR=/gaufrette
14+
515
# see /doc/adapters/google-cloud-storage.md
616
GCS_PROJECT_ID=
717
GCS_BUCKET_NAME=
@@ -28,13 +38,3 @@ SFTP_PORT=22
2838
SFTP_USER=gaufrette
2939
SFTP_PASSWORD=gaufrette
3040
SFTP_BASE_DIR=gaufrette
31-
32-
FTP_HOST=ftp
33-
FTP_PORT=21
34-
FTP_USER=gaufrette
35-
FTP_PASSWORD=gaufrette
36-
FTP_BASE_DIR=/gaufrette
37-
38-
AZURE_ACCOUNT=
39-
AZURE_KEY=
40-
AZURE_CONTAINER=

.gitignore

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
bin/*
22
!bin/tests
33
!bin/tests-all
4+
composer.lock
45
doc/.couscous
5-
tests/adapters/*
6-
!tests/adapters/*.dist
7-
vendor/
86
.env
9-
composer.lock
7+
.php_cs.cache
108
phpunit.xml
119
secrets/
10+
tests/adapters/*
11+
!tests/adapters/*.dist
12+
vendor/

.php_cs.dist

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
return PhpCsFixer\Config::create()
4+
->setFinder(PhpCsFixer\Finder::create()
5+
->exclude('vendor')
6+
->in(__DIR__)
7+
)
8+
->setRules([
9+
'@PSR1' => true,
10+
'@PSR2' => true,
11+
'array_syntax' => [ 'syntax' => 'short' ],
12+
'binary_operator_spaces' => [ 'align_equals' => false, 'align_double_arrow' => false ],
13+
'blank_line_before_statement' => true,
14+
'cast_spaces' => true,
15+
'combine_consecutive_unsets' => true,
16+
'concat_space' => [ 'spacing' => 'one' ],
17+
'linebreak_after_opening_tag' => true,
18+
'method_argument_space' => ['ensure_fully_multiline' => false],
19+
'no_blank_lines_after_class_opening' => true,
20+
'no_blank_lines_after_phpdoc' => true,
21+
'no_break_comment' => false,
22+
'no_extra_consecutive_blank_lines' => true,
23+
'no_spaces_around_offset' => true,
24+
'no_trailing_comma_in_singleline_array' => true,
25+
'no_unused_imports' => true,
26+
'no_useless_else' => true,
27+
'no_useless_return' => true,
28+
'no_whitespace_before_comma_in_array' => true,
29+
'no_whitespace_in_blank_line' => true,
30+
'normalize_index_brace' => true,
31+
'PedroTroller/phpspec' => true,
32+
'phpdoc_indent' => true,
33+
'phpdoc_to_comment' => true,
34+
'phpdoc_trim' => true,
35+
'single_quote' => true,
36+
'ternary_to_null_coalescing' => true,
37+
'trailing_comma_in_multiline_array' => true,
38+
'trim_array_spaces' => true,
39+
])
40+
->registerCustomFixers(new PedroTroller\CS\Fixer\Fixers())
41+
;

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,6 @@ install:
4141
- composer update --prefer-dist --no-progress --no-suggest --ansi
4242

4343
script:
44+
- php vendor/bin/php-cs-fixer fix --diff --dry-run --show-progress=none --verbose
4445
- php vendor/bin/phpspec run -fpretty --verbose
4546
- find tests/ -name "*Test.php" | vendor/bin/fastest -vvv "vendor/bin/phpunit --verbose {};"

Makefile

+12
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,15 @@ tests:
1919
.PHONY: clear-deps
2020
clear-deps:
2121
rm -rf vendor/ composer.lock
22+
23+
.PHONY: php-cs-compare
24+
php-cs-compare:
25+
docker/run-task php${PHP_VERSION} vendor/bin/php-cs-fixer fix \
26+
--diff \
27+
--dry-run \
28+
--show-progress=none \
29+
--verbose
30+
31+
.PHONY: php-cs-fix
32+
php-cs-fix:
33+
docker/run-task php${PHP_VERSION} vendor/bin/php-cs-fixer fix

README.md

+11
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,17 @@ $ make clear-deps
105105
$ PHP_VERSION=<the_version_you_want_to_use> make build install-deps
106106
```
107107

108+
5) Apply Coding Standards
109+
110+
You should check for CS violations by using
111+
```bash
112+
$ make php-cs-compare
113+
```
114+
and fix them with
115+
```bash
116+
$ make php-cs-fix
117+
```
118+
108119
### Note
109120

110121
This project does not have any stable release yet but we do not want to break BC now.

composer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
"akeneo/phpspec-skip-example-extension": "^4.0",
3838
"liuggio/fastest": "^1.6",
3939
"google/cloud-storage": "~1.0",
40-
"php-opencloud/openstack": "~3.0.0"
40+
"php-opencloud/openstack": "~3.0.0",
41+
"pedrotroller/php-cs-custom-fixer": "^2.17"
4142
},
4243
"suggest": {
4344
"knplabs/knp-gaufrette-bundle": "to use with Symfony",

phpunit.xml.dist

+1-28
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,7 @@
1010
stopOnFailure="false"
1111
bootstrap="vendor/autoload.php"
1212
>
13-
14-
<php>
15-
<!-- Parameters for GridFS adapter -->
16-
<!--<env name="MONGO_URI" value="mongodb://localhost:27017" />
17-
<env name="MONGO_DBNAME" value="gridfs_test" />-->
18-
19-
<!-- Configuration for AwsS3 adapter -->
20-
<!--<env name="AWS_KEY" value="" />
21-
<env name="AWS_SECRET" value="" />
22-
<env name="AWS_BUCKET" value="" />-->
23-
24-
<!-- Configuration for PhpseclibSftp adapter -->
25-
<!--<env name="SFTP_HOST" value="" />
26-
<env name="SFTP_PORT" value="" />
27-
<env name="SFTP_USER" value="" />
28-
<env name="SFTP_PASSWORD" value="" />-->
29-
30-
<!-- Configuration for Ftp adapter -->
31-
<!--<env name="FTP_HOST" value="" />
32-
<env name="FTP_USER" value="" />
33-
<env name="FTP_PASSWORD" value="" />
34-
<env name="FTP_BASE_DIR" value="" />-->
35-
36-
<!-- Configuration for Azure adapter -->
37-
<!--<env name="AZURE_ACCOUNT" value="" />
38-
<env name="AZURE_KEY" value="" />
39-
<env name="AZURE_CONTAINER" value="" />-->
40-
</php>
13+
<!-- The env vars are defined in the .env file -->
4114

4215
<testsuites>
4316
<testsuite name="Gaufrette Test Suite">

spec/Gaufrette/Adapter/AzureBlobStorage/BlobProxyFactory.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22

33
namespace spec\Gaufrette\Adapter\AzureBlobStorage;
44

5-
use PHPSpec2\ObjectBehavior;
5+
use PhpSpec\ObjectBehavior;
66

77
class BlobProxyFactory extends ObjectBehavior
88
{
99
/**
1010
* @param string $connectionString
1111
*/
12-
public function let($connectionString)
12+
function let($connectionString)
1313
{
1414
$this->beConstructedWith($connectionString);
1515
}
1616

17-
public function it_should_be_initializable()
17+
function it_should_be_initializable()
1818
{
1919
$this->shouldHaveType('Gaufrette\Adapter\AzureBlobStorage\BlobProxyFactory');
2020
$this->shouldHaveType('Gaufrette\Adapter\AzureBlobStorage\BlobProxyFactoryInterface');

0 commit comments

Comments
 (0)