Upgrade PHP to 7.3 and fix some related code errors. Disable self_accessor fixer for PHP-CS-Fixer

This commit is contained in:
ErickSkrauch 2019-04-06 04:15:23 +02:00
parent 07546bc7e9
commit e13b6f0d94
10 changed files with 38 additions and 219 deletions

View File

@ -6,8 +6,8 @@ stages:
variables: variables:
CONTAINER_IMAGE: "registry.ely.by/elyby/accounts" CONTAINER_IMAGE: "registry.ely.by/elyby/accounts"
check backend codestyle: php-cs-fixer:
image: edbizarro/gitlab-ci-pipeline-php:7.2-alpine image: edbizarro/gitlab-ci-pipeline-php:7.3-alpine
stage: test stage: test
cache: cache:
key: backend-vendor key: backend-vendor
@ -17,8 +17,8 @@ check backend codestyle:
- composer install - composer install
- vendor/bin/php-cs-fixer fix -v --dry-run - vendor/bin/php-cs-fixer fix -v --dry-run
test backend: codeception:
image: edbizarro/gitlab-ci-pipeline-php:7.2-alpine image: edbizarro/gitlab-ci-pipeline-php:7.3-alpine
services: services:
- name: redis:4.0.10-alpine - name: redis:4.0.10-alpine
alias: redis alias: redis

View File

@ -12,5 +12,6 @@ $finder = \PhpCsFixer\Finder::create()
->notPath('/.*\/tests\/_support\/_generated/') ->notPath('/.*\/tests\/_support\/_generated/')
->name('yii'); ->name('yii');
return \Ely\CS\Config::create() return \Ely\CS\Config::create([
->setFinder($finder); 'self_accessor' => false,
])->setFinder($finder);

View File

@ -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 # bash needed to support wait-for-it script
RUN apk add --update --no-cache \ RUN apk add --update --no-cache \
@ -7,6 +11,7 @@ RUN apk add --update --no-cache \
openssh \ openssh \
dcron \ dcron \
zlib-dev \ zlib-dev \
libzip-dev \
icu-dev \ icu-dev \
libintl \ libintl \
imagemagick-dev \ imagemagick-dev \
@ -18,7 +23,7 @@ RUN apk add --update --no-cache \
pcntl \ pcntl \
opcache \ opcache \
&& apk add --no-cache --virtual ".phpize-deps" $PHPIZE_DEPS \ && 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 \ && yes | pecl install imagick \
&& docker-php-ext-enable imagick \ && docker-php-ext-enable imagick \
&& apk del ".phpize-deps" \ && apk del ".phpize-deps" \
@ -26,17 +31,13 @@ RUN apk add --update --no-cache \
&& rm -rf /tmp/* \ && rm -rf /tmp/* \
&& mkdir /etc/cron.d && mkdir /etc/cron.d
COPY --from=composer:1.6.5 /usr/bin/composer /usr/bin/composer COPY --from=composer:1.8.4 /usr/bin/composer /usr/bin/composer
COPY --from=node:9.11.2-alpine /usr/local/bin/node /usr/bin/ COPY --from=node:11.13.0-alpine /usr/local/bin/node /usr/bin/
COPY --from=node:9.11.2-alpine /usr/lib/libgcc* /usr/lib/libstdc* /usr/lib/* /usr/lib/ COPY --from=node:11.13.0-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
RUN mkdir /root/.composer \ RUN mkdir /root/.composer \
&& echo '{"github-oauth": {"github.com": "***REMOVED***"}}' > ~/.composer/auth.json \ && 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 && composer clear-cache
COPY ./docker/php/wait-for-it.sh /usr/local/bin/wait-for-it COPY ./docker/php/wait-for-it.sh /usr/local/bin/wait-for-it

View File

@ -1,4 +1,6 @@
<?php <?php
declare(strict_types=1);
namespace api\components\User; namespace api\components\User;
use common\models\Account; use common\models\Account;
@ -12,7 +14,7 @@ interface IdentityInterface extends \yii\web\IdentityInterface {
* @throws \yii\web\UnauthorizedHttpException * @throws \yii\web\UnauthorizedHttpException
* @return IdentityInterface * @return IdentityInterface
*/ */
public static function findIdentityByAccessToken($token, $type = null): self; public static function findIdentityByAccessToken($token, $type = null): IdentityInterface;
/** /**
* Этот метод используется для получения токена, к которому привязаны права. * Этот метод используется для получения токена, к которому привязаны права.

View File

@ -1,16 +1,9 @@
<?php <?php
return [ return [
'bootstrap' => ['debug'],
'components' => [ 'components' => [
'reCaptcha' => [ 'reCaptcha' => [
'public' => '6LfwqCYTAAAAAJlaJpqCdzESCjAXUC81Ca6jBHR7', 'public' => '6LfwqCYTAAAAAJlaJpqCdzESCjAXUC81Ca6jBHR7',
'secret' => '6LfwqCYTAAAAAFPjHmgwmnjSMFeAOJh7Lk5xxDMC', 'secret' => '6LfwqCYTAAAAAFPjHmgwmnjSMFeAOJh7Lk5xxDMC',
], ],
], ],
'modules' => [
'debug' => [
'class' => yii\debug\Module::class,
'allowedIPs' => ['*'],
],
],
]; ];

View File

@ -1,9 +0,0 @@
<?php
return [
'components' => [
'reCaptcha' => [
'public' => getenv('RECAPTCHA_PUBLIC'),
'secret' => getenv('RECAPTCHA_SECRET'),
],
],
];

View File

@ -67,6 +67,8 @@ return [
], ],
'reCaptcha' => [ 'reCaptcha' => [
'class' => api\components\ReCaptcha\Component::class, 'class' => api\components\ReCaptcha\Component::class,
'public' => getenv('RECAPTCHA_PUBLIC'),
'secret' => getenv('RECAPTCHA_SECRET'),
], ],
'response' => [ 'response' => [
'format' => yii\web\Response::FORMAT_JSON, 'format' => yii\web\Response::FORMAT_JSON,

View File

@ -31,7 +31,7 @@ class UsernameValidator extends Validator {
$length->tooShort = E::USERNAME_TOO_SHORT; $length->tooShort = E::USERNAME_TOO_SHORT;
$length->tooLong = E::USERNAME_TOO_LONG; $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; $pattern->message = E::USERNAME_INVALID;
$unique = new validators\UniqueValidator(); $unique = new validators\UniqueValidator();

View File

@ -30,15 +30,14 @@
"yiisoft/yii2-queue": "~2.1.0" "yiisoft/yii2-queue": "~2.1.0"
}, },
"require-dev": { "require-dev": {
"yiisoft/yii2-debug": "*",
"yiisoft/yii2-faker": "*",
"flow/jsonpath": "^0.4.0",
"codeception/codeception": "^2.5.3", "codeception/codeception": "^2.5.3",
"codeception/specify": "^1.0.0", "codeception/specify": "^1.0.0",
"codeception/verify": "*", "codeception/verify": "*",
"ely/php-code-style": "^0.3.0",
"flow/jsonpath": "^0.4.0",
"fzaninotto/faker": "^1.8",
"mockery/mockery": "^1.0.0", "mockery/mockery": "^1.0.0",
"php-mock/php-mock-mockery": "^1.2.0", "php-mock/php-mock-mockery": "^1.2.0",
"ely/php-code-style": "^0.3.0",
"predis/predis": "^1.1", "predis/predis": "^1.1",
"roave/security-advisories": "dev-master" "roave/security-advisories": "dev-master"
}, },

192
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "edb3d935ad36f30c49f8a4db6132747a", "content-hash": "029519509cc9ceb2a06e09ba680257b2",
"packages": [ "packages": [
{ {
"name": "bacon/bacon-qr-code", "name": "bacon/bacon-qr-code",
@ -118,7 +118,8 @@
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/RobinHerbots/Inputmask/zipball/5e670ad62f50c738388d4dcec78d2888505ad77b", "url": "https://api.github.com/repos/RobinHerbots/Inputmask/zipball/5e670ad62f50c738388d4dcec78d2888505ad77b",
"reference": "5e670ad62f50c738388d4dcec78d2888505ad77b" "reference": "5e670ad62f50c738388d4dcec78d2888505ad77b",
"shasum": null
}, },
"require": { "require": {
"bower-asset/jquery": ">=1.7" "bower-asset/jquery": ">=1.7"
@ -139,7 +140,8 @@
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/jquery/jquery-dist/zipball/77d2a51d0520d2ee44173afdf4e40a9201f5964e", "url": "https://api.github.com/repos/jquery/jquery-dist/zipball/77d2a51d0520d2ee44173afdf4e40a9201f5964e",
"reference": "77d2a51d0520d2ee44173afdf4e40a9201f5964e" "reference": "77d2a51d0520d2ee44173afdf4e40a9201f5964e",
"shasum": null
}, },
"type": "bower-asset", "type": "bower-asset",
"license": [ "license": [
@ -157,7 +159,8 @@
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/bestiejs/punycode.js/zipball/38c8d3131a82567bfef18da09f7f4db68c84f8a3", "url": "https://api.github.com/repos/bestiejs/punycode.js/zipball/38c8d3131a82567bfef18da09f7f4db68c84f8a3",
"reference": "38c8d3131a82567bfef18da09f7f4db68c84f8a3" "reference": "38c8d3131a82567bfef18da09f7f4db68c84f8a3",
"shasum": null
}, },
"type": "bower-asset" "type": "bower-asset"
}, },
@ -172,7 +175,8 @@
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/getsentry/raven-js-bower/zipball/c8b3a6040be6928e2f57fa5eec4d7afc31750235", "url": "https://api.github.com/repos/getsentry/raven-js-bower/zipball/c8b3a6040be6928e2f57fa5eec4d7afc31750235",
"reference": "c8b3a6040be6928e2f57fa5eec4d7afc31750235" "reference": "c8b3a6040be6928e2f57fa5eec4d7afc31750235",
"shasum": null
}, },
"type": "bower-asset" "type": "bower-asset"
}, },
@ -187,7 +191,8 @@
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/yiisoft/jquery-pjax/zipball/aef7b953107264f00234902a3880eb50dafc48be", "url": "https://api.github.com/repos/yiisoft/jquery-pjax/zipball/aef7b953107264f00234902a3880eb50dafc48be",
"reference": "aef7b953107264f00234902a3880eb50dafc48be" "reference": "aef7b953107264f00234902a3880eb50dafc48be",
"shasum": null
}, },
"require": { "require": {
"bower-asset/jquery": ">=1.8" "bower-asset/jquery": ">=1.8"
@ -2382,27 +2387,6 @@
], ],
"time": "2019-01-16T14:22:17+00:00" "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", "name": "codeception/codeception",
"version": "2.5.4", "version": "2.5.4",
@ -5700,160 +5684,6 @@
], ],
"description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "description": "A small library for converting tokenized PHP source code into XML and potentially other formats",
"time": "2017-04-07T12:08:54+00:00" "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": [], "aliases": [],