Added php code style fixer
This commit is contained in:
parent
db3a4d8756
commit
05fe5378ba
2
.gitignore
vendored
2
.gitignore
vendored
@ -3,6 +3,8 @@ composer.phar
|
||||
|
||||
vendor
|
||||
|
||||
.php_cs.cache
|
||||
|
||||
# IntelliJ project files
|
||||
*.iml
|
||||
*.iws
|
||||
|
56
.php_cs
Normal file
56
.php_cs
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
$finder = PhpCsFixer\Finder::create()
|
||||
->files()
|
||||
->name('*.php')
|
||||
->in(__DIR__)
|
||||
->exclude([
|
||||
'vendor',
|
||||
])
|
||||
->ignoreDotFiles(true)
|
||||
->ignoreVCS(true)
|
||||
;
|
||||
|
||||
return PhpCsFixer\Config::create()
|
||||
->setRiskyAllowed(true)
|
||||
->setRules([
|
||||
'@Symfony' => true,
|
||||
'@Symfony:risky' => true,
|
||||
|
||||
// exceptions
|
||||
'single_line_throw' => false,
|
||||
|
||||
// php file
|
||||
'concat_space' => ['spacing' => 'one'],
|
||||
|
||||
// namespace and imports
|
||||
'ordered_imports' => true,
|
||||
'global_namespace_import' => [
|
||||
'import_classes' => false,
|
||||
'import_constants' => false,
|
||||
'import_functions' => false,
|
||||
],
|
||||
|
||||
// standard functions and operators
|
||||
'native_constant_invocation' => false,
|
||||
'native_function_invocation' => false,
|
||||
'modernize_types_casting' => true,
|
||||
'is_null' => true,
|
||||
|
||||
// arrays
|
||||
'array_syntax' => [
|
||||
'syntax' => 'short',
|
||||
],
|
||||
|
||||
// phpdoc
|
||||
'phpdoc_annotation_without_dot' => false,
|
||||
'phpdoc_summary' => false,
|
||||
|
||||
// logical operators
|
||||
'logical_operators' => true,
|
||||
])
|
||||
->setFinder($finder)
|
||||
->setCacheFile(__DIR__ . '.php_cs.cache')
|
||||
;
|
18
.travis.yml
Normal file
18
.travis.yml
Normal file
@ -0,0 +1,18 @@
|
||||
language: php
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.composer/cache
|
||||
|
||||
php:
|
||||
- '7.3'
|
||||
|
||||
before_script:
|
||||
- flags="-o"
|
||||
- composer install $flags
|
||||
|
||||
script:
|
||||
- php vendor/bin/php-cs-fixer fix --diff --dry-run --using-cache no --config .php_cs
|
||||
|
||||
after_success:
|
||||
- bash <(curl -s https://codecov.io/bash)
|
@ -28,6 +28,7 @@
|
||||
"symfony/validator": "^5.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/doctrine-fixtures-bundle": "^3.3"
|
||||
"doctrine/doctrine-fixtures-bundle": "^3.3",
|
||||
"friendsofphp/php-cs-fixer": "^2.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user