diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 182c67c7..228d6d56 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,7 +18,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -31,3 +31,20 @@ jobs: - name: Run PHPUnit run: ./vendor/bin/phpunit + + php-cs-fixer: + name: PHP-CS-Fixer + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + - uses: actions/cache@v4 + with: + path: .php-cs-fixer.cache + key: ${{ runner.OS }}-${{ github.repository }}-phpcsfixer-${{ github.sha }} + restore-keys: | + ${{ runner.OS }}-${{ github.repository }}-phpcsfixer- + + - name: PHP-CS-Fixer + uses: docker://oskarstark/php-cs-fixer-ga + with: + args: -v --diff --dry-run diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1db343e2..00000000 --- a/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -language: php -install: composer install -script: - - ./disallowtabs.sh - - ./csfixer-check.sh - - ./phplint.sh ./lib/ - - ./vendor/bin/phpunit -dist: bionic -php: - - '8.0' - - '8.1.0' - - '8.2.0' diff --git a/README.md b/README.md index c14ea9d6..84c3e1dd 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # PHP FinTS/HBCI library -[![Build Status](https://travis-ci.org/nemiah/phpFinTS.svg?branch=master)](https://travis-ci.org/nemiah/phpFinTS) +[![CI status](https://github.com/nemiah/phpFinTS/actions/workflows/tests.yml/badge.svg)](https://github.com/nemiah/phpFinTS/actions/workflows/tests.yml) A PHP library implementing the following functions of the FinTS/HBCI protocol: diff --git a/csfixer-check.sh b/csfixer-check.sh deleted file mode 100755 index 9c76ae32..00000000 --- a/csfixer-check.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash -# -# When this is run as part of a Travis test for a pull request, then it ensures that none of the touched files has any -# PHP CS Fixer warnings. -# From: https://github.com/FriendsOfPHP/PHP-CS-Fixer#using-php-cs-fixer-on-ci - -if [ -z "$TRAVIS_COMMIT_RANGE" ] -then -# TRAVIS_COMMIT_RANGE "is empty for builds triggered by the initial commit of a new branch" -# From: https://docs.travis-ci.com/user/environment-variables/ - echo "Variable TRAVIS_COMMIT_RANGE not set, falling back to full git diff" - TRAVIS_COMMIT_RANGE=. -fi - -IFS=' -' -CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRTUXB "$TRAVIS_COMMIT_RANGE") -if [ "$?" -ne "0" ] -then - echo "Error: git diff response code > 0, aborting" - exit 1 -fi - -if [ -z "${CHANGED_FILES}" ] -then - echo "0 changed files found, exiting" - exit 0 -fi - -# February 2022: PHP CS FIXER is currently not PHP 8.1 compatible: -# "you may experience code modified in a wrong way" -# "To ignore this requirement please set `PHP_CS_FIXER_IGNORE_ENV`." -export PHP_CS_FIXER_IGNORE_ENV="1" - -if ! echo "${CHANGED_FILES}" | grep -qE "^(\\.php_cs(\\.dist)?|composer\\.lock)$"; then EXTRA_ARGS=$(printf -- '--path-mode=intersection\n--\n%s' "${CHANGED_FILES}"); else EXTRA_ARGS=''; fi -vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php -v --dry-run --stop-on-violation --using-cache=no ${EXTRA_ARGS} || (echo "php-cs-fixer failed" && exit 1) \ No newline at end of file diff --git a/disallowtabs.sh b/disallowtabs.sh deleted file mode 100755 index 3d91702f..00000000 --- a/disallowtabs.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -# -# When this is run as part of a Travis test for a pull request, then it ensures that none of the added lines (compared -# to the base branch of the pull request) use tabs for indentations. -# Adapted from https://github.com/mrc/git-hook-library/blob/master/pre-commit.no-tabs - -# Abort if any of the inner commands (particularly the git commands) fails. -set -e -set -o pipefail - -if [ -z ${TRAVIS_PULL_REQUEST} ]; then - echo "Expected environment variable TRAVIS_PULL_REQUEST" - exit 2 -elif [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then - echo "Not a Travis pull request, skipping." - exit 0 -fi - -# Make sure that we have a local copy of the relevant commits (otherwise git diff won't work). -git remote set-branches --add origin ${TRAVIS_BRNACH} -git fetch - -# Compute the diff from the PR's target branch to its HEAD commit. -target_branch="origin/${TRAVIS_BRANCH}" -the_diff=$(git diff "${target_branch}...HEAD") - -# Make sure that there are no tabs in the indentation part of added lines. -if echo "${the_diff}" | egrep '^\+\s* ' >/dev/null; then - echo -e "\e[31mError: The changes contain a tab for indentation\e[0m, which is against this repo's policy." - echo "Target branch: origin/${TRAVIS_BRANCH}" - echo "Commit range: ${TRAVIS_COMMIT_RANGE}" - echo "The following tabs were detected:" - echo "${the_diff}" | egrep '^(\+\s* |\+\+\+|@@)' - exit 1 -else - echo "No new tabs detected." -fi diff --git a/lib/Fhp/Action/SendSEPADirectDebit.php b/lib/Fhp/Action/SendSEPADirectDebit.php index 94630204..0976ed4f 100644 --- a/lib/Fhp/Action/SendSEPADirectDebit.php +++ b/lib/Fhp/Action/SendSEPADirectDebit.php @@ -11,8 +11,10 @@ use Fhp\Segment\Common\Kti; use Fhp\Segment\DME\HIDMESv1; use Fhp\Segment\DME\HIDMESv2; +use Fhp\Segment\DME\HKDMEv2; use Fhp\Segment\DSE\HIDSESv2; use Fhp\Segment\DSE\HIDXES; +use Fhp\Segment\DSE\HKDSEv2; use Fhp\Segment\SPA\HISPAS; use Fhp\Syntax\Bin; use Fhp\UnsupportedException; @@ -159,7 +161,7 @@ protected function createRequest(BPD $bpd, ?UPD $upd) . implode(', ', $supportedPainNamespaces)); } - /** @var mixed $hkdxe */ // TODO Put a new interface type here. + /** @var HKDMEv2|HKDSEv2|HIDXES $hkdxe */ $hkdxe = $hidxes->createRequestSegment(); $hkdxe->kontoverbindungInternational = Kti::fromAccount($this->account); $hkdxe->sepaDescriptor = $this->painNamespace;