diff --git a/.gitignore b/.gitignore
index 7f07e6f..5a6d7d4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,6 @@
composer.lock
vendor
.phpunit.cache
-var
\ No newline at end of file
+var
+.php-cs-fixer.cache
+tools
\ No newline at end of file
diff --git a/.phive/phars.xml b/.phive/phars.xml
new file mode 100644
index 0000000..2b1f5c8
--- /dev/null
+++ b/.phive/phars.xml
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php
new file mode 100644
index 0000000..40479f2
--- /dev/null
+++ b/.php-cs-fixer.dist.php
@@ -0,0 +1,39 @@
+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' => <<
+
+For the full copyright and license information, please view the LICENSE file
+that was distributed with this source code.
+EOF,
+ ]
+])
+ ->setFinder($finder)
+;
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8a2a375..0b5e05d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,7 @@
* build: update phpunit
* build: add dependabot config
* feat: support PHP 8.4
+* build: update coding style
## 1.1.0
diff --git a/Makefile b/Makefile
index b15a5e0..e3d4eca 100644
--- a/Makefile
+++ b/Makefile
@@ -11,4 +11,12 @@ psalm:
.PHONY: phpunit
phpunit:
- vendor/bin/phpunit
\ No newline at end of file
+ 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
\ No newline at end of file
diff --git a/config/services_test.php b/config/services_test.php
index e832540..875c95c 100644
--- a/config/services_test.php
+++ b/config/services_test.php
@@ -1,5 +1,8 @@
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();
};
diff --git a/src/DependencyInjection/RekalogikaPsr16SimpleCacheExtension.php b/src/DependencyInjection/RekalogikaPsr16SimpleCacheExtension.php
index 36e4334..05d6194 100644
--- a/src/DependencyInjection/RekalogikaPsr16SimpleCacheExtension.php
+++ b/src/DependencyInjection/RekalogikaPsr16SimpleCacheExtension.php
@@ -1,5 +1,7 @@
load('services_test.php');
}
diff --git a/src/DependencyInjection/RekalogikaPsr16SimpleCachePass.php b/src/DependencyInjection/RekalogikaPsr16SimpleCachePass.php
index 2555657..77bf7d8 100644
--- a/src/DependencyInjection/RekalogikaPsr16SimpleCachePass.php
+++ b/src/DependencyInjection/RekalogikaPsr16SimpleCachePass.php
@@ -1,5 +1,7 @@
addTag('cache.pool.simple');
- $simpleId = $id.'.simple';
+ $simpleId = $id . '.simple';
$container->setDefinition($simpleId, $definition);
if ($simpleId == 'cache.app.simple') {
diff --git a/src/RekalogikaPsr16SimpleCacheBundle.php b/src/RekalogikaPsr16SimpleCacheBundle.php
index 4c1c427..cc13550 100644
--- a/src/RekalogikaPsr16SimpleCacheBundle.php
+++ b/src/RekalogikaPsr16SimpleCacheBundle.php
@@ -1,5 +1,7 @@