Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

README: improve documentation #80

Merged
merged 2 commits into from
Dec 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ The application is officially supported for use with PHP 5.3 to 8.1.
3. [History](#history)
4. [Command line options](#command-line-options)
5. [Recommended excludes for Symfony framework](#recommended-excludes-for-symfony-framework)
6. [How to upgrade](#how-to-upgrade)
6. [Excluding files from a scan based on the PHP version used](#excluding-files-from-a-scan-based-on-the-PHP version-used)
7. [How to upgrade](#how-to-upgrade)

## Installation

Expand All @@ -35,7 +36,7 @@ Alternatively you can install as a standalone `composer` project:
For colored output, install the suggested package `php-parallel-lint/php-console-highlighter`:

composer require --dev php-parallel-lint/php-console-highlighter

Since v1.3.0, a PHAR file is also made available for each release.
This PHAR file is published as an asset for each release and can be found on the [Releases](https://github.com/php-parallel-lint/PHP-Parallel-Lint/releases) page.

Expand Down Expand Up @@ -91,7 +92,25 @@ It is strongly recommended for existing users of the (unmaintained)

To run from the command line:

vendor/bin/parallel-lint --exclude app --exclude vendor .
vendor/bin/parallel-lint --exclude .git --exclude app --exclude vendor .


## Excluding files from a scan based on the PHP version used

Sometimes a particular file in a project may not comply with the project-wide minimum PHP version, like a file which is conditionally included in the project and contains PHP syntax which needs a higher PHP version to run.

This can make it complicated to run Parallel Lint in a CI context, as the `exclude`s used in the command would have to be adjusted based on the PHP version on which the scan is being run.

PHP Parallel Lint offers a straight-forward way around this, as files can define their own minimum PHP version like so:
```php
<?php // lint >= 7.4

// Code which contains PHP 7.4 syntax.
```

With this comment in place, the file will be automatically skipped when PHP Parallel Lint is run on a PHP version lower than PHP 7.4.

Note: The `// lint >= 7.4` comment has to be only the first line of the file and must directly follow the PHP open tag.


## How to upgrade
Expand Down