Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 39 additions & 7 deletions .cs.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,23 @@
[
'@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,
'array_indentation' => true,
'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'],
Expand All @@ -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(
Expand All @@ -47,4 +79,4 @@
->name('*.php')
->ignoreDotFiles(true)
->ignoreVCS(true)
);
);
30 changes: 21 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,45 @@ 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

- 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
42 changes: 0 additions & 42 deletions .scrutinizer.yml

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
25 changes: 16 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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"
]
}
}
5 changes: 2 additions & 3 deletions phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
<file>./src</file>
<file>./tests</file>

<rule ref="PSR2"></rule>
<rule ref="PSR12"></rule>
<rule ref="PSR12"/>

<rule ref="Squiz.Commenting.FunctionComment.ParamCommentNotCapital">
<type>warning</type>
Expand All @@ -27,4 +26,4 @@
<property name="absoluteNestingLevel" value="4"/>
</properties>
</rule>
</ruleset>
</ruleset>
19 changes: 9 additions & 10 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,19 @@
bootstrap="vendor/autoload.php"
colors="true"
backupGlobals="false"
backupStaticAttributes="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage processUncoveredFiles="false">
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/12.5/phpunit.xsd">
<testsuites>
<testsuite name="Tests">
<directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">src</directory>
</include>
<exclude>
<directory>vendor</directory>
<directory>build</directory>
</exclude>
</coverage>
<testsuites>
<testsuite name="Tests">
<directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>
</phpunit>
</source>
</phpunit>