From c619e16bdb3b3c459653a874b4abce78b87a2e49 Mon Sep 17 00:00:00 2001 From: Dariusz Ruminski Date: Tue, 21 Dec 2021 14:58:47 +0000 Subject: [PATCH] Bump required PHP to 7.4 --- .github/workflows/ci.yml | 9 +++------ .php-cs-fixer.php-lowest.php | 4 ++-- composer.json | 2 +- dev-tools/build.sh | 2 +- doc/installation.rst | 2 +- docker-compose.override.yaml.dist | 6 +----- docker-compose.yaml | 10 ++-------- docker/php-7.2/Dockerfile | 26 -------------------------- docker/php-7.2/xdebug.ini | 4 ---- docker/php-7.3/Dockerfile | 26 -------------------------- docker/php-7.3/xdebug.ini | 4 ---- php-cs-fixer | 4 ++-- tests/Smoke/CiIntegrationTest.php | 2 +- 13 files changed, 14 insertions(+), 87 deletions(-) delete mode 100644 docker/php-7.2/Dockerfile delete mode 100644 docker/php-7.2/xdebug.ini delete mode 100644 docker/php-7.3/Dockerfile delete mode 100644 docker/php-7.3/xdebug.ini diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ac4642ad666..c18b2cc1cb6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,23 +11,20 @@ jobs: matrix: include: - operating-system: 'ubuntu-20.04' - php-version: '7.2' + php-version: '7.4' job-description: 'with lowest deps' composer-flags: '--prefer-stable --prefer-lowest' # should be checked on lowest supported PHP version - operating-system: 'ubuntu-20.04' - php-version: '7.2' + php-version: '7.4' job-description: 'with Sf ^4' execute-flex-with-symfony-version: '^4' # Explicit check for Sf 4.x compatibility - operating-system: 'ubuntu-20.04' - php-version: '7.3' + php-version: '7.4' job-description: 'with Sf ^5' execute-flex-with-symfony-version: '^5' # Explicit check for Sf 5.x compatibility - - operating-system: 'ubuntu-20.04' - php-version: '7.4' - - operating-system: 'ubuntu-20.04' php-version: '8.0' job-description: 'with Sf ^6' diff --git a/.php-cs-fixer.php-lowest.php b/.php-cs-fixer.php-lowest.php index 8b0a86ac69c..a8841fb6925 100644 --- a/.php-cs-fixer.php-lowest.php +++ b/.php-cs-fixer.php-lowest.php @@ -12,8 +12,8 @@ * with this source code in the file LICENSE. */ -if (PHP_VERSION_ID < 70205 || PHP_VERSION_ID >= 70300) { - fwrite(STDERR, "PHP CS Fixer's config for PHP-LOWEST can be executed only on lowest supported PHP version - ~7.2.5.\n"); +if (PHP_VERSION_ID < 70400 || PHP_VERSION_ID >= 70500) { + fwrite(STDERR, "PHP CS Fixer's config for PHP-LOWEST can be executed only on lowest supported PHP version - ~7.4.0.\n"); fwrite(STDERR, "Running it on higher PHP version would falsy expect more changes, eg `mixed` type on PHP 8.\n"); exit(1); diff --git a/composer.json b/composer.json index 5ef7410513e..35aad71e711 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ } ], "require": { - "php": "^7.2.5 || ^8.0", + "php": "^7.4 || ^8.0", "ext-json": "*", "ext-tokenizer": "*", "composer/semver": "^3.2", diff --git a/dev-tools/build.sh b/dev-tools/build.sh index 7c443212a78..c3a94814d8f 100755 --- a/dev-tools/build.sh +++ b/dev-tools/build.sh @@ -2,7 +2,7 @@ set -eu # ensure that deps will work on lowest supported PHP version -composer config platform.php 2> /dev/null || composer config platform.php 7.2.5 +composer config platform.php 2> /dev/null || composer config platform.php 7.4 # install package deps without dev-deps / remove already installed dev-deps # box can ignore dev-deps, but dev-deps, when installed, may lower version of prod-deps diff --git a/doc/installation.rst b/doc/installation.rst index 584126e4f07..fb6e9fe4053 100644 --- a/doc/installation.rst +++ b/doc/installation.rst @@ -5,7 +5,7 @@ Installation Requirements ------------ -PHP needs to be a minimum version of PHP 7.2.5. +PHP needs to be a minimum version of PHP 7.4. Installation ------------ diff --git a/docker-compose.override.yaml.dist b/docker-compose.override.yaml.dist index 79938cc8915..ef6e3e4199f 100644 --- a/docker-compose.override.yaml.dist +++ b/docker-compose.override.yaml.dist @@ -1,7 +1,7 @@ version: '3.8' services: - php-7.2: &php + php-7.4: &php build: args: DOCKER_USER_ID: 1000 # replace with your user id (most likely 1000) @@ -11,10 +11,6 @@ services: # Required for Docker Linux until natively supported. # See https://github.com/docker/for-linux/issues/264 host.docker.internal: 172.17.0.1 - php-7.3: - <<: *php - php-7.4: - <<: *php php-8.0: <<: *php php-8.1: diff --git a/docker-compose.yaml b/docker-compose.yaml index 71eb92637e8..c41ad338374 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,20 +1,14 @@ version: '3.8' services: - php-7.2: &php - build: docker/php-7.2 + php-7.4: &php + build: docker/php-7.4 working_dir: /app volumes: - .:/app environment: PHP_IDE_CONFIG: serverName=php-cs-fixer PHP_CS_FIXER_ALLOW_XDEBUG: 1 - php-7.3: - <<: *php - build: docker/php-7.3 - php-7.4: - <<: *php - build: docker/php-7.4 php-8.0: <<: *php build: docker/php-8.0 diff --git a/docker/php-7.2/Dockerfile b/docker/php-7.2/Dockerfile deleted file mode 100644 index 5c918abb906..00000000000 --- a/docker/php-7.2/Dockerfile +++ /dev/null @@ -1,26 +0,0 @@ -FROM php:7.2-cli-alpine3.12 - -ARG DOCKER_USER_ID -ARG DOCKER_GROUP_ID - -RUN if ! getent group "${DOCKER_GROUP_ID}" > /dev/null; \ - then addgroup -S -g "${DOCKER_GROUP_ID}" devs; \ - fi \ - && if ! getent passwd "${DOCKER_USER_ID}" > /dev/null; \ - then adduser -S -u "${DOCKER_USER_ID}" -G "$(getent group "${DOCKER_GROUP_ID}" | awk -F: '{printf $1}')" dev; \ - fi \ - # php extensions - && curl --location --output /usr/local/bin/install-php-extensions https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions \ - && chmod +x /usr/local/bin/install-php-extensions \ - && sync \ - && install-php-extensions \ - xdebug-3.1.2 \ - # composer - && curl --output composer-setup.php https://getcomposer.org/installer \ - && php composer-setup.php --install-dir=/usr/local/bin --filename=composer \ - && rm composer-setup.php \ - # xdebug command - && curl --location --output /usr/local/bin/xdebug https://github.com/julienfalque/xdebug/releases/download/v2.0.0/xdebug \ - && chmod +x /usr/local/bin/xdebug - -COPY xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini diff --git a/docker/php-7.2/xdebug.ini b/docker/php-7.2/xdebug.ini deleted file mode 100644 index cd4b802e88a..00000000000 --- a/docker/php-7.2/xdebug.ini +++ /dev/null @@ -1,4 +0,0 @@ -;zend_extension=xdebug.so -xdebug.client_host=host.docker.internal -xdebug.mode=debug -xdebug.start_with_request=yes diff --git a/docker/php-7.3/Dockerfile b/docker/php-7.3/Dockerfile deleted file mode 100644 index 7e337e11289..00000000000 --- a/docker/php-7.3/Dockerfile +++ /dev/null @@ -1,26 +0,0 @@ -FROM php:7.3-cli-alpine3.15 - -ARG DOCKER_USER_ID -ARG DOCKER_GROUP_ID - -RUN if ! getent group "${DOCKER_GROUP_ID}" > /dev/null; \ - then addgroup -S -g "${DOCKER_GROUP_ID}" devs; \ - fi \ - && if ! getent passwd "${DOCKER_USER_ID}" > /dev/null; \ - then adduser -S -u "${DOCKER_USER_ID}" -G "$(getent group "${DOCKER_GROUP_ID}" | awk -F: '{printf $1}')" dev; \ - fi \ - # php extensions - && curl --location --output /usr/local/bin/install-php-extensions https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions \ - && chmod +x /usr/local/bin/install-php-extensions \ - && sync \ - && install-php-extensions \ - xdebug-3.1.2 \ - # composer - && curl --output composer-setup.php https://getcomposer.org/installer \ - && php composer-setup.php --install-dir=/usr/local/bin --filename=composer \ - && rm composer-setup.php \ - # xdebug command - && curl --location --output /usr/local/bin/xdebug https://github.com/julienfalque/xdebug/releases/download/v2.0.0/xdebug \ - && chmod +x /usr/local/bin/xdebug - -COPY xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini diff --git a/docker/php-7.3/xdebug.ini b/docker/php-7.3/xdebug.ini deleted file mode 100644 index cd4b802e88a..00000000000 --- a/docker/php-7.3/xdebug.ini +++ /dev/null @@ -1,4 +0,0 @@ -;zend_extension=xdebug.so -xdebug.client_host=host.docker.internal -xdebug.mode=debug -xdebug.start_with_request=yes diff --git a/php-cs-fixer b/php-cs-fixer index 38c5a082c7c..c1442aab427 100755 --- a/php-cs-fixer +++ b/php-cs-fixer @@ -39,10 +39,10 @@ set_error_handler(static function ($severity, $message, $file, $line) { exit(1); } elseif ( - \PHP_VERSION_ID < 70205 + \PHP_VERSION_ID < 70400 || \PHP_VERSION_ID >= 80200 ) { - fwrite(STDERR, "PHP needs to be a minimum version of PHP 7.2.5 and maximum version of PHP 8.1.*.\n"); + fwrite(STDERR, "PHP needs to be a minimum version of PHP 7.4.0 and maximum version of PHP 8.1.*.\n"); fwrite(STDERR, 'Current PHP version: '.PHP_VERSION.".\n"); if (getenv('PHP_CS_FIXER_IGNORE_ENV')) { diff --git a/tests/Smoke/CiIntegrationTest.php b/tests/Smoke/CiIntegrationTest.php index bf4a0eb2211..f1cf541be67 100644 --- a/tests/Smoke/CiIntegrationTest.php +++ b/tests/Smoke/CiIntegrationTest.php @@ -148,7 +148,7 @@ public function testIntegration( You may find an UPGRADE guide at https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/v4.0.0/UPGRADE-v4.md . '; - $optionalIncompatibilityWarning = 'PHP needs to be a minimum version of PHP 7.2.5 and maximum version of PHP 8.1.*. + $optionalIncompatibilityWarning = 'PHP needs to be a minimum version of PHP 7.4.0 and maximum version of PHP 8.1.*. Current PHP version: '.PHP_VERSION.'. Ignoring environment requirements because `PHP_CS_FIXER_IGNORE_ENV` is set. Execution may be unstable. ';