Skip to content

Commit 4838574

Browse files
arxeissgrogy
authored andcommitted
Add doc
1 parent 1cef4e1 commit 4838574

File tree

3 files changed

+50
-18
lines changed

3 files changed

+50
-18
lines changed

README.md

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,24 @@ This is a fork of [original project](https://github.com/JakubOnderka/PHP-Paralle
4848

4949
## Options for run
5050

51-
- `-p <php>` Specify PHP-CGI executable to run (default: 'php').
52-
- `-s, --short` Set short_open_tag to On (default: Off).
53-
- `-a, --asp` Set asp_tags to On (default: Off).
54-
- `-e <ext>` Check only files with selected extensions separated by comma. (default: php,php3,php4,php5,phtml,phpt)
55-
- `--exclude` Exclude a file or directory. If you want exclude multiple items, use multiple exclude parameters.
56-
- `-j <num>` Run <num> jobs in parallel (default: 10).
57-
- `--colors` Force enable colors in console output.
58-
- `--no-colors` Disable colors in console output.
59-
- `--no-progress` Disable progress in console output.
60-
- `--checkstyle` Output results as Checkstyle XML.
61-
- `--json` Output results as JSON string (require PHP 5.4).
62-
- `--blame` Try to show git blame for row with error.
63-
- `--git <git>` Path to Git executable to show blame message (default: 'git').
64-
- `--stdin` Load files and folder to test from standard input.
65-
- `--ignore-fails` Ignore failed tests.
66-
- `-h, --help` Print this help.
67-
- `-V, --version` Display this application version.
51+
- `-p <php>` Specify PHP-CGI executable to run (default: 'php').
52+
- `-s, --short` Set short_open_tag to On (default: Off).
53+
- `-a, --asp` Set asp_tags to On (default: Off).
54+
- `-e <ext>` Check only files with selected extensions separated by comma. (default: php,php3,php4,php5,phtml,phpt)
55+
- `--exclude` Exclude a file or directory. If you want exclude multiple items, use multiple exclude parameters.
56+
- `-j <num>` Run <num> jobs in parallel (default: 10).
57+
- `--colors` Force enable colors in console output.
58+
- `--no-colors` Disable colors in console output.
59+
- `--no-progress` Disable progress in console output.
60+
- `--checkstyle` Output results as Checkstyle XML.
61+
- `--json` Output results as JSON string (require PHP 5.4).
62+
- `--blame` Try to show git blame for row with error.
63+
- `--git <git>` Path to Git executable to show blame message (default: 'git').
64+
- `--stdin` Load files and folder to test from standard input.
65+
- `--ignore-fails` Ignore failed tests.
66+
- `--syntax-error-callback` File with syntax error callback for ability to modify error, see more in [example](doc/syntax-error-callback.md)
67+
- `-h, --help` Print this help.
68+
- `-V, --version` Display this application version.
6869

6970

7071
## Recommended setting for usage with Symfony framework

doc/syntax-error-callback.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Syntax Error Callback
2+
3+
1. Set a path to a file with custom error callback to `--syntax-error-callback` option.
4+
1. Create a class implementing `JakubOnderka\PhpParallelLint\Contracts\SyntaxErrorCallback` interface. File with the class must have the same name as the class inside.
5+
1. Modify error before it is printed to the output.
6+
7+
## Configuration
8+
9+
File `MyCustomErrorHandler.php` will be passed as an argument like `./parallel-lint --syntax-error-callback ./path/to/MyCustomErrorHandler.php .`.
10+
The content should look like:
11+
12+
```php
13+
14+
use JakubOnderka\PhpParallelLint\Contracts\SyntaxErrorCallback;
15+
use JakubOnderka\PhpParallelLint\SyntaxError;
16+
17+
class MyCustomErrorHandler implements SyntaxErrorCallback {
18+
/**
19+
* @param SyntaxError $error
20+
* @return SyntaxError
21+
*/
22+
public function errorFound(SyntaxError $error){
23+
// Return new SyntaxError with custom modification to FilePath or Message
24+
// Or return completely new SyntaxError extending the original one...
25+
return new SyntaxError(
26+
$error->getFilePath(),
27+
$error->getMessage()
28+
);
29+
}
30+
}
31+
```

src/Application.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ private function showOptions()
9292
--git <git> Path to Git executable to show blame message (default: 'git').
9393
--stdin Load files and folder to test from standard input.
9494
--ignore-fails Ignore failed tests.
95-
--syntax-error-callback File with syntax error callback for modifying error
95+
--syntax-error-callback File with syntax error callback for ability to modify error
9696
-h, --help Print this help.
9797
-V, --version Display this application version
9898

0 commit comments

Comments
 (0)