Skip to content

Commit 0a1cbba

Browse files
committed
Upgrade phpcs
1 parent 1adbd53 commit 0a1cbba

File tree

10 files changed

+51
-63
lines changed

10 files changed

+51
-63
lines changed

.php_cs.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ return PhpCsFixer\Config::create()
1717
'phpdoc_order' => true,
1818
'semicolon_after_instruction' => true,
1919
'no_superfluous_phpdoc_tags' => false,
20+
'concat_space' => ['spacing' => 'one'],
2021
))
2122
->setFinder(
2223
PhpCsFixer\Finder::create()

build.xml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<property name="project-vendor-dir" value="vendor" />
2121
<property name="project-vendor-bin-dir" value="vendor/bin" />
2222
<property name="project-src-dir" value="src" />
23+
<property name="project-tests-dir" value="tests" />
2324
<property name="env" value="/usr/bin/env" />
2425
<property name="php-bin" value="php" />
2526
<property name="project-composer-phar" value="composer.phar" />
@@ -298,10 +299,18 @@
298299
</target>
299300

300301
<target name="phpcs" description="Run code style checks" depends="initialize-autoload">
301-
<phpcodesniffer standard="PSR1,PSR2" encoding="UTF-8" haltonerror="true" haltonwarning="true">
302-
<fileset refid="src-php"/>
303-
<formatter type="full" usefile="false" />
304-
</phpcodesniffer>
302+
<exec executable="${project-vendor-bin-dir}/phpcs" dir="." checkReturn="false" outputProperty="phpcs-results" returnProperty="phpcs-return" >
303+
<arg value="--standard=PSR12" />
304+
<arg value="${project-src-dir}" />
305+
<arg value="${project-tests-dir}" />
306+
</exec>
307+
<echo message="${phpcs-results}" />
308+
<if>
309+
<istrue value="${phpcs-return}" />
310+
<then>
311+
<fail /> <!-- fail build in case of errors -->
312+
</then>
313+
</if>
305314
</target>
306315

307316
<target name="symfony-doctrine-dump-schema" description="Dump current database scheme">

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"phpunit/phpunit": "^9.3.8",
6464
"roave/security-advisories": "dev-master",
6565
"sebastian/phpcpd": "^6.0.2",
66-
"squizlabs/php_codesniffer": "2.*",
66+
"squizlabs/php_codesniffer": "^3.5.8",
6767
"symfony/debug-pack": "*",
6868
"symfony/maker-bundle": "^1.0",
6969
"symfony/profiler-pack": "*",

composer.lock

Lines changed: 17 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/CommonBundle/DependencyInjection/CommonExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class CommonExtension extends Extension
1919
*/
2020
public function load(array $configs, ContainerBuilder $container): void
2121
{
22-
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
22+
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
2323
$loader->load('services.yaml');
2424
}
2525
}

src/Kernel.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,21 @@ class Kernel extends BaseKernel
1313
{
1414
use MicroKernelTrait;
1515

16-
const CONFIG_EXTS = '.{php,xml,yaml,yml}';
16+
public const CONFIG_EXTS = '.{php,xml,yaml,yml}';
1717

1818
public function getCacheDir()
1919
{
20-
return $this->getProjectDir().'/var/cache/'.$this->environment;
20+
return $this->getProjectDir() . '/var/cache/' . $this->environment;
2121
}
2222

2323
public function getLogDir()
2424
{
25-
return $this->getProjectDir().'/var/log';
25+
return $this->getProjectDir() . '/var/log';
2626
}
2727

2828
public function registerBundles()
2929
{
30-
$contents = require $this->getProjectDir().'/config/bundles.php';
30+
$contents = require $this->getProjectDir() . '/config/bundles.php';
3131
foreach ($contents as $class => $envs) {
3232
if (isset($envs['all']) || isset($envs[$this->environment])) {
3333
yield new $class();
@@ -37,25 +37,25 @@ public function registerBundles()
3737

3838
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader)
3939
{
40-
$container->addResource(new FileResource($this->getProjectDir().'/config/bundles.php'));
40+
$container->addResource(new FileResource($this->getProjectDir() . '/config/bundles.php'));
4141
// Feel free to remove the "container.autowiring.strict_mode" parameter
4242
// if you are using symfony/dependency-injection 4.0+ as it's the default behavior
4343
$container->setParameter('container.autowiring.strict_mode', true);
4444
$container->setParameter('container.dumper.inline_class_loader', true);
45-
$confDir = $this->getProjectDir().'/config';
45+
$confDir = $this->getProjectDir() . '/config';
4646

47-
$loader->load($confDir.'/{packages}/*'.self::CONFIG_EXTS, 'glob');
48-
$loader->load($confDir.'/{packages}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, 'glob');
49-
$loader->load($confDir.'/{services}'.self::CONFIG_EXTS, 'glob');
50-
$loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob');
47+
$loader->load($confDir . '/{packages}/*' . self::CONFIG_EXTS, 'glob');
48+
$loader->load($confDir . '/{packages}/' . $this->environment . '/**/*' . self::CONFIG_EXTS, 'glob');
49+
$loader->load($confDir . '/{services}' . self::CONFIG_EXTS, 'glob');
50+
$loader->load($confDir . '/{services}_' . $this->environment . self::CONFIG_EXTS, 'glob');
5151
}
5252

5353
protected function configureRoutes(RouteCollectionBuilder $routes)
5454
{
55-
$confDir = $this->getProjectDir().'/config';
55+
$confDir = $this->getProjectDir() . '/config';
5656

57-
$routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS, '/', 'glob');
58-
$routes->import($confDir.'/{routes}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, '/', 'glob');
59-
$routes->import($confDir.'/{routes}'.self::CONFIG_EXTS, '/', 'glob');
57+
$routes->import($confDir . '/{routes}/*' . self::CONFIG_EXTS, '/', 'glob');
58+
$routes->import($confDir . '/{routes}/' . $this->environment . '/**/*' . self::CONFIG_EXTS, '/', 'glob');
59+
$routes->import($confDir . '/{routes}' . self::CONFIG_EXTS, '/', 'glob');
6060
}
6161
}

src/PhpOfBy/AdminBundle/DependencyInjection/PhpOfByAdminExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class PhpOfByAdminExtension extends Extension
1919
*/
2020
public function load(array $configs, ContainerBuilder $container): void
2121
{
22-
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
22+
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
2323
$loader->load('services.yaml');
2424
}
2525
}

src/PhpOfBy/ContentBundle/DependencyInjection/PhpOfByContentExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class PhpOfByContentExtension extends Extension
1919
*/
2020
public function load(array $configs, ContainerBuilder $container): void
2121
{
22-
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
22+
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
2323
$loader->load('services.yaml');
2424
}
2525
}

src/PhpOfBy/SecurityBundle/DependencyInjection/PhpOfBySecurityExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class PhpOfBySecurityExtension extends Extension
1919
*/
2020
public function load(array $configs, ContainerBuilder $container): void
2121
{
22-
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
22+
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
2323
$loader->load('services.yaml');
2424
}
2525
}

src/PhpOfBy/WebsiteBundle/DependencyInjection/PhpOfByWebsiteExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class PhpOfByWebsiteExtension extends Extension
1919
*/
2020
public function load(array $configs, ContainerBuilder $container): void
2121
{
22-
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
22+
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
2323
$loader->load('services.yaml');
2424
}
2525
}

0 commit comments

Comments
 (0)