Skip to content

Commit

Permalink
Merge pull request #29 from peter-gribanov/php-cs-fixer
Browse files Browse the repository at this point in the history
Configure PHP CS Fixer
  • Loading branch information
peter-gribanov committed Jan 24, 2020
2 parents 4b7aff1 + af74965 commit cb8edad
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
/build/
phpunit.xml
composer.lock
.php_cs.cache
38 changes: 38 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
declare(strict_types=1);

$header = <<<EOF
GpsLab component.
@author Peter Gribanov <info@peter-gribanov.ru>
@copyright Copyright (c) 2017, Peter Gribanov
@license http://opensource.org/licenses/MIT
EOF;

return PhpCsFixer\Config::create()
->setRules([
'@Symfony' => true,
'array_syntax' => [
'syntax' => 'short',
],
'header_comment' => [
'commentType' => 'PHPDoc',
'header' => $header,
],
'class_definition' => [
'multiLineExtendsEachSingleLine' => true,
],
'no_superfluous_phpdoc_tags' => false,
'blank_line_after_opening_tag' => false,
'phpdoc_no_empty_return' => false,
'ordered_imports' => [
'sort_algorithm' => 'alpha',
],
])
->setFinder(
PhpCsFixer\Finder::create()
->in(__DIR__.'/src')
->in(__DIR__.'/tests')
->notPath('bootstrap.php')
)
;
8 changes: 4 additions & 4 deletions src/Command/UpdateDatabaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class UpdateDatabaseCommand extends Command

/**
* @param Filesystem $fs
* @param string $url
* @param string $cache
* @param string $url
* @param string $cache
*/
public function __construct(
Filesystem $fs,
Expand Down Expand Up @@ -72,7 +72,7 @@ protected function configure(): void
}

/**
* @param InputInterface $input
* @param InputInterface $input
* @param OutputInterface $output
*
* @return int
Expand Down Expand Up @@ -130,7 +130,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
foreach (scandir($path) as $filename) {
$file = $path.'/'.$filename;

if (strpos($filename, $match['database']) === 0 && is_file($file)) {
if (0 === strpos($filename, $match['database']) && is_file($file)) {
$io->comment(sprintf(
'Found <info>%s</info> database updated at <info>%s-%s-%s</info>',
$match['database'],
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/GpsLabGeoIP2Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
class GpsLabGeoIP2Extension extends Extension
{
/**
* @param array $configs
* @param array $configs
* @param ContainerBuilder $container
*/
public function load(array $configs, ContainerBuilder $container): void
Expand Down
2 changes: 1 addition & 1 deletion tests/DependencyInjection/GpsLabGeoIP2ExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* GpsLab component.
*
* @author Peter Gribanov <info@peter-gribanov.ru>
* @copyright Copyright (c) 2011, Peter Gribanov
* @copyright Copyright (c) 2017, Peter Gribanov
* @license http://opensource.org/licenses/MIT
*/

Expand Down
2 changes: 1 addition & 1 deletion tests/GpsLabGeoIP2BundleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* GpsLab component.
*
* @author Peter Gribanov <info@peter-gribanov.ru>
* @copyright Copyright (c) 2011, Peter Gribanov
* @copyright Copyright (c) 2017, Peter Gribanov
* @license http://opensource.org/licenses/MIT
*/

Expand Down

0 comments on commit cb8edad

Please sign in to comment.