Skip to content

Commit

Permalink
build: update coding style (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
priyadi authored Sep 16, 2024
1 parent 92be6d6 commit 604afdf
Show file tree
Hide file tree
Showing 11 changed files with 85 additions and 17 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
composer.lock
vendor
.phpunit.cache
var
var
.php-cs-fixer.cache
tools
4 changes: 4 additions & 0 deletions .phive/phars.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="php-cs-fixer" version="^3.64.0" installed="3.64.0" location="./tools/php-cs-fixer" copy="false"/>
</phive>
39 changes: 39 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

$finder = PhpCsFixer\Finder::create()
->in(__DIR__ . '/src')
->in(__DIR__ . '/config')
->in(__DIR__ . '/tests');

$config = new PhpCsFixer\Config();

return $config->setRules([
'@PER-CS2.0' => true,
'@PER-CS2.0:risky' => true,
'fully_qualified_strict_types' => true,
'global_namespace_import' => [
'import_classes' => false,
'import_constants' => false,
'import_functions' => false,
],
'no_unneeded_import_alias' => true,
'no_unused_imports' => true,
'ordered_imports' => [
'sort_algorithm' => 'alpha',
'imports_order' => ['class', 'function', 'const']
],
'declare_strict_types' => true,
'native_function_invocation' => ['include' => ['@compiler_optimized']],
'header_comment' => [
'header' => <<<EOF
This file is part of rekalogika/psr-16-simple-cache-bundle package.
(c) Priyadi Iman Nurcahyo <https://rekalogika.dev>
For the full copyright and license information, please view the LICENSE file
that was distributed with this source code.
EOF,
]
])
->setFinder($finder)
;
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* build: update phpunit
* build: add dependabot config
* feat: support PHP 8.4
* build: update coding style

## 1.1.0

Expand Down
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,12 @@ psalm:

.PHONY: phpunit
phpunit:
vendor/bin/phpunit
vendor/bin/phpunit

.PHONY: php-cs-fixer
php-cs-fixer: tools/php-cs-fixer
$< fix --config=.php-cs-fixer.dist.php --verbose --allow-risky=yes

.PHONY: tools/php-cs-fixer
tools/php-cs-fixer:
phive install php-cs-fixer
23 changes: 15 additions & 8 deletions config/services_test.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php


declare(strict_types=1);

/*
* This file is part of rekalogika/psr-16-simple-cache-bundle package.
*
Expand All @@ -9,8 +12,6 @@
* that was distributed with this source code.
*/

declare(strict_types=1);

use Psr\SimpleCache\CacheInterface;
use Rekalogika\Psr16SimpleCacheBundle\Tests\Kernel;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
Expand All @@ -23,12 +24,18 @@
return;
}

$services->set(
'cache.app',
ArrayAdapter::class
)
$services
->set(
'cache.app',
ArrayAdapter::class,
)
->tag('cache.pool');

$services->alias('test.cache.app.simple', 'cache.app.simple')->public();
$services->alias('test.' . CacheInterface::class, CacheInterface::class)->public();
$services
->alias('test.cache.app.simple', 'cache.app.simple')
->public();

$services
->alias('test.' . CacheInterface::class, CacheInterface::class)
->public();
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of rekalogika/psr-16-simple-cache-bundle package.
*
Expand Down Expand Up @@ -27,9 +29,9 @@ public function load(array $configs, ContainerBuilder $container): void

$loader = new PhpFileLoader(
$container,
new FileLocator(__DIR__ . '/../../config')
new FileLocator(__DIR__ . '/../../config'),
);

if ('test' === $env) {
$loader->load('services_test.php');
}
Expand Down
4 changes: 3 additions & 1 deletion src/DependencyInjection/RekalogikaPsr16SimpleCachePass.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of rekalogika/psr-16-simple-cache-bundle package.
*
Expand Down Expand Up @@ -34,7 +36,7 @@ public function process(ContainerBuilder $container): void

$definition->addTag('cache.pool.simple');

$simpleId = $id.'.simple';
$simpleId = $id . '.simple';
$container->setDefinition($simpleId, $definition);

if ($simpleId == 'cache.app.simple') {
Expand Down
2 changes: 2 additions & 0 deletions src/RekalogikaPsr16SimpleCacheBundle.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of rekalogika/psr-16-simple-cache-bundle package.
*
Expand Down
7 changes: 3 additions & 4 deletions tests/Kernel.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of rekalogika/psr-16-simple-cache-bundle package.
*
Expand All @@ -17,15 +19,12 @@

class Kernel extends HttpKernelKernel
{

public function registerBundles(): iterable
{
return [
new RekalogikaPsr16SimpleCacheBundle(),
];
}

public function registerContainerConfiguration(LoaderInterface $loader): void
{
}
public function registerContainerConfiguration(LoaderInterface $loader): void {}
}
2 changes: 2 additions & 0 deletions tests/Psr16Test.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of rekalogika/psr-16-simple-cache-bundle package.
*
Expand Down

0 comments on commit 604afdf

Please sign in to comment.