From e6df90a4dc58889698553b75654d69f57d0f9c89 Mon Sep 17 00:00:00 2001 From: Vasily Belosloodcev Date: Sat, 21 Dec 2024 00:59:19 +0500 Subject: [PATCH] v2.0.4 --- .gitattributes | 3 ++- .github/workflows/build.yml | 1 + phpcs.php => .php-cs-fixer.php | 8 +++++-- CHANGELOG.md | 6 +++++ LICENSE.md | 2 +- README.md | 4 ++-- workenv/50_xdebug.ini | 2 -- workenv/Dockerfile | 40 +++++++++++++++++++++++++++------- workenv/docker-compose.yml | 8 ++++--- workenv/xdebug.ini | 2 ++ 10 files changed, 57 insertions(+), 19 deletions(-) rename phpcs.php => .php-cs-fixer.php (75%) delete mode 100644 workenv/50_xdebug.ini create mode 100644 workenv/xdebug.ini diff --git a/.gitattributes b/.gitattributes index 7bb47fc..f968f05 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,7 +1,8 @@ /.gitignore export-ignore /.gitattributes export-ignore /phpunit.xml export-ignore +/phpunit.legacy.xml export-ignore /workenv export-ignore /tests export-ignore /.github export-ignore -/phpcs.php export-ignore +/.php-cs-fixer.php export-ignore diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 00d9622..85556d0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,6 +22,7 @@ jobs: - 8.1 - 8.2 - 8.3 + - 8.4 include: - phpunit: phpunit.xml - php: 5.6 diff --git a/phpcs.php b/.php-cs-fixer.php similarity index 75% rename from phpcs.php rename to .php-cs-fixer.php index d744976..776c9be 100644 --- a/phpcs.php +++ b/.php-cs-fixer.php @@ -4,7 +4,7 @@ /** * Configuration of code style fixer and checker for this library. - * This configuration compatible with friendsofphp/php-cs-fixer "^3.43.0". + * This configuration compatible with friendsofphp/php-cs-fixer "^3.65.0". */ use PhpCsFixer\Finder; @@ -16,7 +16,11 @@ $config = new Config(); $config->setRules([ - '@PSR12' => true, + '@PER-CS' => true, + 'cast_spaces' => [ + 'space' => 'none', + ], + 'single_line_empty_body' => false, ]); $config->setFinder($finder); diff --git a/CHANGELOG.md b/CHANGELOG.md index c33b0c0..f441356 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ xml-constrcutor === +v2.0.4 [2024-12-21] +--- + +- Supporting of PHP 8.4. +- Code style fixes. + v2.0.3 [2023-12-29] --- diff --git a/LICENSE.md b/LICENSE.md index 5e2270b..68d5abd 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,4 +1,4 @@ -Copyright (c) 2023, Vasily Belosloodcev +Copyright (c) 2024, Vasily Belosloodcev All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/README.md b/README.md index 9494a89..93bd68a 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ xml-constructor The array-like constructor of XML document structure. -Supporting PHP from 5.6 up to 8.3. +Supporting PHP from 5.6 up to newest. Install --- @@ -125,7 +125,7 @@ Code style To fix code style, run: ``` -~/.composer/vendor/bin/php-cs-fixer fix --config=./phpcs.php --verbose +~/.composer/vendor/bin/php-cs-fixer fix --verbose ``` You have to install [PHP CS Fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer) at first, if you diff --git a/workenv/50_xdebug.ini b/workenv/50_xdebug.ini deleted file mode 100644 index 40449cd..0000000 --- a/workenv/50_xdebug.ini +++ /dev/null @@ -1,2 +0,0 @@ -zend_extension=xdebug -xdebug.mode=debug,develop diff --git a/workenv/Dockerfile b/workenv/Dockerfile index 17ea256..ff50abd 100644 --- a/workenv/Dockerfile +++ b/workenv/Dockerfile @@ -1,18 +1,42 @@ -FROM php:8.3-cli-alpine +FROM php:8.4-cli-alpine +ARG GITHUB_OAUTH_TOKEN="" +ARG USER_UID="" +ARG USER_GID="" + +# common +# --- RUN apk add --no-cache $PHPIZE_DEPS && apk add --update --no-cache linux-headers RUN pecl install xdebug && docker-php-ext-enable xdebug -RUN rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -COPY 50_xdebug.ini /usr/local/etc/php/conf.d/ -RUN curl -sS https://getcomposer.org/installer | php -- --2 --install-dir=/usr/bin --filename=composer -ARG GITHUB_OAUTH_TOKEN=false -RUN if [ ${GITHUB_OAUTH_TOKEN} != false ]; then \ +COPY xdebug.ini /usr/local/etc/php/conf.d/zxy-50_xdebug.ini + +# new user +# --- +RUN addgroup -g $USER_GID php-cli \ + && adduser -u $USER_UID -G php-cli -s /bin/sh -D php-cli + +# login as new user +# --- +USER php-cli + +# env's +# --- +ENV PATH="/home/php-cli/.local/bin:/home/php-cli/.composer/vendor/bin:${PATH}" + +RUN mkdir -p /home/php-cli/.local/bin && \ + curl -sS https://getcomposer.org/installer | \ + /usr/local/bin/php -- --2 --install-dir=/home/php-cli/.local/bin --filename=composer + +# composer +# --- +RUN if [ -n ${GITHUB_OAUTH_TOKEN} ]; then \ composer config -g github-oauth.github.com ${GITHUB_OAUTH_TOKEN} \ ;fi -RUN export COMPOSER_DISABLE_XDEBUG_WARN=1 -RUN composer global require friendsofphp/php-cs-fixer "^3.43.1" +# other tools +# --- +RUN composer global require --dev friendsofphp/php-cs-fixer "^3.65.0" CMD ["php", "-a"] diff --git a/workenv/docker-compose.yml b/workenv/docker-compose.yml index 6531708..5820235 100644 --- a/workenv/docker-compose.yml +++ b/workenv/docker-compose.yml @@ -1,11 +1,13 @@ -version: '3' - services: php-cli: build: context: workenv args: - - GITHUB_OAUTH_TOKEN= + - "GITHUB_OAUTH_TOKEN=" + # If you are don't using Docker Desktop, but Docker Engine with Compose plugin, you should uncomment lines + # below and set-up "uid" and "gid" of your system user (see man of "id"). Try run command "id -u" and "id -g". + # - "USER_UID=1000" + # - "USER_GID=1000" working_dir: /app tty: true volumes: diff --git a/workenv/xdebug.ini b/workenv/xdebug.ini new file mode 100644 index 0000000..e4c3fea --- /dev/null +++ b/workenv/xdebug.ini @@ -0,0 +1,2 @@ +xdebug.mode=debug,develop +xdebug.log=/home/php-cli/php-xdebug.log