Skip to content

Commit

Permalink
Merge branch '2.17' into list-files-cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
clxmstaab committed Jan 23, 2021
2 parents 194e6fe + 27b5b56 commit 78eaee3
Show file tree
Hide file tree
Showing 59 changed files with 1,303 additions and 65 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Expand Up @@ -13,6 +13,9 @@
/benchmark.sh export-ignore
/box.json.dist export-ignore
/dev-tools/ export-ignore
/docker/ export-ignore
/docker-compose.yaml export-ignore
/docker-compose.override.yaml.dist export-ignore
/phpmd.xml export-ignore
/phpstan.neon export-ignore
/phpunit.xml.dist export-ignore
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Expand Up @@ -87,6 +87,7 @@ jobs:
tools: flex
env:
fail-fast: false # disabled as old PHP version cannot run flex
update: ${{ matrix.php-version == '8.0' }} # force update to 8.0.1+, ref https://github.com/shivammathur/setup-php/issues/394#issuecomment-760461251

- name: Get Composer cache directory
id: composer-cache
Expand Down Expand Up @@ -119,7 +120,7 @@ jobs:
- name: Execute migration rules
if: matrix.execute-migration-rules == 'yes'
run: php php-cs-fixer fix --rules @PHP73Migration,@PHP71Migration:risky,blank_line_after_opening_tag -q
run: php php-cs-fixer fix --rules @PHP80Migration,@PHP80Migration:risky,blank_line_after_opening_tag -q

- name: Disable time limit for tests when collecting coverage
if: matrix.calculate-code-coverage == 'yes'
Expand All @@ -144,7 +145,7 @@ jobs:
env:
PHP_CS_FIXER_IGNORE_ENV: ${{ matrix.PHP_CS_FIXER_IGNORE_ENV }}
PHP_CS_FIXER_FUTURE_MODE: 1
run: php php-cs-fixer --diff --dry-run -v fix
run: php php-cs-fixer fix --diff --dry-run -v

- name: Execute deployment checks
if: matrix.execute-deployment == 'yes'
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -2,6 +2,7 @@
/.phpunit.result.cache
/box.json
/composer.lock
/docker-compose.override.yaml
/php-cs-fixer.phar
/phpunit.xml
/vendor/
43 changes: 43 additions & 0 deletions CHANGELOG.md
Expand Up @@ -3,6 +3,49 @@ CHANGELOG for PHP CS Fixer

This file contains changelogs for stable releases only.

Changelog for v2.17.5
---------------------

* bug #5447 switch_case_semicolon_to_colon should skip match/default statements (derrabus)
* bug #5453 SingleSpaceAfterConstructFixer - better handling of closing parenthesis and brace (keradus)
* bug #5454 NullableTypeDeclarationForDefaultNullValueFixer - support property promotion via constructor (keradus)
* bug #5455 PhpdocToCommentFixer - add support for attributes (keradus)
* bug #5462 NullableTypeDeclarationForDefaultNullValueFixer - support union types (keradus)
* minor #5445 DX: update usage of old TraversableContains in tests (keradus)
* minor #5456 DX: Fix CiIntegrationTest (keradus)
* minor #5457 CI: fix params order (keradus)
* minor #5459 DX: cleanup PHP Migration rulesets (keradus)

Changelog for v2.17.4
---------------------

* bug #5379 PhpUnitMethodCasingFixer - Do not modify class name (localheinz)
* bug #5404 NullableTypeTransformer - constructor property promotion support (Wirone)
* bug #5433 PhpUnitTestCaseStaticMethodCallsFixer - fix for abstract static method (kubawerlos)
* minor #5234 DX: Add Docker dev setup (julienfalque, keradus)
* minor #5391 PhpdocOrderByValueFixer - Add additional annotations to sort (localheinz)
* minor #5392 PhpdocScalarFixer - Fix description (localheinz)
* minor #5397 NoExtraBlankLinesFixer - PHP8 throw support (SpacePossum)
* minor #5399 Add PHP8 integration test (keradus)
* minor #5405 TypeAlternationTransformer - add support for PHP8 (SpacePossum)
* minor #5406 SingleSpaceAfterConstructFixer - Attributes, comments and PHPDoc support (SpacePossum)
* minor #5407 TokensAnalyzer::getClassyElements - return trait imports (SpacePossum)
* minor #5410 minors (SpacePossum)
* minor #5411 bump year in LICENSE file (SpacePossum)
* minor #5414 TypeAlternationTransformer - T_FN support (SpacePossum)
* minor #5415 Forbid execution under PHP 8.0.0 (keradus)
* minor #5416 Drop Travis CI (keradus)
* minor #5419 CI: separate SCA checks to dedicated jobs (keradus)
* minor #5420 DX: unblock PHPUnit 9.5 (keradus)
* minor #5423 DX: PHPUnit - disable verbose by default (keradus)
* minor #5425 Cleanup 3.0 todos (keradus)
* minor #5427 Plan changing defaults for array_syntax and list_syntax in 3.0 release (keradus)
* minor #5429 DX: Drop speedtrap PHPUnit listener (keradus)
* minor #5432 Don't allow unserializing classes with a destructor (jderusse)
* minor #5435 DX: PHPUnit - groom configuration of time limits (keradus)
* minor #5439 VisibilityRequiredFixer - support type alternation for properties (keradus)
* minor #5442 DX: FunctionsAnalyzerTest - add missing 7.0 requirement (keradus)

Changelog for v2.17.3
---------------------

Expand Down
46 changes: 46 additions & 0 deletions CONTRIBUTING.md
Expand Up @@ -34,6 +34,52 @@ Symfony projects for instance).
* Check if tests pass: `vendor/bin/phpunit`.
* Fix project itself: `php php-cs-fixer fix`.

## Working With Docker

This project provides a Docker setup that allows working on it using any of the supported PHP versions.

To use it, you first need to install:

* [Docker](https://docs.docker.com/get-docker/)
* [Docker Compose](https://docs.docker.com/compose/install/)

Make sure the versions installed support [Compose file format 3.8](https://docs.docker.com/compose/compose-file/).

Next, copy [`docker-compose.override.yaml.dist`](./docker-compose.override.yaml.dist) to `docker-compose.override.yaml`
and edit it to your needs. The relevant parameters that might require some tweaking have comments to help you.

You can then build the images:

```console
$ docker-compose build --parallel
```

Now you can run commands needed to work on the project. For example, say you want to run PHPUnit tests on PHP 7.4:

```console
$ docker-compose run php-7.4 vendor/bin/phpunit
```

Sometimes it can be more convenient to have a shell inside the container:

```console
$ docker-compose run php-7.4 sh
/app $ vendor/bin/phpunit
```

The images come with an [`xdebug` script](github.com/julienfalque/xdebug/) that allows running any PHP command with
Xdebug enabled to help debug problems.

```console
docker-compose run php-7.4 xdebug vendor/bin/phpunit
```

If you're using PhpStorm, you need to create a [server](https://www.jetbrains.com/help/phpstorm/servers.html) with a
name that matches the `PHP_IDE_CONFIG` environment variable defined in the Docker Compose configuration files, which is
`php-cs-fixer` by default.

All images use port 9003 for debug connections.

## Opening a [Pull Request](https://help.github.com/articles/about-pull-requests/)

You can do some things to increase the chance that your Pull Request is accepted the first time:
Expand Down
3 changes: 1 addition & 2 deletions doc/ruleSets/PHP80Migration.rst
Expand Up @@ -7,7 +7,6 @@ Rules to improve code for PHP 8.0 compatibility.
Rules
-----

- `@PHP73Migration <./PHP73Migration.rst>`_
- `@PHP74Migration <./PHP74Migration.rst>`_
- `clean_namespace <./../rules/namespace_notation/clean_namespace.rst>`_
- `no_unset_cast <./../rules/cast_notation/no_unset_cast.rst>`_
- `normalize_index_brace <./../rules/array_notation/normalize_index_brace.rst>`_
3 changes: 1 addition & 2 deletions doc/ruleSets/PHP80MigrationRisky.rst
Expand Up @@ -7,8 +7,7 @@ Rules to improve code for PHP 8.0 compatibility. This set contains rules that ar
Rules
-----

- `@PHP71Migration:risky <./PHP71MigrationRisky.rst>`_
- `implode_call <./../rules/function_notation/implode_call.rst>`_
- `@PHP74Migration:risky <./PHP74MigrationRisky.rst>`_
- `no_alias_functions <./../rules/alias/no_alias_functions.rst>`_
config:
``['sets' => ['@all']]``
Expand Down
3 changes: 3 additions & 0 deletions doc/rules/cast_notation/short_scalar_cast.rst
Expand Up @@ -57,6 +57,9 @@ The rule is part of the following rule sets:
@PHP74Migration
Using the `@PHP74Migration <./../../ruleSets/PHP74Migration.rst>`_ rule set will enable the ``short_scalar_cast`` rule.

@PHP80Migration
Using the `@PHP80Migration <./../../ruleSets/PHP80Migration.rst>`_ rule set will enable the ``short_scalar_cast`` rule.

@PhpCsFixer
Using the `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_ rule set will enable the ``short_scalar_cast`` rule.

Expand Down
5 changes: 4 additions & 1 deletion doc/rules/function_notation/use_arrow_functions.rst
Expand Up @@ -29,7 +29,10 @@ Example #1
Rule sets
---------

The rule is part of the following rule set:
The rule is part of the following rule sets:

@PHP74Migration:risky
Using the `@PHP74Migration:risky <./../../ruleSets/PHP74MigrationRisky.rst>`_ rule set will enable the ``use_arrow_functions`` rule.

@PHP80Migration:risky
Using the `@PHP80Migration:risky <./../../ruleSets/PHP80MigrationRisky.rst>`_ rule set will enable the ``use_arrow_functions`` rule.
25 changes: 25 additions & 0 deletions docker-compose.override.yaml.dist
@@ -0,0 +1,25 @@
version: '3.8'

services:
php-5.6: &php
build:
args:
DOCKER_USER_ID: 1000 # replace with your user id (most likely 1000)
DOCKER_GROUP_ID: 1000 # replace with your group id (most likely 1000)
user: 1000:1000 # replace with your user and group ids (most likely 1000:1000)
extra_hosts:
# 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.0:
<<: *php
php-7.1:
<<: *php
php-7.2:
<<: *php
php-7.3:
<<: *php
php-7.4:
<<: *php
php-8.0:
<<: *php
29 changes: 29 additions & 0 deletions docker-compose.yaml
@@ -0,0 +1,29 @@
version: '3.8'

services:
php-5.6: &php
build: docker/php-5.6
working_dir: /app
volumes:
- .:/app
environment:
PHP_IDE_CONFIG: serverName=php-cs-fixer
PHP_CS_FIXER_ALLOW_XDEBUG: 1
php-7.0:
<<: *php
build: docker/php-7.0
php-7.1:
<<: *php
build: docker/php-7.1
php-7.2:
<<: *php
build: docker/php-7.2
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
27 changes: 27 additions & 0 deletions docker/php-5.6/Dockerfile
@@ -0,0 +1,27 @@
FROM php:5.6-cli-alpine3.8

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 \
&& apk add --no-cache git libxml2-dev openssh-client \
&& apk add --no-cache --virtual .build-deps autoconf g++ make \
# xdebug
&& pecl install xdebug-2.5.5 \
&& docker-php-ext-enable xdebug \
# 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/v1.1.0/xdebug \
&& chmod +x /usr/local/bin/xdebug \
# clean up
&& apk del .build-deps

COPY xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
5 changes: 5 additions & 0 deletions docker/php-5.6/xdebug.ini
@@ -0,0 +1,5 @@
;zend_extension=xdebug.so
xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.remote_host=host.docker.internal
xdebug.remote_port=9003
27 changes: 27 additions & 0 deletions docker/php-7.0/Dockerfile
@@ -0,0 +1,27 @@
FROM php:7.0-cli-alpine3.7

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 \
&& apk add --no-cache git libxml2-dev openssh-client \
&& apk add --no-cache --virtual .build-deps autoconf g++ make \
# xdebug
&& pecl install xdebug-2.7.2 \
&& docker-php-ext-enable xdebug \
# 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/v1.1.0/xdebug \
&& chmod +x /usr/local/bin/xdebug \
# clean up
&& apk del .build-deps

COPY xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
5 changes: 5 additions & 0 deletions docker/php-7.0/xdebug.ini
@@ -0,0 +1,5 @@
;zend_extension=xdebug.so
xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.remote_host=host.docker.internal
xdebug.remote_port=9003
27 changes: 27 additions & 0 deletions docker/php-7.1/Dockerfile
@@ -0,0 +1,27 @@
FROM php:7.1-cli-alpine3.10

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 \
&& apk add --no-cache git libxml2-dev openssh-client \
&& apk add --no-cache --virtual .build-deps autoconf g++ make \
# xdebug
&& pecl install xdebug-2.9.8 \
&& docker-php-ext-enable xdebug \
# 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/v1.1.0/xdebug \
&& chmod +x /usr/local/bin/xdebug \
# clean up
&& apk del .build-deps

COPY xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
5 changes: 5 additions & 0 deletions docker/php-7.1/xdebug.ini
@@ -0,0 +1,5 @@
;zend_extension=xdebug.so
xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.remote_host=host.docker.internal
xdebug.remote_port=9003
27 changes: 27 additions & 0 deletions docker/php-7.2/Dockerfile
@@ -0,0 +1,27 @@
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 \
&& apk add --no-cache git libxml2-dev openssh-client \
&& apk add --no-cache --virtual .build-deps autoconf g++ make \
# xdebug
&& pecl install xdebug-2.9.8 \
&& docker-php-ext-enable xdebug \
# 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 \
# clean up
&& apk del .build-deps

COPY xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
5 changes: 5 additions & 0 deletions docker/php-7.2/xdebug.ini
@@ -0,0 +1,5 @@
;zend_extension=xdebug.so
xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.remote_host=host.docker.internal
xdebug.remote_port=9003

0 comments on commit 78eaee3

Please sign in to comment.