8000 minor #31 Run PHP CS Fixer in CI (derrabus) · symfony/acl-bundle@4fed3cf · GitHub
[go: up one dir, main page]

Skip to content

Commit 4fed3cf

Browse files
committed
minor #31 Run PHP CS Fixer in CI (derrabus)
This PR was squashed before being merged into the 2.x-dev branch. Discussion ---------- Run PHP CS Fixer in CI Commits ------- e78183e Run PHP CS Fixer in CI
2 parents 32022d7 + e78183e commit 4fed3cf

16 files changed

+88
-47
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [master]
7+
8+
jobs:
9+
cs:
10+
name: 'Code Style'
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v2
16+
- name: PHP-CS-Fixer
17+
uses: docker://oskarstark/php-cs-fixer-ga:2.18.6
18+
with:
19+
args: --diff --dry-run

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
vendor/
22
composer.lock
33
phpunit.xml
4+
.php_cs.cache
5+
.php_cs

.php_cs.dist

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
return (new PhpCsFixer\Config())
4+
->setRules([
5+
'@PHP71Migration' => true,
6+
'@PHPUnit84Migration:risky' => true,
7+
'@Symfony' => true,
8+
'@Symfony:risky' => true,
9+
'protected_to_private' => false,
10< 93D4 code class="diff-text syntax-highlighted-line addition">+
])
11+
->setRiskyAllowed(true)
12+
->setFinder(
13+
(new PhpCsFixer\Finder())
14+
->in([
15+
__DIR__.'/src',
16+
__DIR__.'/tests',
17+
])
18+
->append([__FILE__])
19+
)
20+
;

src/Command/InitAclCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111

1212
namespace Symfony\Bundle\AclBundle\Command;
1313

14+
use Doctrine\DBAL\Connection;
15+
use Doctrine\DBAL\Schema\SchemaException;
1416
use Symfony\Component\Console\Command\Command;
1517
use Symfony\Component\Console\Input\InputInterface;
1618
use Symfony\Component\Console\Output\OutputInterface;
1719
use Symfony\Component\Security\Acl\Dbal\Schema;
18-
use Doctrine\DBAL\Connection;
19-
use Doctrine\DBAL\Schema\SchemaException;
2020

2121
/**
2222
* Creates the tables required by the ACL system.

src/Command/SetAclCommand.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
use Symfony\Component\Security\Acl\Domain\RoleSecurityIdentity;
2121
use Symfony\Component\Security\Acl\Domain\UserSecurityIdentity;
2222
use Symfony\Component\Security\Acl\Exception\AclAlreadyExistsException;
23-
use Symfony\Component\Security\Acl\Permission\MaskBuilder;
2423
use Symfony\Component\Security\Acl\Model\MutableAclProviderInterface;
24+
use Symfony\Component\Security\Acl\Permission\MaskBuilder;
2525

2626
/**
2727
* Sets ACL for objects.
@@ -67,7 +67,7 @@ protected function configure()
6767
To set permissions at the class scope, use the <info>--class-scope</info> option:
6868
6969
<info>php %command.full_name% --class-scope --user=Symfony/Component/Security/Core/User/User:anne OWNER Acme/MyClass:42</info>
70-
70+
7171
EOF
7272
)
7373
->addArgument('arguments', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'A list of permissions and object identities (class name and ID separated by a column)')
@@ -83,12 +83,12 @@ protected function configure()
8383
protected function execute(InputInterface $input, OutputInterface $output)
8484
{
8585
// Parse arguments
86-
$objectIdentities = array();
86+
$objectIdentities = [];
8787
$maskBuilder = new MaskBuilder();
8888
foreach ($input->getArgument('arguments') as $argument) {
8989
$data = explode(':', $argument, 2);
9090

91-
if (count($data) > 1) {
91+
if (\count($data) > 1) {
9292
$objectIdentities[] = new ObjectIdentity($data[1], strtr($data[0], '/', '\\'));
9393
} else {
9494
$maskBuilder->add($data[0]);
@@ -107,13 +107,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
107107
}
108108

109109
// Create security identities
110-
$securityIdentities = array();
110+
$securityIdentities = [];
111111

112112
if ($userOption) {
113113
foreach ($userOption as $user) {
114114
$data = explode(':', $user, 2);
115115

116-
if (1 === count($data)) {
116+
if (1 === \count($data)) {
117117
throw new \InvalidArgumentException('The user must follow the format "Acme/MyUser:username".');
118118
}
119119

src/DependencyInjection/AclExtension.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111

1212
namespace Symfony\Bundle\AclBundle\DependencyInjection;
1313

14+
use Symfony\Component\Config\FileLocator;
1415
use Symfony\Component\Console\Application;
15-
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
16-
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
1716
use Symfony\Component\DependencyInjection\ContainerBuilder;
18-
use Symfony\Component\Config\FileLocator;
17+
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
18+
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
1919

2020
/**
2121
* AclExtension.
@@ -61,11 +61,11 @@ public function load(array $configs, ContainerBuilder $container)
6161

6262
$container
6363
->getDefinition('security.acl.dbal.schema_listener')
64-
->addTag('doctrine.event_listener', array(
64+
->addTag('doctrine.event_listener', [
6565
'connection' => $config['connection'],
6666
'event' => 'postGenerateSchema',
6767
'lazy' => true,
68-
))
68+
])
6969
;
7070

7171
$container->getDefinition('security.acl.cache.doctrine')->addArgument($config['cache']['prefix']);

src/EventListener/AclSchemaListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
namespace Symfony\Bundle\AclBundle\EventListener;
1313

14-
use Symfony\Component\Security\Acl\Dbal\Schema;
1514
use Doctrine\ORM\Tools\Event\GenerateSchemaEventArgs;
15+
use Symfony\Component\Security\Acl\Dbal\Schema;
1616

1717
/**
1818
* Merges ACL schema into the given schema.

tests/DependencyInjection/CompleteConfigurationTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
abstract class CompleteConfigurationTest extends TestCase
2424
{
25-
private static $containerCache = array();
25+
private static $containerCache = [];
2626

2727
abstract protected function loadFromFile(ContainerBuilder $container, $file);
2828

@@ -62,8 +62,8 @@ protected function getContainer($file)
6262
$bundle->build($container);
6363
$this->loadFromFile($container, $file);
6464

65-
$container->getCompilerPassConfig()->setOptimizationPasses(array());
66-
$container->getCompilerPassConfig()->setRemovingPasses(array());
65+
$container->getCompilerPassConfig()->setOptimizationPasses([]);
66+
$container->getCompilerPassConfig()->setRemovingPasses([]);
6767
$container->compile();
6868

6969
return self::$containerCache[$file] = $container;

tests/DependencyInjection/Fixtures/php/custom_acl_provider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
$this->load('container1.php', $container);
44

5-
$container->loadFromExtension('acl', array(
5+
$container->loadFromExtension('acl', [
66
'provider' => 'foo',
7-
));
7+
]);

tests/DependencyInjection/PhpCompleteConfigurationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111

1212
namespace Symfony\Bundle\AclBundle\Tests\DependencyInjection;
1313

14+
use Symfony\Component\Config\FileLocator;
1415
use Symfony\Component\DependencyInjection\ContainerBuilder;
1516
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
16-
use Symfony\Component\Config\FileLocator;
1717

1818
class PhpCompleteConfigurationTest extends CompleteConfigurationTest
1919
{

0 commit comments

Comments
 (0)
0