From e13b6f0d943366925cbcb82d562b31f64c576eb7 Mon Sep 17 00:00:00 2001 From: ErickSkrauch Date: Sat, 6 Apr 2019 04:15:23 +0200 Subject: [PATCH] Upgrade PHP to 7.3 and fix some related code errors. Disable self_accessor fixer for PHP-CS-Fixer --- .gitlab-ci.yml | 8 +- .php_cs.dist | 5 +- Dockerfile | 21 +-- api/components/User/IdentityInterface.php | 4 +- api/config/config-dev.php | 7 - api/config/config-prod.php | 9 - api/config/config.php | 2 + common/validators/UsernameValidator.php | 2 +- composer.json | 7 +- composer.lock | 192 ++-------------------- 10 files changed, 38 insertions(+), 219 deletions(-) delete mode 100644 api/config/config-prod.php diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f5a893b..c6a7ac0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,8 +6,8 @@ stages: variables: CONTAINER_IMAGE: "registry.ely.by/elyby/accounts" -check backend codestyle: - image: edbizarro/gitlab-ci-pipeline-php:7.2-alpine +php-cs-fixer: + image: edbizarro/gitlab-ci-pipeline-php:7.3-alpine stage: test cache: key: backend-vendor @@ -17,8 +17,8 @@ check backend codestyle: - composer install - vendor/bin/php-cs-fixer fix -v --dry-run -test backend: - image: edbizarro/gitlab-ci-pipeline-php:7.2-alpine +codeception: + image: edbizarro/gitlab-ci-pipeline-php:7.3-alpine services: - name: redis:4.0.10-alpine alias: redis diff --git a/.php_cs.dist b/.php_cs.dist index 4acb35a..bd76209 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -12,5 +12,6 @@ $finder = \PhpCsFixer\Finder::create() ->notPath('/.*\/tests\/_support\/_generated/') ->name('yii'); -return \Ely\CS\Config::create() - ->setFinder($finder); +return \Ely\CS\Config::create([ + 'self_accessor' => false, +])->setFinder($finder); diff --git a/Dockerfile b/Dockerfile index cd0879a..fc12794 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,8 @@ -FROM php:7.2.7-fpm-alpine3.7 +FROM php:7.3.3-fpm-alpine3.9 AS app + +# ENV variables for composer +ENV COMPOSER_NO_INTERACTION 1 +ENV COMPOSER_ALLOW_SUPERUSER 1 # bash needed to support wait-for-it script RUN apk add --update --no-cache \ @@ -7,6 +11,7 @@ RUN apk add --update --no-cache \ openssh \ dcron \ zlib-dev \ + libzip-dev \ icu-dev \ libintl \ imagemagick-dev \ @@ -18,7 +23,7 @@ RUN apk add --update --no-cache \ pcntl \ opcache \ && apk add --no-cache --virtual ".phpize-deps" $PHPIZE_DEPS \ - && yes | pecl install xdebug-2.6.0 \ + && yes | pecl install xdebug-2.7.1 \ && yes | pecl install imagick \ && docker-php-ext-enable imagick \ && apk del ".phpize-deps" \ @@ -26,17 +31,13 @@ RUN apk add --update --no-cache \ && rm -rf /tmp/* \ && mkdir /etc/cron.d -COPY --from=composer:1.6.5 /usr/bin/composer /usr/bin/composer -COPY --from=node:9.11.2-alpine /usr/local/bin/node /usr/bin/ -COPY --from=node:9.11.2-alpine /usr/lib/libgcc* /usr/lib/libstdc* /usr/lib/* /usr/lib/ - -# ENV variables for composer -ENV COMPOSER_NO_INTERACTION 1 -ENV COMPOSER_ALLOW_SUPERUSER 1 +COPY --from=composer:1.8.4 /usr/bin/composer /usr/bin/composer +COPY --from=node:11.13.0-alpine /usr/local/bin/node /usr/bin/ +COPY --from=node:11.13.0-alpine /usr/lib/libgcc* /usr/lib/libstdc* /usr/lib/* /usr/lib/ RUN mkdir /root/.composer \ && echo '{"github-oauth": {"github.com": "***REMOVED***"}}' > ~/.composer/auth.json \ - && composer global require --no-progress "hirak/prestissimo:^0.3.7" \ + && composer global require --no-progress "hirak/prestissimo:^0.3.8" \ && composer clear-cache COPY ./docker/php/wait-for-it.sh /usr/local/bin/wait-for-it diff --git a/api/components/User/IdentityInterface.php b/api/components/User/IdentityInterface.php index 1228483..b61a0bc 100644 --- a/api/components/User/IdentityInterface.php +++ b/api/components/User/IdentityInterface.php @@ -1,4 +1,6 @@ ['debug'], 'components' => [ 'reCaptcha' => [ 'public' => '6LfwqCYTAAAAAJlaJpqCdzESCjAXUC81Ca6jBHR7', 'secret' => '6LfwqCYTAAAAAFPjHmgwmnjSMFeAOJh7Lk5xxDMC', ], ], - 'modules' => [ - 'debug' => [ - 'class' => yii\debug\Module::class, - 'allowedIPs' => ['*'], - ], - ], ]; diff --git a/api/config/config-prod.php b/api/config/config-prod.php deleted file mode 100644 index d813524..0000000 --- a/api/config/config-prod.php +++ /dev/null @@ -1,9 +0,0 @@ - [ - 'reCaptcha' => [ - 'public' => getenv('RECAPTCHA_PUBLIC'), - 'secret' => getenv('RECAPTCHA_SECRET'), - ], - ], -]; diff --git a/api/config/config.php b/api/config/config.php index 46a30f9..58b593e 100644 --- a/api/config/config.php +++ b/api/config/config.php @@ -67,6 +67,8 @@ return [ ], 'reCaptcha' => [ 'class' => api\components\ReCaptcha\Component::class, + 'public' => getenv('RECAPTCHA_PUBLIC'), + 'secret' => getenv('RECAPTCHA_SECRET'), ], 'response' => [ 'format' => yii\web\Response::FORMAT_JSON, diff --git a/common/validators/UsernameValidator.php b/common/validators/UsernameValidator.php index 657bd03..70cccf0 100644 --- a/common/validators/UsernameValidator.php +++ b/common/validators/UsernameValidator.php @@ -31,7 +31,7 @@ class UsernameValidator extends Validator { $length->tooShort = E::USERNAME_TOO_SHORT; $length->tooLong = E::USERNAME_TOO_LONG; - $pattern = new validators\RegularExpressionValidator(['pattern' => '/^[\p{L}\d-_\.!$%^&*()\[\]:;]+$/u']); + $pattern = new validators\RegularExpressionValidator(['pattern' => '/^[\p{L}\d\-_.!$%^&*()\[\]:;]+$/u']); $pattern->message = E::USERNAME_INVALID; $unique = new validators\UniqueValidator(); diff --git a/composer.json b/composer.json index c69b94e..bc5ad13 100644 --- a/composer.json +++ b/composer.json @@ -30,15 +30,14 @@ "yiisoft/yii2-queue": "~2.1.0" }, "require-dev": { - "yiisoft/yii2-debug": "*", - "yiisoft/yii2-faker": "*", - "flow/jsonpath": "^0.4.0", "codeception/codeception": "^2.5.3", "codeception/specify": "^1.0.0", "codeception/verify": "*", + "ely/php-code-style": "^0.3.0", + "flow/jsonpath": "^0.4.0", + "fzaninotto/faker": "^1.8", "mockery/mockery": "^1.0.0", "php-mock/php-mock-mockery": "^1.2.0", - "ely/php-code-style": "^0.3.0", "predis/predis": "^1.1", "roave/security-advisories": "dev-master" }, diff --git a/composer.lock b/composer.lock index b6118c3..41b6d86 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "edb3d935ad36f30c49f8a4db6132747a", + "content-hash": "029519509cc9ceb2a06e09ba680257b2", "packages": [ { "name": "bacon/bacon-qr-code", @@ -118,7 +118,8 @@ "dist": { "type": "zip", "url": "https://api.github.com/repos/RobinHerbots/Inputmask/zipball/5e670ad62f50c738388d4dcec78d2888505ad77b", - "reference": "5e670ad62f50c738388d4dcec78d2888505ad77b" + "reference": "5e670ad62f50c738388d4dcec78d2888505ad77b", + "shasum": null }, "require": { "bower-asset/jquery": ">=1.7" @@ -139,7 +140,8 @@ "dist": { "type": "zip", "url": "https://api.github.com/repos/jquery/jquery-dist/zipball/77d2a51d0520d2ee44173afdf4e40a9201f5964e", - "reference": "77d2a51d0520d2ee44173afdf4e40a9201f5964e" + "reference": "77d2a51d0520d2ee44173afdf4e40a9201f5964e", + "shasum": null }, "type": "bower-asset", "license": [ @@ -157,7 +159,8 @@ "dist": { "type": "zip", "url": "https://api.github.com/repos/bestiejs/punycode.js/zipball/38c8d3131a82567bfef18da09f7f4db68c84f8a3", - "reference": "38c8d3131a82567bfef18da09f7f4db68c84f8a3" + "reference": "38c8d3131a82567bfef18da09f7f4db68c84f8a3", + "shasum": null }, "type": "bower-asset" }, @@ -172,7 +175,8 @@ "dist": { "type": "zip", "url": "https://api.github.com/repos/getsentry/raven-js-bower/zipball/c8b3a6040be6928e2f57fa5eec4d7afc31750235", - "reference": "c8b3a6040be6928e2f57fa5eec4d7afc31750235" + "reference": "c8b3a6040be6928e2f57fa5eec4d7afc31750235", + "shasum": null }, "type": "bower-asset" }, @@ -187,7 +191,8 @@ "dist": { "type": "zip", "url": "https://api.github.com/repos/yiisoft/jquery-pjax/zipball/aef7b953107264f00234902a3880eb50dafc48be", - "reference": "aef7b953107264f00234902a3880eb50dafc48be" + "reference": "aef7b953107264f00234902a3880eb50dafc48be", + "shasum": null }, "require": { "bower-asset/jquery": ">=1.8" @@ -2382,27 +2387,6 @@ ], "time": "2019-01-16T14:22:17+00:00" }, - { - "name": "bower-asset/bootstrap", - "version": "v3.4.1", - "source": { - "type": "git", - "url": "https://github.com/twbs/bootstrap.git", - "reference": "68b0d231a13201eb14acd3dc84e51543d16e5f7e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/twbs/bootstrap/zipball/68b0d231a13201eb14acd3dc84e51543d16e5f7e", - "reference": "68b0d231a13201eb14acd3dc84e51543d16e5f7e" - }, - "require": { - "bower-asset/jquery": ">=1.9.1,<4.0" - }, - "type": "bower-asset", - "license": [ - "MIT" - ] - }, { "name": "codeception/codeception", "version": "2.5.4", @@ -5700,160 +5684,6 @@ ], "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "time": "2017-04-07T12:08:54+00:00" - }, - { - "name": "yiisoft/yii2-bootstrap", - "version": "2.0.9", - "source": { - "type": "git", - "url": "https://github.com/yiisoft/yii2-bootstrap.git", - "reference": "4677951dda712dd99d5bf2a127eaee118dfea860" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/yiisoft/yii2-bootstrap/zipball/4677951dda712dd99d5bf2a127eaee118dfea860", - "reference": "4677951dda712dd99d5bf2a127eaee118dfea860", - "shasum": "" - }, - "require": { - "bower-asset/bootstrap": "3.4.* | 3.3.* | 3.2.* | 3.1.*", - "yiisoft/yii2": "~2.0.6" - }, - "type": "yii2-extension", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "yii\\bootstrap\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Paul Klimov", - "email": "klimov.paul@gmail.com" - }, - { - "name": "Alexander Makarov", - "email": "sam@rmcreative.ru", - "homepage": "http://rmcreative.ru/" - }, - { - "name": "Antonio Ramirez", - "email": "amigo.cobos@gmail.com" - }, - { - "name": "Qiang Xue", - "email": "qiang.xue@gmail.com", - "homepage": "http://www.yiiframework.com/" - } - ], - "description": "The Twitter Bootstrap extension for the Yii framework", - "keywords": [ - "bootstrap", - "yii2" - ], - "time": "2019-01-29T21:39:45+00:00" - }, - { - "name": "yiisoft/yii2-debug", - "version": "2.0.14", - "source": { - "type": "git", - "url": "https://github.com/yiisoft/yii2-debug.git", - "reference": "dc5a4a8529de1a41dbb037dbabf1f3f93002f21d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/yiisoft/yii2-debug/zipball/dc5a4a8529de1a41dbb037dbabf1f3f93002f21d", - "reference": "dc5a4a8529de1a41dbb037dbabf1f3f93002f21d", - "shasum": "" - }, - "require": { - "yiisoft/yii2": "~2.0.13", - "yiisoft/yii2-bootstrap": "~2.0.0" - }, - "type": "yii2-extension", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "yii\\debug\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Qiang Xue", - "email": "qiang.xue@gmail.com" - } - ], - "description": "The debugger extension for the Yii framework", - "keywords": [ - "debug", - "debugger", - "yii2" - ], - "time": "2018-09-23T21:41:04+00:00" - }, - { - "name": "yiisoft/yii2-faker", - "version": "2.0.4", - "source": { - "type": "git", - "url": "https://github.com/yiisoft/yii2-faker.git", - "reference": "3df62b1dcb272a8413f9c6e532c9d73f325ccde1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/yiisoft/yii2-faker/zipball/3df62b1dcb272a8413f9c6e532c9d73f325ccde1", - "reference": "3df62b1dcb272a8413f9c6e532c9d73f325ccde1", - "shasum": "" - }, - "require": { - "fzaninotto/faker": "~1.4", - "yiisoft/yii2": "~2.0.0" - }, - "type": "yii2-extension", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "yii\\faker\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Mark Jebri", - "email": "mark.github@yandex.ru" - } - ], - "description": "Fixture generator. The Faker integration for the Yii framework.", - "keywords": [ - "Fixture", - "faker", - "yii2" - ], - "time": "2018-02-19T20:27:10+00:00" } ], "aliases": [],