Skip to content

Commit cb74ac6

Browse files
authored
Merge pull request #2 from phpcr/cs
update codestyle
2 parents 1fe91c6 + 7341d12 commit cb74ac6

File tree

14 files changed

+76
-66
lines changed

14 files changed

+76
-66
lines changed

.gitattributes

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.gitattributes export-ignore
2+
/.github/ export-ignore
3+
.gitignore export-ignore
4+
/.php-cs-fixer.dist.php export-ignore
5+
/phpunit.xml.dist export-ignore
6+
/tests/ export-ignore

.github/workflows/ci.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ jobs:
2020
fail-fast: false
2121
matrix:
2222
include:
23+
- php-version: '7.4'
24+
symfony-version: '^4.4'
25+
monolog-version: '^1.0'
26+
2327
- php-version: '7.4'
2428
symfony-version: '^5.4'
2529
monolog-version: '^2.0'

.github/workflows/static.yml

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

.gitignore

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
tests/Resources/App/var
2-
composer.lock
3-
vendor
4-
.phpunit.result.cache
1+
/.php-cs-fixer.cache
2+
/composer.lock
3+
/tests/Resources/App/var
4+
/vendor
5+
/.phpunit.result.cache

.php-cs-fixer.dist.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()
4+
->in('src/')
5+
->in('tests/');
6+
$config = new PhpCsFixer\Config();
7+
8+
return $config->setFinder($finder)
9+
->setRules([
10+
'@Symfony' => true,
11+
'array_syntax' => ['syntax' => 'short'],
12+
]);

.php_cs

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/Command/MigrateCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ class MigrateCommand extends Command
2323
{
2424
private $factory;
2525
private $container;
26-
private $actions = array(
26+
private $actions = [
2727
'up', 'down', 'top', 'bottom',
28-
);
28+
];
2929

3030
public function __construct(
3131
MigratorFactory $factory,

src/Command/StatusCommand.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,19 @@ public function execute(InputInterface $input, OutputInterface $output)
5555
$currentVersion = $this->versionStorage->getCurrentVersion();
5656

5757
$table = new Table($output);
58-
$table->setHeaders(array(
58+
$table->setHeaders([
5959
'', 'Version', 'Date', 'Migrated', 'Path',
60-
));
60+
]);
6161

6262
foreach ($versionCollection->getAllVersions() as $versionName => $versionClass) {
6363
$reflection = new \ReflectionClass($versionClass);
64-
$table->addRow(array(
64+
$table->addRow([
6565
$versionName == $currentVersion ? '*' : '',
6666
$versionName,
6767
$this->getDate($versionName),
68-
isset($executedVersions[$versionName]) ? '<info>' . $executedVersions[$versionName]['executed']->format('Y-m-d H:i:s') . '</info>' : 'n/a',
68+
isset($executedVersions[$versionName]) ? '<info>'.$executedVersions[$versionName]['executed']->format('Y-m-d H:i:s').'</info>' : 'n/a',
6969
substr($reflection->getFileName(), strlen(getcwd()) + 1),
70-
));
70+
]);
7171
}
7272

7373
$table->render();

src/DependencyInjection/Configuration.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,12 @@ class Configuration implements ConfigurationInterface
2424
public function getConfigTreeBuilder()
2525
{
2626
$treeBuilder = new TreeBuilder('phpcr_migrations');
27-
if (method_exists($treeBuilder, 'getRootNode')) {
28-
$root = $treeBuilder->getRootNode();
29-
} else {
30-
// BC layer for symfony/config 4.1 and older
31-
$root = $treeBuilder->root('phpcr_migrations');
32-
}
3327

34-
$root
28+
$treeBuilder->getRootNode()
3529
->children()
36-
->scalarNode('version_node_name')->defaultValue('jcr:versions')->end()
30+
->scalarNode('version_node_name')
31+
->defaultValue('jcr:versions')
32+
->end()
3733
->arrayNode('paths')
3834
->prototype('scalar')->end()
3935
->end()

src/DependencyInjection/PhpcrMigrationsExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function load(array $configs, ContainerBuilder $container)
2222
{
2323
$configuration = new Configuration();
2424
$config = $this->processConfiguration($configuration, $configs);
25-
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
25+
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
2626

2727
$container->setParameter('phpcr_migrations.version_node_name', $config['version_node_name']);
2828

@@ -31,7 +31,7 @@ public function load(array $configs, ContainerBuilder $container)
3131
foreach ($container->getParameter('kernel.bundles') as $bundleFqn) {
3232
$reflection = new \ReflectionClass($bundleFqn);
3333
$path = dirname($reflection->getFileName());
34-
$migrationsPath = $path . '/Resources/phpcr-migrations';
34+
$migrationsPath = $path.'/Resources/phpcr-migrations';
3535

3636
if (file_exists($migrationsPath)) {
3737
$paths[] = $migrationsPath;

0 commit comments

Comments
 (0)