Skip to content

Commit

Permalink
Add v5
Browse files Browse the repository at this point in the history
  • Loading branch information
odan authored Dec 20, 2024
1 parent f29badd commit eab0f5a
Show file tree
Hide file tree
Showing 232 changed files with 11,189 additions and 13,684 deletions.
78 changes: 78 additions & 0 deletions .cs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?php

use PhpCsFixer\Config;

return (new Config())
->setUsingCache(false)
->setRiskyAllowed(true)
->setRules(
[
'@PSR1' => true,
'@PSR2' => true,
'@Symfony' => true,
'psr_autoloading' => true,
// custom rules
'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_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'],
'phpdoc_add_missing_param_annotation' => ['only_untyped' => false],
'phpdoc_align' => false,
'phpdoc_no_empty_return' => false,
'phpdoc_order' => true, // psr-5
'phpdoc_no_useless_inheritdoc' => false,
'protected_to_private' => false,
'yoda_style' => false,
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
'ordered_imports' => [
'sort_algorithm' => 'alpha',
'imports_order' => ['class', 'function', 'const'],
],
'single_line_throw' => false,
'declare_strict_types' => false,
'blank_line_between_import_groups' => true,
'fully_qualified_strict_types' => true,
'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,
],
'declare_equal_normalize' => false,
'phpdoc_summary' => false,
'phpdoc_add_missing_param_annotation' => false,
'no_useless_concat_operator' => false,
'fully_qualified_strict_types' => false,
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
]
)
->setFinder(
PhpCsFixer\Finder::create()
->in(__DIR__ . '/Slim')
->in(__DIR__ . '/tests')
->name('*.php')
->ignoreDotFiles(true)
->ignoreVCS(true)
);
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,11 @@ trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2

[*.neon]
indent_style = tab
indent_size = 4

[composer.json]
indent_style = space
indent_size = 4
39 changes: 25 additions & 14 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
name: Tests
name: tests

on: [push, pull_request]
on:
push:
branches:
- '4.x'
- '5.x'
pull_request:
branches:
- '*'

jobs:
tests:
name: Tests PHP ${{ matrix.php }}
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
php: [7.4, 8.0, 8.1, 8.2, 8.3]
experimental: [false]
php: [ 8.2, 8.3, 8.4 ]
include:
- php: 8.2
analysis: true
Expand All @@ -26,24 +31,30 @@ jobs:
php-version: ${{ matrix.php }}
coverage: xdebug

- name: Install dependencies with Composer
uses: ramsey/composer-install@v3
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest

- name: Coding standards
if: matrix.analysis
run: vendor/bin/phpcs
run: composer cs:check

- name: Code sniffer
run: composer sniffer:check

- name: Static analysis
if: matrix.analysis
run: vendor/bin/phpstan
run: composer stan

- name: Tests
run: vendor/bin/phpunit --coverage-clover clover.xml
if: ${{ !matrix.analysis }}
run: composer test

- name: Tests with coverage
if: matrix.analysis
run: composer test:coverage

- name: Upload coverage results to Coveralls
if: matrix.analysis
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer require php-coveralls/php-coveralls -n -W
vendor/bin/php-coveralls --coverage_clover=clover.xml -v
composer global require php-coveralls/php-coveralls
php-coveralls --coverage_clover=build/coverage/clover.xml -v
22 changes: 16 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
.DS_Store
.idea
.phpunit.result.cache
# Composer
composer.lock
phpunit.xml
/vendor

# PHPUnit
/.phpunit.cache
.phpunit.result.cache

# IDEs
/.fleet
/.idea
/.vscode

# Build artifacts and temporary files
.DS_Store
clover.xml
vendor
coverage
/build
/coverage
5 changes: 5 additions & 0 deletions .phpstorm.meta.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

namespace PHPSTORM_META;

override(\Psr\Container\ContainerInterface::get(0), map(['' => '@']));
Loading

0 comments on commit eab0f5a

Please sign in to comment.