Commit 9e91cfa4 authored by David Grüner's avatar David Grüner 🍔
Browse files

Merge branch 'chore/35-add-compatibility-to-php-8-4' into 'main'

Add compatibility up to PHP 8.5 and Symfony 8.1 #35

Closes #35

See merge request !29
parents e019fbf8 346b4977
Loading
Loading
Loading
Loading
Loading

.editorconfig

0 → 100644
+23 −0
Changes for .editorconfig: 23 added lines, 0 removed lines.
Original line number Diff line number Diff line
# editorconfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yaml,yml}]
trim_trailing_whitespace = false

[composer.json]
indent_size = 4

[.gitlab-ci.yml]
indent_size = 2
+77 −49
Changes for .gitlab-ci.yml: 77 added lines, 49 removed lines.
Original line number Diff line number Diff line
image: endava/php:8.2.15

stages:
  - test
  - check-and-test
  - reporting

variables:
  COMPOSER_HOME: .composer
  COMPOSER_NO_INTERACTION: '1'
  SYMFONY_DEPRECATIONS_HELPER: 'weak'
  PHP_VERSION: 'default'
  SYMFONY_VERSION: 'default'

  PHP_MEMORY_LIMIT: 1024M
  PHP_XDEBUG_MODE: 'on'
  PHP_XDEBUG_MODE: 'coverage'
  PHP_XDEBUG_EXTENSION_PATH: 'xdebug.so'

# -----------------------------------------------------------------------------
# Cache templates
# -----------------------------------------------------------------------------
.caches:
  composer:
    - key: composer-$CI_DEFAULT_BRANCH
    - key: composer--php-$PHP_VERSION--sf-$SYMFONY_VERSION
      fallback_keys:
        - composer-default
      when: always
      paths:
        - $COMPOSER_HOME/cache
        - vendor/

  php-cs-fixer:
    - key: php-cs-fixer-$CI_DEFAULT_BRANCH
    - key: php-cs-fixer--php-$PHP_VERSION
      fallback_keys:
        - php-cs-fixer-default
      paths:
        - .robo/cache/.php-cs-fixer.cache

  rector:
    - key: rector-$CI_DEFAULT_BRANCH
    - key: rector--php-$PHP_VERSION
      paths:
        - .robo/cache/rector

  robo:
    - key: robo-$CI_DEFAULT_BRANCH
    - key: robo--php-$PHP_VERSION
      when: always
      paths:
        - .robo/bin
        - .robo/robo
        - .robo/vendor


before_script:
# -----------------------------------------------------------------------------
# Script templates
# -----------------------------------------------------------------------------
.install-composer-and-robo: &install-composer-and-robo
  # prevent "dubious ownership" errors
  - git config --global --add safe.directory $CI_PROJECT_DIR
  # setup composer
  - mkdir -p .robo/bin/
  - if [[ ! -f .robo/bin/robo.phar ]]; then wget https://github.com/consolidation/robo/releases/download/4.0.4/robo.phar -O .robo/bin/robo.phar; fi
  - if [[ ! -f .robo/bin/composer ]]; then wget -q https://github.com/composer/composer/releases/download/2.10.2/composer.phar -O .robo/bin/composer && chmod +x .robo/bin/composer; fi
  - export PATH=".robo/bin:$PATH"
  - which composer
  - composer --version
  # Verify main composer.json and install .robo dependencies
  - composer validate
  - composer update --working-dir .robo/robo/ --optimize-autoloader --no-progress --no-interaction --prefer-source -v
  - chmod +x .robo/robo/vendor/bin/robo
  - export PATH=".robo/robo/vendor/bin:$PATH"
  - which robo
  # Install symfony CLI
  - if [[ ! -f .robo/bin/symfony ]]; then wget -qO - https://github.com/symfony-cli/symfony-cli/releases/latest/download/symfony-cli_linux_amd64.tar.gz | tar -C .robo/bin -zx; fi

# -----------------------------------------------------------------------------
# Jobs
# -----------------------------------------------------------------------------
check_matrix:
  stage: check-and-test
  parallel:
    matrix:
      - PHP_VERSION:
          - '8.2.28'
          - '8.3.18'
          - '8.4.5'
          - '8.5.2'
  image: "endava/php:$PHP_VERSION"
  before_script:
    - *install-composer-and-robo
  script:
    - composer update
    - robo init
    - robo check

  cache:
    - !reference [ .caches, composer ]
    - !reference [ .caches, php-cs-fixer ]
    - !reference [ .caches, rector ]
    - !reference [ .caches, robo ]

####################################################################################################
# _____         _
#|_   _|__  ___| |_
#  | |/ _ \/ __| __|
#  | |  __/\__ \ |_
#  |_|\___||___/\__|
####################################################################################################
test_matrix:
  stage: test
  stage: check-and-test
  parallel:
    matrix:
      - SYMFONY_VERSION:
          - '~6.0.0'
          - '~6.4.0'
          - '~7.4.0'
          - '~7.4.0|~8.1.0'
        PHP_VERSION:
          - '8.2.15'
          - '8.3.2'
          - '8.2.28'
          - '8.3.18'
          - '8.4.5'
          - '8.5.2'
  image: "endava/php:$PHP_VERSION"
  before_script:
    - *install-composer-and-robo
  script:
    - 'sed -i "s/\"require\": \"^6.4\"/\"require\": \"$SYMFONY_VERSION\"/" composer.json'
    - tail composer.json -n 14
    - composer update
    - robo init
    - robo test

  coverage: '/^\s*Lines:\s*\d+.\d+\%/'
  cache:
    - !reference [ .caches, composer ]
    - !reference [ .caches, robo ]

  script:
    - 'sed -i "s/\"require\": \"^6.4\"/\"require\": \"$SYMFONY_VERSION\"/" composer.json'
    - tail composer.json -n 7
    - php .robo/bin/robo.phar init
    - php .robo/bin/robo.phar test

  artifacts:
    when: always
    paths:
@@ -82,6 +127,9 @@ test_matrix:

coveralls_upload:
  stage: reporting
  variables: 
    PHP_VERSION: "8.2.28"
  image: endava/php:$PHP_VERSION
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
  cache:
@@ -90,23 +138,3 @@ coveralls_upload:
  script:
    - wget https://coveralls.io/coveralls-linux.tar.gz -O - | tar -xz
    - ./coveralls report


####################################################################################################
#  ____ _               _
# / ___| |__   ___  ___| | __
#| |   | '_ \ / _ \/ __| |/ /
#| |___| | | |  __/ (__|   <
# \____|_| |_|\___|\___|_|\_\
####################################################################################################
check:
  stage: test
  script:
    - php .robo/bin/robo.phar init
    - php .robo/bin/robo.phar check

  cache:
    - !reference [ .caches, composer ]
    - !reference [ .caches, php-cs-fixer ]
    - !reference [ .caches, rector ]
    - !reference [ .caches, robo ]
+8 −0
Changes for .php-cs-fixer.dist.php: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -18,6 +18,9 @@ if (!is_dir($cacheDir)) {
return (new PhpCsFixer\Config())
//    ->setUsingCache(false)
    ->setCacheFile($cacheDir.'/.php-cs-fixer.cache')
    ->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
    ->setUnsupportedPhpVersionAllowed(true)
    ->registerCustomFixers(new PhpCsFixerCustomFixers\Fixers())
    ->setRules([
        '@Symfony' => true,
        'global_namespace_import' => [
@@ -25,9 +28,14 @@ return (new PhpCsFixer\Config())
            'import_constants' => true,
            'import_functions' => false,
        ],
        'multiline_promoted_properties' => [
            'keep_blank_lines' => true,
            'minimum_number_of_parameters' => 1,
        ],
        'no_superfluous_phpdoc_tags' => true,
        'no_superfluous_elseif' => true,
        'phpdoc_add_missing_param_annotation' => true,
        PhpCsFixerCustomFixers\Fixer\FunctionParameterSeparationFixer::name() => true,
    ])
    ->setFinder($finder)
;
+7 −1
Changes for .robo/composer.json: 7 added lines, 1 removed line.
Original line number Diff line number Diff line
{
    "require": {
        "c33s/robofile": "^4.0",
        "ergebnis/composer-normalize": "^2.47",
        "friendsofphp/php-cs-fixer": "^3.85",
        "jdenticon/jdenticon": "^1.0",
        "kubawerlos/php-cs-fixer-custom-fixers": "^3.32",
        "phpcompatibility/php-compatibility": "^9.3.5",
        "phpcompatibility/phpcompatibility-symfony": "^1.2",
        "squizlabs/php_codesniffer": "^3.5"
        "symfony/event-dispatcher": "^7.4"
    },
    "config": {
        "allow-plugins": {
            "ergebnis/composer-normalize": true
        },
        "sort-packages": true
    }
}

.robo/robo/.gitignore

0 → 100644
+2 −0
Changes for .robo/robo/.gitignore: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
/vendor
/composer.lock
Loading