Skip to content

Commit

Permalink
Feature/service and testing update (#18)
Browse files Browse the repository at this point in the history
* Update packages, fix more stuff

* Update more packages, re-add doctrine/common for ClassUtils

* Update code style

* Update PHPUnit config, services and more

* Remove pure from abstract event

* Add some more things

* Use update instead of install to not respect lock (only for caching purposes)

* Update dependency injection test package

* Fix test?

* Update more stuff

* QC fix

* QC fix

* Move to newer service configuration for 5.4+ services

* CS fix

* Update kernel config

* Update GH Actions

* Prevent tests from running in parallel for some reason it breaks stuff

* Fix composer caches?

---------

Co-authored-by: Paweł Kąkol <pk@tksolutions.pl>
  • Loading branch information
pkly and Paweł Kąkol committed Apr 22, 2024
1 parent 271fcc2 commit 3531f18
Show file tree
Hide file tree
Showing 66 changed files with 2,000 additions and 2,162 deletions.
74 changes: 42 additions & 32 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,25 @@ jobs:
matrix:
include:
- symfony-version: 5.4
php-version: 8.1
php-version: 8.2
- symfony-version: 6.2
php-version: 8.1
php-version: 8.2
- symfony-version: 6.4
php-version: 8.2
- symfony-version: 7
php-version: 8.2

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Cache composer dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: vendor/
key: ${{ runner.os }}-composer-s-${{ hashFiles('**/composer.lock') }}-${{ matrix.symfony-version }}-${{ matrix.php-version }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}-${{ matrix.symfony-version }}-${{ matrix.php-version }}-${{ matrix.symfony-version }}
restore-keys: |
${{ runner.os }}-composer-s-${{ hashFiles('**/composer.lock') }}-${{ matrix.symfony-version }}-${{ matrix.php-version }}
${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}-${{ matrix.symfony-version }}-${{ matrix.php-version }}-${{ matrix.symfony-version }}
- name: PHP Setup
uses: shivammathur/setup-php@v2
Expand All @@ -39,28 +43,28 @@ jobs:
env:
SYMFONY_REQUIRE: ${{ matrix.symfony-version }}
run: |
composer install --no-interaction --no-scripts --ansi --no-progress --prefer-dist
composer update --no-interaction --no-scripts --ansi --no-progress --prefer-dist
phpstan:
strategy:
matrix:
include:
- symfony-version: 5.4
php-version: 8.1
- symfony-version: 6.4
php-version: 8.2

runs-on: ubuntu-latest
needs: install

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Cache composer dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: vendor/
key: ${{ runner.os }}-composer-s-${{ hashFiles('**/composer.lock') }}-${{ matrix.symfony-version }}-${{ matrix.php-version }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}-${{ matrix.symfony-version }}-${{ matrix.php-version }}-${{ matrix.symfony-version }}
restore-keys: |
${{ runner.os }}-composer-s-${{ hashFiles('**/composer.lock') }}-${{ matrix.symfony-version }}-${{ matrix.php-version }}
${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}-${{ matrix.symfony-version }}-${{ matrix.php-version }}-${{ matrix.symfony-version }}
- name: PHP Setup
uses: shivammathur/setup-php@v2
Expand All @@ -78,22 +82,22 @@ jobs:
strategy:
matrix:
include:
- symfony-version: 5.4
php-version: 8.1
- symfony-version: 6.4
php-version: 8.2

runs-on: ubuntu-latest
needs: install

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Cache composer dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: vendor/
key: ${{ runner.os }}-composer-s-${{ hashFiles('**/composer.lock') }}-${{ matrix.symfony-version }}-${{ matrix.php-version }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}-${{ matrix.symfony-version }}-${{ matrix.php-version }}-${{ matrix.symfony-version }}
restore-keys: |
${{ runner.os }}-composer-s-${{ hashFiles('**/composer.lock') }}-${{ matrix.symfony-version }}-${{ matrix.php-version }}
${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}-${{ matrix.symfony-version }}-${{ matrix.php-version }}-${{ matrix.symfony-version }}
- name: PHP Setup
uses: shivammathur/setup-php@v2
Expand All @@ -111,22 +115,22 @@ jobs:
strategy:
matrix:
include:
- symfony-version: 5.4
php-version: 8.1
- symfony-version: 6.4
php-version: 8.2

runs-on: ubuntu-latest
needs: install

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Cache composer dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: vendor/
key: ${{ runner.os }}-composer-s-${{ hashFiles('**/composer.lock') }}-${{ matrix.symfony-version }}-${{ matrix.php-version }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}-${{ matrix.symfony-version }}-${{ matrix.php-version }}-${{ matrix.symfony-version }}
restore-keys: |
${{ runner.os }}-composer-s-${{ hashFiles('**/composer.lock') }}-${{ matrix.symfony-version }}-${{ matrix.php-version }}
${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}-${{ matrix.symfony-version }}-${{ matrix.php-version }}-${{ matrix.symfony-version }}
- name: PHP Setup
uses: shivammathur/setup-php@v2
Expand All @@ -141,29 +145,35 @@ jobs:
vendor/bin/php-cs-fixer fix --config ./.php-cs-fixer.dist.php --dry-run --diff --ansi
test:
concurrency:
group: ${{ github.head_ref || github.ref }}
strategy:
matrix:
include:
- symfony-version: 5.4
php-version: 8.1
php-version: 8.2
- symfony-version: 6.2
php-version: 8.1
php-version: 8.2
- symfony-version: 6.4
php-version: 8.2
- symfony-version: 7
php-version: 8.2

runs-on: ubuntu-latest
needs:
- phpstan
- php-cs-fixer

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Cache composer dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: vendor/
key: ${{ runner.os }}-composer-s-${{ hashFiles('**/composer.lock') }}-${{ matrix.symfony-version }}-${{ matrix.php-version }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}-${{ matrix.symfony-version }}-${{ matrix.php-version }}-${{ matrix.symfony-version }}
restore-keys: |
${{ runner.os }}-composer-s-${{ hashFiles('**/composer.lock') }}-${{ matrix.symfony-version }}-${{ matrix.php-version }}
${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}-${{ matrix.symfony-version }}-${{ matrix.php-version }}-${{ matrix.symfony-version }}
- name: PHP Setup
uses: shivammathur/setup-php@v2
Expand All @@ -188,7 +198,7 @@ jobs:
hide_complexity: true
indicators: true
output: both
thresholds: '70 80'
thresholds: '65 80'

- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
Expand Down
86 changes: 35 additions & 51 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,65 +1,49 @@
<?php

$finder = PhpCsFixer\Finder::create()
$finder = (new PhpCsFixer\Finder())
->in(__DIR__)
->exclude('assets')
->exclude('var')
->exclude('bin')
->exclude('config')
->exclude('docker')
->exclude('files')
->exclude('public')
->exclude('scripts')
->exclude('templates')
->exclude('tools')
->exclude('translations')
->exclude('var')
->exclude('vendor');

return (new PhpCsFixer\Config())
->setRules([
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'no_superfluous_phpdoc_tags' => false,
'ternary_to_null_coalescing' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'@Symfony' => true,
'blank_line_before_statement' => [
'statements' => [
'declare',
'return',
'throw',
'try',
'if',
'for',
'while',
'foreach',
],
],
'cast_spaces' => ['space' => 'none'],
'constant_case' => ['case' => 'lower'],
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
'phpdoc_align' => false,
'single_line_throw' => false,
'yoda_style' => true,
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
'array_indentation' => true,
'no_unused_imports' => true,
'ordered_imports' => ['sort_algorithm' => 'alpha'],
'single_line_after_imports' => true,
'single_import_per_statement' => true,
'blank_line_after_opening_tag' => true,
'compact_nullable_typehint' => true,
'clean_namespace' => true,
'cast_spaces' => ['space' => 'single'],
'constant_case' => ['case' => 'lower'],
'full_opening_tag' => true,
'indentation_type' => true,
'lowercase_cast' => true,
'native_function_casing' => true,
'no_alternative_syntax' => true,
'new_with_braces' => true,
'no_empty_statement' => true,
'no_blank_lines_after_phpdoc' => true,
'no_closing_tag' => true,
'no_short_bool_cast' => true,
'no_trailing_whitespace' => true,
'no_unset_cast' => true,
'phpdoc_align' => ['align' => 'left'],
'phpdoc_indent' => true,
'phpdoc_annotation_without_dot' => true,
'phpdoc_trim' => true,
'single_blank_line_at_eof' => true,
'short_scalar_cast' => true,
'single_class_element_per_statement' => true,
'return_type_declaration' => ['space_before' => 'none'],
'visibility_required' => true,
'PedroTroller/line_break_between_method_arguments' => ['max-args' => false, 'max-length' => 1, 'automatic-argument-merge' => false],
'phpdoc_to_comment' => false,
'phpdoc_types_order' => false,
'phpdoc_scalar' => false,
'phpdoc_types' => false,
'increment_style' => false,
'ordered_class_elements' => true,
'fully_qualified_strict_types' => false,
'nullable_type_declaration_for_default_null_value' => false,
'nullable_type_declaration' => ['syntax' => 'union'],
'ordered_types' => ['sort_algorithm' => 'none', 'null_adjustment' => 'always_last'],
'PedroTroller/line_break_between_method_arguments' => [
'max-args' => false,
'max-length' => 1,
'automatic-argument-merge' => false,
'inline-attributes' => true,
],
])
->setFinder($finder)
->registerCustomFixers(new PedroTroller\CS\Fixer\Fixers())
;
->registerCustomFixers(new \PedroTroller\CS\Fixer\Fixers());
21 changes: 11 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,24 @@
"require": {
"php": "^8.1",
"doctrine/doctrine-bundle": "^1.12|^2.0",
"doctrine/orm": "^2|^3",
"symfony/framework-bundle": "^5.4|^6.2",
"symfony/event-dispatcher": "^5.4|^6.2",
"symfony/property-access": "^5.4|^6.2",
"symfony/http-kernel": "^5.4|^6.2"
"doctrine/orm": "^2.14|^3",
"symfony/framework-bundle": "^5.4|^6.2|^7",
"symfony/event-dispatcher": "^5.4|^6.2|^7",
"symfony/property-access": "^5.4|^6.2|^7",
"symfony/http-kernel": "^5.4|^6.2|^7",
"doctrine/common": "^2|^3"
},
"require-dev": {
"dama/doctrine-test-bundle": "^6",
"dama/doctrine-test-bundle": "^8|^7",
"doctrine/doctrine-fixtures-bundle": "^3",
"friendsofphp/php-cs-fixer": "^3",
"pedrotroller/php-cs-custom-fixer": "^2",
"phpunit/phpunit": "^9.5",
"phpunit/phpunit": "^10",
"vimeo/psalm": "^5",
"phpstan/phpstan": "^1",
"symfony/phpunit-bridge": "^5.4|^6.2",
"matthiasnoback/symfony-dependency-injection-test": "^4.",
"jetbrains/phpstorm-attributes": "^1.0"
"matthiasnoback/symfony-dependency-injection-test": "^5",
"jetbrains/phpstorm-attributes": "^1.0",
"pkly/phpunit-service-create-trait": "^1.0"
},
"extra": {
"symfony": {
Expand Down
Loading

0 comments on commit 3531f18

Please sign in to comment.