Skip to content

Commit

Permalink
Merge ff97cce into 4ef7af0
Browse files Browse the repository at this point in the history
  • Loading branch information
SonataCI committed Dec 4, 2017
2 parents 4ef7af0 + ff97cce commit 19f208f
Show file tree
Hide file tree
Showing 7 changed files with 124 additions and 84 deletions.
39 changes: 2 additions & 37 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -1,40 +1,5 @@
<?php

/*
* DO NOT EDIT THIS FILE!
*
* It's auto-generated by sonata-project/dev-kit package.
*
* Package `sllh/php-cs-fixer-styleci-bridge` is required to get it working.
*/
// TO BE REMOVED.

require_once __DIR__.'/vendor/sllh/php-cs-fixer-styleci-bridge/autoload.php';

use SLLH\StyleCIBridge\ConfigBridge;

$header = <<<EOF
This file is part of the Sonata Project package.
(c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
EOF;

// PHP-CS-Fixer 1.x
if (class_exists('Symfony\CS\Fixer\Contrib\HeaderCommentFixer')) {
\Symfony\CS\Fixer\Contrib\HeaderCommentFixer::setHeader($header);
}

$config = ConfigBridge::create()
->setUsingCache(true)
;

// PHP-CS-Fixer 2.x
if (method_exists($config, 'setRules')) {
$config->setRules(array_merge($config->getRules(), array(
'header_comment' => array('header' => $header)
)));
}

return $config;
return require_once __DIR__.'/.php_cs.dist';
76 changes: 76 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?php

/**
* DO NOT EDIT THIS FILE!
*
* It's auto-generated by sonata-project/dev-kit package.
*/

$header = <<<'HEADER'
This file is part of the Sonata Project package.
(c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
HEADER;

$rules = [
'@Symfony' => true,
'@Symfony:risky' => true,
'array_syntax' => [
'syntax' => 'short',
],
'combine_consecutive_issets' => true,
'combine_consecutive_unsets' => true,
'header_comment' => [
'header' => $header,
],
'no_extra_consecutive_blank_lines' => true,
'no_php4_constructor' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_class_elements' => true,
'ordered_imports' => true,
'phpdoc_order' => true,
'ternary_to_null_coalescing' => true,
// To be tested before insertion:
// 'strict_comparison' => true,
// 'strict_param' => true,
// 'php_unit_strict' => true,
];

if (\PHP_VERSION_ID >= 50600) {
$rules = array_merge($rules, [
'@PHP56Migration' => true,
'@PHP56Migration:risky' => true,
'@PHPUnit57Migration:risky' => true,
]);
}
if (\PHP_VERSION_ID >= 70000) {
$rules = array_merge($rules, [
'@PHP70Migration:risky' => true,
'@PHPUnit60Migration:risky' => true,
]);
}
if (\PHP_VERSION_ID >= 70100) {
$rules = array_merge($rules, [
'@PHP71Migration:risky' => true,
'compact_nullable_typehint' => true,
]);
}

$finder = PhpCsFixer\Finder::create()
->in(preg_match('/dev-kit\/project$/', __DIR__, $matches) ? __DIR__.'/..' : __DIR__)
->exclude('Tests/Fixtures')
->exclude('tests/Fixtures')
->exclude('Resources/skeleton')
->exclude('Resources/public/vendor')
;

return PhpCsFixer\Config::create()
->setFinder($finder)
->setRiskyAllowed(true)
->setRules($rules)
->setUsingCache(true)
;
31 changes: 1 addition & 30 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1 @@
# DO NOT EDIT THIS FILE!
#
# It's auto-generated by sonata-project/dev-kit package.
#
# Package `sllh/php-cs-fixer-styleci-bridge` is required to get it working.

preset: symfony

enabled:
- combine_consecutive_unsets
- short_array_syntax
- newline_after_open_tag
- no_php4_constructor
- no_useless_else
- ordered_class_elements
- ordered_use
# Comment strict rules for the moment. Should be uncomment later to see StyleCI PR results
# - strict
# - strict_param
# - php_unit_construct
# - php_unit_strict

finder:
exclude:
- 'Tests/Fixtures'
- 'tests/Fixtures'
# ecommerce special case:
- 'Resources/skeleton'
# ignore vendor assets
- 'Resources/public/vendor'
# TO BE REMOVED
39 changes: 22 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ php:
- '5.6'
- '7.0'
- '7.1'
- '7.2'
- nightly

sudo: false
Expand All @@ -34,36 +35,40 @@ env:
matrix:
fast_finish: true
include:
- php: '7.1'
- php: '7.2'
env: TARGET=docs
- php: '7.1'
- php: '5.6'
env: TARGET=lint
- php: '5.6'
env: COMPOSER_FLAGS="--prefer-lowest"
- php: '7.1'
- php: '7.2'
env: SYMFONY=2.8.*
- php: '7.1'
- php: '7.2'
env: SYMFONY=3.2.*
- php: '7.1'
- php: '7.2'
env: SYMFONY=3.3.*
- php: '7.1'
env: SYMFONY='dev-master as 3.3'
- php: '7.1'
- php: '7.2'
env: SYMFONY=3.4.*
- php: '7.2'
env: SYMFONY=4.0.*
- php: '7.2'
env: SYMFONY='dev-master as 4.0.x-dev'
- php: '7.2'
env: SONATA_CORE=3.*
- php: '7.1'
env: SONATA_CORE='dev-master as 3'
- php: '7.1'
- php: '7.2'
env: SONATA_CORE='dev-master as 3.x-dev'
- php: '7.2'
env: SONATA_ADMIN=3.*
- php: '7.1'
env: SONATA_ADMIN='dev-master as 3'
- php: '7.1'
- php: '7.2'
env: SONATA_ADMIN='dev-master as 3.x-dev'
- php: '7.2'
env: SYMFONY_DEPRECATIONS_HELPER=0
allow_failures:
- php: nightly
- env: SYMFONY_DEPRECATIONS_HELPER=0
- env: SYMFONY='dev-master as 3.3'
- env: SONATA_CORE='dev-master as 3'
- env: SONATA_ADMIN='dev-master as 3'
- env: SYMFONY='dev-master as 4.0.x-dev'
- env: SONATA_CORE='dev-master as 3.x-dev'
- env: SONATA_ADMIN='dev-master as 3.x-dev'

before_install:
- git remote add upstream ${UPSTREAM_URL} && git fetch --all
Expand Down
5 changes: 5 additions & 0 deletions .travis/install_lint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#!/usr/bin/env sh
set -ev

mkdir --parents "${HOME}/bin"

wget "http://cs.sensiolabs.org/download/php-cs-fixer-v2.phar" --output-document="${HOME}/bin/php-cs-fixer"
chmod u+x "${HOME}/bin/php-cs-fixer"

composer global require sllh/composer-lint:@stable --prefer-dist --no-interaction

gem install yaml-lint
17 changes: 17 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,23 @@ and run this command before committing your modifications:
php-cs-fixer fix --verbose
```

Please note that we try to keep phpdoc to a minimum, so if an `@param` phpdoc
comment brings nothing more than the type hint and variable name already do,
it should be removed. Descriptions are optional if you want to document a type.

```php
/**
* @param Bar|Baz $foo
* @param int $limit a crucial, highly interesting comment
*/
protected function bar($foo, string $name, int $limit)
{
// ...
}
```

Please also note that multiline signatures are allowed when the line is longer than 120 characters.

#### The documentation

The documentation is mostly written with the `rst` format, and can be found in the `docs` directory.
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ lint:
find . \( -name '*.xml' -or -name '*.xliff' \) \
-not -path './vendor/*' -not -path './Resources/public/vendor/*' -type f \
-exec xmllint --encode UTF-8 --output '{}' --format '{}' \;
php-cs-fixer fix --verbose
git diff --exit-code

test:
Expand Down

0 comments on commit 19f208f

Please sign in to comment.