Skip to content

Commit

Permalink
Merge pull request #242 from kubawerlos/add-static-analysis
Browse files Browse the repository at this point in the history
Add PHP CS Fixer
  • Loading branch information
florianeckerstorfer committed Nov 26, 2019
2 parents ed496e9 + 41c1a98 commit ea290d4
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/bin/ export-ignore
/dev-tools/ export-ignore
/Resources/ export-ignore
/tests/ export-ignore
/.* export-ignore
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*.sublime-project
*.sublime-workspace
.idea
/.php_cs.cache
/nbproject/private/
/build/
/cache/
Expand Down
16 changes: 16 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

return PhpCsFixer\Config::create()
->setFinder(
PhpCsFixer\Finder::create()
->files()
->in(__DIR__ . '/bin')
->in(__DIR__ . '/src')
->in(__DIR__ . '/tests')
->append([__FILE__])
->notName('DefaultRuleProvider.php')
)
->setRiskyAllowed(true)
->setRules([
'@PSR2' => true,
]);
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ matrix:
- php: 7.1
env: COMPOSER_FLAGS='--prefer-lowest'
- php: 7.2
env: ANALYSIS=1
- php: nightly
allow_failures:
- php: nightly
Expand All @@ -32,8 +33,11 @@ before_install:

install:
- COMPOSER_MEMORY_LIMIT=-1 travis_retry composer update $COMPOSER_FLAGS --no-suggest
- if [ $ANALYSIS == 1 ]; then travis_retry composer update --working-dir=./dev-tools --no-suggest; fi

script: vendor/bin/phpunit --verbose --coverage-clover=coverage.clover
script:
- vendor/bin/phpunit --verbose --coverage-clover=coverage.clover
- if [ $ANALYSIS == 1 ]; then PHP_CS_FIXER_FUTURE_MODE=1 ./dev-tools/vendor/bin/php-cs-fixer fix --ansi --diff --dry-run --verbose || travis_terminate 1; fi

after_script:
- sh -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi;'
Expand Down
1 change: 0 additions & 1 deletion bin/generate-default.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,3 @@ function insertRules($fileName, array $rules = [])
} else {
printf("Error writing rules into '%s'.\n", $fileName);
}

5 changes: 5 additions & 0 deletions dev-tools/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.16"
}
}
2 changes: 1 addition & 1 deletion src/Bridge/Nette/SlugifyExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function beforeCompile()
$builder = $this->getContainerBuilder();

$self = $this;
$registerToLatte = function(ServiceDefinition $def) use ($self) {
$registerToLatte = function (ServiceDefinition $def) use ($self) {
$def->addSetup('addFilter', ['slugify', [$self->prefix('@helper'), 'slugify']]);
};

Expand Down
1 change: 0 additions & 1 deletion src/Bridge/Symfony/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public function getConfigTreeBuilder()
$rootNode = $treeBuilder->getRootNode();
} else {
$rootNode = $treeBuilder->root('cocur_slugify');

}

$rootNode
Expand Down
1 change: 0 additions & 1 deletion src/Bridge/Twig/SlugifyExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,4 @@ public function getName()
{
return "SlugifyExtension";
}

}

0 comments on commit ea290d4

Please sign in to comment.