diff --git a/.cs.php b/.cs.php
index 9653bee..39be059 100644
--- a/.cs.php
+++ b/.cs.php
@@ -9,9 +9,8 @@
[
'@PSR1' => true,
'@PSR2' => true,
- '@Symfony' => true,
- 'psr_autoloading' => true,
// custom rules
+ 'psr_autoloading' => true,
'align_multiline_comment' => ['comment_type' => 'phpdocs_only'], // psr-5
'phpdoc_to_comment' => false,
'no_superfluous_phpdoc_tags' => false,
@@ -19,7 +18,14 @@
'array_syntax' => ['syntax' => 'short'],
'cast_spaces' => ['space' => 'none'],
'concat_space' => ['spacing' => 'one'],
- 'compact_nullable_typehint' => true,
+ 'compact_nullable_type_declaration' => true,
+ 'declare_equal_normalize' => ['space' => 'single'],
+ 'general_phpdoc_annotation_remove' => [
+ 'annotations' => [
+ 'author',
+ 'package',
+ ],
+ ],
'increment_style' => ['style' => 'post'],
'list_syntax' => ['syntax' => 'short'],
'echo_tag_syntax' => ['format' => 'long'],
@@ -29,15 +35,41 @@
'phpdoc_order' => true, // psr-5
'phpdoc_no_useless_inheritdoc' => false,
'protected_to_private' => false,
- 'yoda_style' => false,
+ 'yoda_style' => [
+ 'equal' => false,
+ 'identical' => false,
+ 'less_and_greater' => false
+ ],
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
'ordered_imports' => [
'sort_algorithm' => 'alpha',
- 'imports_order' => ['class', 'const', 'function']
+ 'imports_order' => ['class', 'const', 'function'],
],
'single_line_throw' => false,
+ 'declare_strict_types' => false,
+ 'blank_line_between_import_groups' => true,
'fully_qualified_strict_types' => true,
- 'global_namespace_import' => false,
+ 'no_null_property_initialization' => false,
+ 'nullable_type_declaration_for_default_null_value' => false,
+ 'operator_linebreak' => [
+ 'only_booleans' => true,
+ 'position' => 'beginning',
+ ],
+ 'global_namespace_import' => [
+ 'import_classes' => true,
+ 'import_constants' => null,
+ 'import_functions' => null
+ ],
+ 'class_definition' => [
+ 'space_before_parenthesis' => true,
+ ],
+ 'trailing_comma_in_multiline' => [
+ 'after_heredoc' => true,
+ 'elements' => ['array_destructuring', 'arrays', 'match']
+ ],
+ 'function_declaration' => [
+ 'closure_fn_spacing' => 'none',
+ ]
]
)
->setFinder(
@@ -47,4 +79,4 @@
->name('*.php')
->ignoreDotFiles(true)
->ignoreVCS(true)
- );
+ );
\ No newline at end of file
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 616f789..0c5a4d0 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -8,18 +8,19 @@ jobs:
strategy:
matrix:
operating-system: [ ubuntu-latest ]
- php-versions: [ '8.1' ]
+ php-versions: [ '8.2', '8.3', '8.4', '8.5' ]
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
steps:
- name: Checkout
- uses: actions/checkout@v1
+ uses: actions/checkout@v5
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
- coverage: none
+ extensions: gmp
+ coverage: xdebug
- name: Check PHP Version
run: php -v
@@ -27,14 +28,25 @@ jobs:
- name: Check Composer Version
run: composer -V
- - name: Check PHP Extensions
- run: php -m
-
- name: Validate composer.json and composer.lock
run: composer validate
- name: Install dependencies
- run: composer install --prefer-dist --no-progress --no-suggest
+ run: composer update --prefer-dist --no-progress --no-suggest
+
+ - name: Run PHP Coding Standards Fixer
+ run: composer cs:check
+
+ - name: Run PHP CodeSniffer
+ run: composer sniffer:check
+
+ - name: Run PHPStan
+ run: composer stan
+
+ - name: Run tests
+ if: ${{ matrix.php-versions != '8.5' }}
+ run: composer test
- - name: Run test suite
- run: composer test:all
+ - name: Run tests with coverage
+ if: ${{ matrix.php-versions == '8.5' }}
+ run: composer test:coverage
\ No newline at end of file
diff --git a/.scrutinizer.yml b/.scrutinizer.yml
deleted file mode 100644
index 9cf2601..0000000
--- a/.scrutinizer.yml
+++ /dev/null
@@ -1,42 +0,0 @@
-filter:
- paths: [ "src/*" ]
- excluded_paths: [ "vendor/*", "tests/*" ]
-
-checks:
- php:
- code_rating: true
- duplication: true
-
-tools:
- external_code_coverage: false
-
-build:
- environment:
- php:
- version: 8.1.2
- ini:
- xdebug.mode: coverage
- mysql: false
- node: false
- postgresql: false
- mongodb: false
- elasticsearch: false
- redis: false
- memcached: false
- neo4j: false
- rabbitmq: false
- nodes:
- analysis:
- tests:
- override:
- - php-scrutinizer-run
- dependencies:
- before:
- - composer self-update
- - composer install --no-interaction --prefer-dist --no-progress
- tests:
- before:
- - command: composer test:coverage
- coverage:
- file: 'build/logs/clover.xml'
- format: 'clover'
diff --git a/LICENSE b/LICENSE
index 1b93198..8806848 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
MIT License
-Copyright (c) 2022 Daniel Opitz
+Copyright (c) 2026 Daniel Opitz
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/README.md b/README.md
index a2bf45c..22f56af 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,7 @@ This library is a port of [TSID Creator](https://github.com/f4b6a3/tsid-creator)
## Requirements
- * PHP 8.0+
+ * PHP 8.2+
## Installation
diff --git a/composer.json b/composer.json
index ab12b1f..58e3841 100644
--- a/composer.json
+++ b/composer.json
@@ -7,13 +7,13 @@
"uuid"
],
"require": {
- "php": "^8"
+ "php": "8.2.* || 8.3.* || 8.4.* || 8.5.*"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3",
- "phpstan/phpstan": "^1",
- "phpunit/phpunit": "^9 || ^10",
- "squizlabs/php_codesniffer": "^3"
+ "phpstan/phpstan": "^2",
+ "phpunit/phpunit": "^9 || ^10 || ^11",
+ "squizlabs/php_codesniffer": "^4"
},
"autoload": {
"psr-4": {
@@ -29,18 +29,25 @@
"sort-packages": true
},
"scripts": {
- "cs:check": "php-cs-fixer fix --dry-run --format=txt --verbose --diff --config=.cs.php --ansi",
- "cs:fix": "php-cs-fixer fix --config=.cs.php --ansi",
+ "cs:check": [
+ "php-cs-fixer fix --dry-run --format=txt --verbose --diff --config=.cs.php --ansi --allow-unsupported-php-version=yes"
+ ],
+ "cs:fix": [
+ "php-cs-fixer fix --config=.cs.php --ansi --verbose --allow-unsupported-php-version=yes"
+ ],
"sniffer:check": "phpcs --standard=phpcs.xml",
"sniffer:fix": "phpcbf --standard=phpcs.xml",
- "stan": "phpstan analyse -c phpstan.neon --no-progress --ansi --xdebug",
- "test": "phpunit --configuration phpunit.xml --do-not-cache-result --colors=always",
+ "stan": "phpstan analyse -c phpstan.neon --no-progress --ansi",
+ "test": "phpunit --configuration phpunit.xml --do-not-cache-result --colors=always --display-warnings --display-deprecations --no-coverage",
"test:all": [
"@cs:check",
"@sniffer:check",
"@stan",
"@test"
],
- "test:coverage": "php -d xdebug.mode=coverage -r \"require 'vendor/bin/phpunit';\" -- --configuration phpunit.xml --do-not-cache-result --colors=always --coverage-clover build/logs/clover.xml --coverage-html build/coverage"
+ "test:coverage": [
+ "@putenv XDEBUG_MODE=coverage",
+ "phpunit --configuration phpunit.xml --do-not-cache-result --colors=always --display-warnings --display-deprecations --coverage-clover build/coverage/clover.xml --coverage-html build/coverage --coverage-text"
+ ]
}
}
diff --git a/phpcs.xml b/phpcs.xml
index 19179d8..f2f42d9 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -9,8 +9,7 @@
./src
./tests
-
-
+
warning
@@ -27,4 +26,4 @@
-
+
\ No newline at end of file
diff --git a/phpunit.xml b/phpunit.xml
index f2e36c3..449d536 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -3,9 +3,13 @@
bootstrap="vendor/autoload.php"
colors="true"
backupGlobals="false"
- backupStaticAttributes="false"
- xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
-
+ xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/12.5/phpunit.xsd">
+
+
+ tests
+
+
+
src
@@ -13,10 +17,5 @@
vendor
build
-
-
-
- tests
-
-
-
+
+
\ No newline at end of file