Add PHP 7.2 compatibility

Also ensure code works in all compatibilities via GitHub Actions.
Also add further checks like XML compatibility, CGL, etc.
This commit is contained in:
Daniel Siepmann 2020-09-22 13:03:37 +02:00
parent da3aed135c
commit 6e47f165e9
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4
8 changed files with 185 additions and 39 deletions

158
.github/workflows/ci.yaml vendored Normal file
View file

@ -0,0 +1,158 @@
name: CI
on: [push]
jobs:
check-composer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Validate composer.json
run: composer validate
php-linting:
runs-on: ubuntu-latest
strategy:
matrix:
php-version:
- 7.2
- 7.3
- 7.4
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php-version }}"
- name: PHP lint
run: "find *.php Classes Configuration -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l"
check-cgl:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
- name: Check CGL
run: ./vendor/bin/phpcs
check-dependencies:
runs-on: ubuntu-latest
needs: [check-composer]
steps:
- uses: actions/checkout@v2
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest --no-plugins
- name: Missing composer requirements
run: ./vendor/bin/composer-require-checker check
xml-linting:
runs-on: ubuntu-latest
needs: [check-composer]
steps:
- uses: actions/checkout@v2
- name: Install xmllint
run: sudo apt-get install libxml2-utils
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
- name: PHPCodeSniffer configuration file
run: xmllint --schema vendor/squizlabs/php_codesniffer/phpcs.xsd --noout phpcs.xml.dist
- name: Fetch schema for xliff
run: wget https://docs.oasis-open.org/xliff/v1.2/os/xliff-core-1.2-strict.xsd --output-document=.Build/xliff-core-1.2-strict.xsd
- name: TYPO3 language files
run: xmllint --schema .Build/xliff-core-1.2-strict.xsd --noout $(find Resources -name '*.xlf')
code-quality:
runs-on: ubuntu-latest
needs: [check-dependencies]
steps:
- uses: actions/checkout@v2
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
- name: Code Quality (by PHPStan)
run: ./vendor/bin/phpstan analyse
security-test:
runs-on: ubuntu-latest
needs: [check-dependencies]
steps:
- uses: actions/checkout@v2
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
- name: PHP Security test
run: ./vendor/bin/security-checker security:check --no-ansi

View file

@ -39,6 +39,9 @@ class Preview implements PageLayoutViewDrawItemHookInterface
$this->skillApi = $skillApi;
}
/**
* @return void
*/
public function preProcess(
PageLayoutView &$parentObject,
&$drawItem,

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.0" xmlns:t3="http://typo3.org/schemas/xliff">
<file source-language="en" datatype="plaintext">
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
<file source-language="en" datatype="plaintext" original="messages">
<header/>
<body>
<trans-unit id="newContentElement.skilldisplay.header">

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.0" xmlns:t3="http://typo3.org/schemas/xliff">
<file source-language="en" datatype="plaintext">
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
<file source-language="en" datatype="plaintext" original="messages">
<header/>
<body>
<trans-unit id="tt_content.skilldisplay_skills">

View file

@ -3,11 +3,17 @@
"description": "SkillDisplay integration for TYPO3",
"type": "typo3-cms-extension",
"license": "GPL-2.0-or-later",
"homepage": "https://daniel-siepmann.de/projects/typo3-extension-skilldisplay.html",
"homepage": "https://github.com/SkillDisplay/TYPO3ContentElements",
"repositories": [
{
"type": "vcs",
"url": "git@github.com:DanielSiepmann/PHPToolKit.git"
}
],
"support": {
"email": "coding@daniel-siepmann.de",
"source": "https://github.com/DanielSiepmann/SkillDisplay/",
"issues": "https://github.com/DanielSiepmann/SkillDisplay/issues"
"source": "https://github.com/SkillDisplay/TYPO3ContentElements",
"issues": "https://github.com/SkillDisplay/TYPO3ContentElements/issues"
},
"authors": [
{
@ -26,11 +32,12 @@
}
},
"require": {
"php": "^7.3.0",
"php": "7.2.* || 7.3.* || 7.4.*",
"typo3/cms-core": "^10.4",
"skilldisplay/phptoolkit": "^1.0",
"skilldisplay/phptoolkit": "dev-feature/improve-api as v1.0.x-dev",
"typo3/cms-backend": "^10.4",
"typo3/cms-frontend": "^10.4"
"typo3/cms-frontend": "^10.4",
"typo3fluid/fluid": "^2.6"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.5",

View file

@ -1,4 +1,5 @@
<?php
$EM_CONF[$_EXTKEY] = [
'title' => 'SkillDisplay',
'description' => 'Integrates SkillDisplay',

View file

@ -3,17 +3,9 @@
<description>This project coding standard</description>
<file>Classes/</file>
<file>Tests/</file>
<file>Configuration/</file>
<file>ext_emconf.php</file>
<file>ext_localconf.php</file>
<!-- Set default settings -->
<arg value="sp"/>
<arg name="colors"/>
<arg name="encoding" value="utf-8" />
<arg name="extensions" value="php" />
<!-- Base rules -->
<rule ref="PSR12" />
<rule ref="Generic.Files.LineLength.TooLong">
<exclude-pattern>/Tests/*</exclude-pattern>
</rule>
</ruleset>

View file

@ -2,22 +2,7 @@ parameters:
level: max
paths:
- Classes
- Tests
- Configuration
- ext_localconf.php
checkMissingIterableValueType: false
reportUnmatchedIgnoredErrors: true
ignoreErrors:
- '#Cannot call method fetch\(\) on Doctrine\\DBAL\\Driver\\Statement\|int\.#'
- '#Cannot call method fetchAll\(\) on Doctrine\\DBAL\\Driver\\Statement\|int\.#'
- '#Cannot call method fetchColumn\(\) on Doctrine\\DBAL\\Driver\\Statement\|int\.#'
-
message: '#\$timestamp of function date expects int, int\|false given\.#'
path: Classes/Dashboard/Provider/PageviewsPerDay.php
count: 1
-
message: '#Parameter \#1 \$start of method DanielSiepmann\\Tracking\\Dashboard\\Provider\\PageviewsPerDay::getPageviewsInPeriod\(\) expects int, int\|false given\.#'
path: Classes/Dashboard/Provider/PageviewsPerDay.php
count: 1
-
message: '#Parameter \#2 \$end of method DanielSiepmann\\Tracking\\Dashboard\\Provider\\PageviewsPerDay::getPageviewsInPeriod\(\) expects int, int\|false given\.#'
path: Classes/Dashboard/Provider/PageviewsPerDay.php
count: 1