Skip to content

Commit

Permalink
feat(refactor): Support php 8.1 and 8.2 with reorganized structure fo… (
Browse files Browse the repository at this point in the history
#4)

* feat(refactor): Support php 8.1 and 8.2 with reorganized structure for better maintaining.

* fix(refactor): Lock dependencies.

* fix(refactor): Fixed relative path.

* fix(refactor): Correct rule SlevomatCodingStandard.TypeHints.DeclareStrictTypes.

* resolved few comments and added few more.

* feat(refactor): Incorporated feedback.

* fix(rule): Fixed SlevomatCodingStandard.Classes.RequireMultiLineMethodSignature. IncludedMethodPatterns require regexp parameter.

---------

Co-authored-by: Tomas Mihalicka <[email protected]>
  • Loading branch information
pmysiak and tmihalicka committed May 23, 2024
1 parent 25cee90 commit ece4363
Show file tree
Hide file tree
Showing 29 changed files with 921 additions and 240 deletions.
1 change: 0 additions & 1 deletion .github/workflows /php-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:

jobs:
build:

runs-on: ubuntu-latest

steps:
Expand Down
19 changes: 14 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
}
],
"require": {
"php": ">=7.2",
"phpcompatibility/php-compatibility": "^9.3",
"slevomat/coding-standard": "^7.0.9",
"squizlabs/php_codesniffer": "^3.5"
"php": "~7.4.0|^8.1",
"phpcompatibility/php-compatibility": "^9.3.5",
"slevomat/coding-standard": "^8.12.1",
"squizlabs/php_codesniffer": "^3.7.2"
},
"require-dev": {
"madewithlove/license-checker": "^0.10.0"
Expand All @@ -25,9 +25,18 @@
}
},
"config": {
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"scripts": {
"phpcs7.4": "phpcs --standard=src/phpcs.ruleset.xml --extensions=php --tab-width=4 -sp --colors src/Example/Php74",
"phpcs8.1": "phpcs --standard=src/phpcs.ruleset.81.xml src/Example/Php81",
"phpcs8.2": "phpcs --standard=src/phpcs.ruleset.82.xml src/Example/Php82",
"phpcbf7.4": "phpcbf --standard=src/phpcs.ruleset.xml --extensions=php --tab-width=4 -sp src/Example/Php74",
"phpcbf8.1": "phpcbf --standard=src/phpcs.ruleset.81.xml src/Example/Php81",
"phpcbf8.2": "phpcbf --standard=src/phpcs.ruleset.82.xml src/Example/Php82",
"lic-check": "license-checker check"
}
}
414 changes: 220 additions & 194 deletions composer.lock

Large diffs are not rendered by default.

25 changes: 21 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
version: '3.5'

services:
# PHP
coding-standards-php7:
container_name: coding-standards-php7
build: ./docker/php
coding-standards-php7.4:
container_name: coding-standards-php7.4
build: ./docker/php7.4
volumes:
- .:/srv/www:delegated
- ~/.ssh:/var/www/.ssh
environment:
- COMPOSER_MEMORY_LIMIT=-1

coding-standards-php8.1:
container_name: coding-standards-php8.1
build: ./docker/php8.1
volumes:
- .:/srv/www:delegated
- ~/.ssh:/var/www/.ssh
environment:
- COMPOSER_MEMORY_LIMIT=-1

coding-standards-php8.2:
container_name: coding-standards-php8.2
build: ./docker/php8.2
volumes:
- .:/srv/www:delegated
- ~/.ssh:/var/www/.ssh
Expand Down
File renamed without changes.
12 changes: 12 additions & 0 deletions docker/php8.1/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM php:8.1-fpm

RUN apt-get update && apt-get install -y git-core zlib1g-dev libzip-dev zip unzip
RUN docker-php-ext-install zip

RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
php -r "if (hash_file('SHA384', 'composer-setup.php') === trim(file_get_contents('https://composer.github.io/installer.sig'))) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" && \
php composer-setup.php && \
mv composer.phar /usr/local/bin/composer && \
unlink composer-setup.php

WORKDIR /srv/www
12 changes: 12 additions & 0 deletions docker/php8.2/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM php:8.2-fpm

RUN apt-get update && apt-get install -y git-core zlib1g-dev libzip-dev zip unzip
RUN docker-php-ext-install zip

RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
php -r "if (hash_file('SHA384', 'composer-setup.php') === trim(file_get_contents('https://composer.github.io/installer.sig'))) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" && \
php composer-setup.php && \
mv composer.phar /usr/local/bin/composer && \
unlink composer-setup.php

WORKDIR /srv/www
3 changes: 0 additions & 3 deletions phpcbf.sh

This file was deleted.

14 changes: 14 additions & 0 deletions phpcs.ruleset.81.non-ddd.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0"?>
<ruleset name="PixelFederation">
<rule ref="./phpcs.ruleset.81.xml">
<arg name="extensions" value="php" />

<exclude name="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming"/>
<exclude name="SlevomatCodingStandard.Classes.SuperfluousErrorNaming"/>
<exclude name="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming"/>
<exclude name="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming"/>
<exclude name="SlevomatCodingStandard.Classes.SuperfluousTraitNaming"/>
<exclude name="SlevomatCodingStandard.Classes.TraitUseDeclaration"/>
<exclude name="SlevomatCodingStandard.Classes.TraitUseSpacing"/>
</rule>
</ruleset>
Loading

0 comments on commit ece4363

Please sign in to comment.