Add php8 support, update dependencies (#5)

* add php8 support, symfony 6 support, update dev dependencies
* share matrix for code quality tools
This commit is contained in:
Alex Lushpai 2023-10-05 23:15:29 +03:00 committed by GitHub
parent 610b1ae0b7
commit 77e2d1e5bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 49 additions and 37 deletions

View File

@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
php-version: ['7.3', '7.4'] php-version: ['7.3', '7.4', '8.0', '8.1', '8.2']
steps: steps:
- name: Check out code into the workspace - name: Check out code into the workspace
uses: actions/checkout@v2 uses: actions/checkout@v2

View File

@ -11,6 +11,9 @@ jobs:
phpcs: phpcs:
name: "PHP CodeSniffer" name: "PHP CodeSniffer"
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['7.3', '7.4', '8.0', '8.1', '8.2']
steps: steps:
- name: Check out code into the workspace - name: Check out code into the workspace
uses: actions/checkout@v2 uses: actions/checkout@v2
@ -19,6 +22,9 @@ jobs:
phpmd: phpmd:
name: "PHP MessDetector" name: "PHP MessDetector"
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['7.3', '7.4', '8.0', '8.1', '8.2']
steps: steps:
- name: Check out code into the workspace - name: Check out code into the workspace
uses: actions/checkout@v2 uses: actions/checkout@v2
@ -28,15 +34,19 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
level: 'warning' level: 'warning'
reporter: github-pr-check reporter: github-pr-check
standard: './phpmd.xml' standard: './phpmd.xml.dist'
target_directory: 'src' target_directory: 'src'
phpstan: phpstan:
name: PHPStan name: PHPStan
runs-on: ubuntu-18.04 runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['7.3', '7.4', '8.0', '8.1', '8.2']
steps: steps:
- name: Check out code into the workspace - name: Check out code into the workspace
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Run PHPStan - name: Run PHPStan
uses: docker://oskarstark/phpstan-ga:0.12.88 uses: docker://oskarstark/phpstan-ga:1.8.0
with: with:
args: analyse src -c phpstan.neon --memory-limit=1G --no-progress args: analyse src -c phpstan.neon --memory-limit=1G --no-progress

View File

@ -14,12 +14,12 @@
"require": { "require": {
"php": ">=7.3", "php": ">=7.3",
"ext-json": "*", "ext-json": "*",
"symfony/validator": "^3 || ^4 || ^5" "symfony/validator": "^3 || ^4 || ^5 || ^6"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^9.5.7", "phpunit/phpunit": "^9.5.7",
"squizlabs/php_codesniffer": "3.*", "squizlabs/php_codesniffer": "3.*",
"phpstan/phpstan": "^0.12.92", "phpstan/phpstan": "^1.10",
"phpmd/phpmd": "^2.10" "phpmd/phpmd": "^2.10"
}, },
"support": { "support": {
@ -40,9 +40,9 @@
"scripts": { "scripts": {
"phpunit": "./vendor/bin/phpunit -c phpunit.xml.dist --coverage-text", "phpunit": "./vendor/bin/phpunit -c phpunit.xml.dist --coverage-text",
"phpunit-ci": "@php -dpcov.enabled=1 -dpcov.directory=. -dpcov.exclude=\"~vendor~\" ./vendor/bin/phpunit --teamcity -c phpunit.xml.dist", "phpunit-ci": "@php -dpcov.enabled=1 -dpcov.directory=. -dpcov.exclude=\"~vendor~\" ./vendor/bin/phpunit --teamcity -c phpunit.xml.dist",
"phpmd": "./vendor/bin/phpmd src text ./phpmd.xml", "phpmd": "./vendor/bin/phpmd src text ./phpmd.xml.dist",
"phpcs": "./vendor/bin/phpcs -p src --runtime-set testVersion 7.3-8.0 && ./vendor/bin/phpcs -p tests --runtime-set testVersion 7.3-8.0 --warning-severity=0", "phpcs": "./vendor/bin/phpcs -p --standard=phpcs.xml.dist --runtime-set testVersion 7.3-8.2 --warning-severity=0",
"phpstan": "./vendor/bin/phpstan analyse -c phpstan.neon src --memory-limit=-1", "phpstan": "./vendor/bin/phpstan analyse -c phpstan.neon",
"verify": [ "verify": [
"@phpcs", "@phpcs",
"@phpmd", "@phpmd",

View File

@ -6,42 +6,42 @@
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd"> xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>Ruleset</description> <description>Ruleset</description>
<rule ref="rulesets/controversial.xml"/> <rule ref="rulesets/controversial.xml"/>
<rule ref="rulesets/unusedcode.xml" /> <rule ref="rulesets/design.xml"/>
<rule ref="rulesets/naming.xml">
<rule ref="rulesets/design.xml"> <exclude name="ShortVariable" />
<exclude name="CouplingBetweenObjects" /> <exclude name="LongVariable" />
<exclude name="LongClassName" />
<exclude name="ShortMethodName" />
</rule> </rule>
<rule ref="rulesets/cleancode.xml"> <rule ref="rulesets/cleancode.xml">
<exclude name="StaticAccess" /> <exclude name="StaticAccess" />
<exclude name="ElseExpression" />
</rule>
<rule ref="rulesets/unusedcode.xml">
<exclude name="UnusedFormalParameter" />
</rule> </rule>
<rule ref="rulesets/codesize.xml"> <rule ref="rulesets/codesize.xml">
<exclude name="TooManyPublicMethods" /> <exclude name="TooManyPublicMethods" />
<exclude name="TooManyFields" /> <exclude name="TooManyFields" />
</rule> </rule>
<rule ref="rulesets/naming.xml">
<exclude name="ShortVariable" />
</rule>
<rule ref="rulesets/naming.xml/ShortVariable"> <rule ref="rulesets/naming.xml/ShortVariable">
<properties> <properties>
<property name="minimum" value="2" /> <property name="minimum" value="2" />
</properties> </properties>
</rule> </rule>
<rule ref="rulesets/codesize.xml/TooManyPublicMethods"> <rule ref="rulesets/naming.xml/LongVariable">
<properties> <properties>
<property name="maxmethods" value="20" /> <property name="maximum" value="30" />
</properties> </properties>
</rule> </rule>
<rule ref="rulesets/codesize.xml/TooManyFields"> <rule ref="rulesets/naming.xml/LongClassName">
<properties> <properties>
<property name="maxfields" value="30" /> <property name="maximum" value="80" />
</properties> </properties>
</rule> </rule>
<rule ref="rulesets/design.xml/CouplingBetweenObjects"> <rule ref="rulesets/naming.xml/ShortMethodName">
<properties> <properties>
<property name="maximum" value="15" /> <property name="minimum" value="2" />
</properties> </properties>
</rule> </rule>
<exclude-pattern>tests/*</exclude-pattern>
</ruleset> </ruleset>

View File

@ -6,3 +6,5 @@ parameters:
paths: paths:
- src - src
- tests - tests
bootstrapFiles:
- ./vendor/autoload.php

View File

@ -19,7 +19,6 @@
<coverage> <coverage>
<include> <include>
<directory>src</directory> <directory>src</directory>
<directory>dev</directory>
</include> </include>
<report> <report>
<clover outputFile="coverage.xml"/> <clover outputFile="coverage.xml"/>

View File

@ -21,19 +21,20 @@ class CrmUrlValidatorTest extends TestCase
public function testValidateSuccess(): void public function testValidateSuccess(): void
{ {
$validCrms = [ $validCrms = [
'https://asd.retailcrm.ru', 'https://retailcrm.tvoydom.ru',
'https://test.retailcrm.pro',
'https://raisa.retailcrm.es',
'https://blabla.simla.com',
'https://blabla.simlachat.com',
'https://blabla.simlachat.ru',
'https://blabla.ecomlogic.com',
'https://retailcrm.inventive.ru', 'https://retailcrm.inventive.ru',
'https://crm.baucenter.ru', 'https://crm.baucenter.ru',
'https://crm.holodilnik.ru', 'https://crm.holodilnik.ru',
'https://crm.eco.lanit.ru', 'https://crm.eco.lanit.ru',
'https://ecom.inventive.ru', 'https://ecom.inventive.ru',
'https://retailcrm.tvoydom.ru', 'https://test.retailcrm.ru',
'https://test.retailcrm.pro',
'https://test.retailcrm.es',
'https://test.simla.com',
'https://test.simlachat.com',
'https://test.ecomlogic.com',
'https://test.retailcrm.io',
'https://test.simla.io'
]; ];
$translator = new class () implements TranslatorInterface, LocaleAwareInterface { $translator = new class () implements TranslatorInterface, LocaleAwareInterface {