Skip to content

Commit

Permalink
Restructured doc, improved test
Browse files Browse the repository at this point in the history
  • Loading branch information
Hannes Giesenow committed Jan 8, 2024
1 parent 104e86c commit 47b22b9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
11 changes: 1 addition & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,7 @@ For more details and other installation methods, see
You can use pre-built Docker images to run ``php-cs-fixer``.

```console
docker run -v $(pwd):/code ghcr.io/php-cs-fixer/php-cs-fixer:$FIXER_VERSION fix src
```

Or integrate as check into Gitlab CI like this:

```yaml
php-cs-fixer:
image: ghcr.io/php-cs-fixer/php-cs-fixer:$FIXER_VERSION
script:
php-cs-fixer fix --diff --dry-run --format=txt src
docker run -v $(pwd):/code ghcr.io/php-cs-fixer/php-cs-fixer:${FIXER_VERSION:-3-php8.3} fix src
```

`$FIXER_VERSION` used in example above is an identifier of a release you want to use, which is based on Fixer and PHP versions combined. There are different tags for each Fixer's SemVer level and PHP version with syntax `<php-cs-fixer-version>-php<php-version>`. For example:
Expand Down
12 changes: 12 additions & 0 deletions doc/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,18 @@ Install `PHIVE <https://phar.io>`_ and issue the following command:
phive install php-cs-fixer # use `--global` for global install
Gitlab-CI (Docker)
~~~~~~~~~~~~~~~~~~

To integrate php-cs-fixer as check into Gitlab-CI, you can use a configuration like this:

.. code-block:: yaml
php-cs-fixer:
image: ghcr.io/php-cs-fixer/php-cs-fixer:$FIXER_VERSION
script:
php-cs-fixer fix --diff --dry-run --format=txt src
Update
------

Expand Down
11 changes: 4 additions & 7 deletions tests/AutoReview/CiConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,9 @@ private function getPhpVersionsUsedByGitHubDocker(): array
{
$yaml = Yaml::parse(file_get_contents(__DIR__.'/../../.github/workflows/docker.yml'));

$phpVersions = [];

foreach ($yaml['jobs']['build-and-push-image']['strategy']['matrix']['include'] as $job) {
$phpVersions[] = $job['php-version'];
}

return $phpVersions;
return array_map(
static fn($item) => $item['php-version'],
$yaml['jobs']['build-and-push-image']['strategy']['matrix']['include']
);
}
}

0 comments on commit 47b22b9

Please sign in to comment.