Skip to content

Commit 051ef24

Browse files
Add example configuration to class PHPDoc
1 parent 12973d9 commit 051ef24

File tree

10 files changed

+123
-67
lines changed

10 files changed

+123
-67
lines changed

src/Hook/Condition/Config/CustomValueIsTruthy.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,17 @@
2121
*
2222
* Example configuration:
2323
*
24-
* "action": "some-action"
25-
* "conditions": [
26-
* {"exec": "\\CaptainHook\\App\\Hook\\Condition\\Config\\CustomValueIsTruthy",
27-
* "args": [
28-
* "NAME_OF_CUSTOM_VALUE"
29-
* ]}
30-
* ]
24+
* <code>
25+
* {
26+
* "action": "some-action"
27+
* "conditions": [
28+
* {
29+
* "exec": "CaptainHook.Config.CustomValueIsTruthy",
30+
* "args": ["NAME_OF_CUSTOM_VALUE"]
31+
* }
32+
* ]
33+
* }
34+
* </code>
3135
*
3236
* @package CaptainHook
3337
* @author Sebastian Feldmann <[email protected]>

src/Hook/Condition/FileChanged/All.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,22 @@
2121
* The FileChange condition is applicable for `post-merge` and `post-checkout` hooks.
2222
* It checks if all configured files are updated within the last change set.
2323
*
24+
* Example configuration:
25+
*
26+
* <code>
27+
* {
28+
* "action": "some-action"
29+
* "conditions": [
30+
* {
31+
* "exec": "CaptainHook.FileChanged.All",
32+
* "args": [
33+
* ["list", "of", "files"]
34+
* ]
35+
* }
36+
* ]
37+
* }
38+
* </code>
39+
*
2440
* @package CaptainHook
2541
* @author Sebastian Feldmann <[email protected]>
2642
* @link https://github.com/captainhook-git/captainhook

src/Hook/Condition/FileChanged/Any.php

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,24 @@
1919
* Class Any
2020
*
2121
* The FileChange condition is applicable for `post-merge` and `post-checkout` hooks.
22-
* For example it can be used to trigger an automatic composer install if the composer.json
23-
* or composer.lock file is changed during a checkout or merge.
22+
* For example, it can be used to trigger an automatic composer install if the composer.json
23+
* or `composer.lock` file is changed during a checkout or merge.
2424
*
2525
* Example configuration:
2626
*
27-
* "action": "composer install"
28-
* "conditions": [
29-
* {"exec": "\\CaptainHook\\App\\Hook\\Condition\\FileChange\\Any",
30-
* "args": [
31-
* [
32-
* "composer.json",
33-
* "composer.lock"
34-
* ]
35-
* ]}
36-
* ]
27+
* <code>
28+
* {
29+
* "action": "some-action"
30+
* "conditions": [
31+
* {
32+
* "exec": "CaptainHook.FileChanged.Any",
33+
* "args": [
34+
* ["list", "of", "files"]
35+
* ]
36+
* }
37+
* ]
38+
* }
39+
* </code>
3740
*
3841
* @package CaptainHook
3942
* @author Sebastian Feldmann <[email protected]>

src/Hook/Condition/FileChanged/OfType.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,17 @@
2525
*
2626
* Example configuration:
2727
*
28-
* "action": "some-action"
29-
* "conditions": [
30-
* {"exec": "\\CaptainHook\\App\\Hook\\Condition\\FileChanged\\OfType",
31-
* "args": [
32-
* "php"
33-
* ]}
34-
* ]
28+
* <code>
29+
* {
30+
* "action": "some-action"
31+
* "conditions": [
32+
* {
33+
* "exec": "CaptainHook.FileChanged.OfType",
34+
* "args": ["php"]
35+
* }
36+
* ]
37+
* }
38+
* </code>
3539
*
3640
* @package CaptainHook
3741
* @author Sebastian Feldmann <[email protected]>

src/Hook/Condition/FileStaged/All.php

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,19 @@
2323
*
2424
* Example configuration:
2525
*
26-
* "action": "some-action"
27-
* "conditions": [
28-
* {"exec": "\\CaptainHook\\App\\Hook\\Condition\\FileStaged\\All",
29-
* "args": [
30-
* ["file1", "file2", "file3"]
31-
* ]}
32-
* ]
26+
* <code>
27+
* {
28+
* "action": "some-action"
29+
* "conditions": [
30+
* {
31+
* "exec": "CaptainHook.FileStaged.All",
32+
* "args": [
33+
* ["list", "of", "files"]
34+
* ]
35+
* }
36+
* ]
37+
* }
38+
* </code>
3339
*
3440
* The file list can also be defined as comma seperated string "file1,file2,file3"
3541
*

src/Hook/Condition/FileStaged/Any.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,21 @@
2020
*
2121
* The FileStaged condition is applicable for `pre-commit hooks.
2222
*
23-
* Example configuration:
23+
* Example configuration:
2424
*
25+
* <code>
26+
* {
2527
* "action": "some-action"
2628
* "conditions": [
27-
* {"exec": "\\CaptainHook\\App\\Hook\\Condition\\FileStaged\\Any",
28-
* "args": [
29-
* ["file1", "file2", "file3"]
30-
* ]}
29+
* {
30+
* "exec": "CaptainHook.FileStaged.Any",
31+
* "args": [
32+
* ["list", "of", "files"]
33+
* ]
34+
* }
3135
* ]
36+
* }
37+
* </code>
3238
*
3339
* The file list can also be defined as comma seperated string "file1,file2,file3"
3440
*

src/Hook/Condition/FileStaged/InDirectory.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,17 @@
2626
*
2727
* Example configuration:
2828
*
29-
* "action": "some-action"
30-
* "conditions": [
31-
* {"exec": "\\CaptainHook\\App\\Hook\\Condition\\FileStaged\\InDirectory",
32-
* "args": [
33-
* "src/"
34-
* ]}
35-
* ]
29+
* <code>
30+
* {
31+
* "action": "some-action"
32+
* "conditions": [
33+
* {
34+
* "exec": "CaptainHook.FileStaged.InDirectory",
35+
* "args": ["src"]
36+
* }
37+
* ]
38+
* }
39+
* </code>
3640
*
3741
* @package CaptainHook
3842
* @author Sebastian Feldmann <[email protected]>

src/Hook/Condition/FileStaged/OfType.php

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,24 @@
2727
*
2828
* Example configuration:
2929
*
30-
* "action": "some-action"
31-
* "conditions": [
32-
* {"exec": "\\CaptainHook\\App\\Hook\\Condition\\FileStaged\\OfType",
33-
* "args": [
34-
* "php",
35-
* ["A", "C"]
36-
* ]}
37-
* ]
30+
* <code>
31+
* {
32+
* "action": "some-action"
33+
* "conditions": [
34+
* {
35+
* "exec": "CaptainHook.FileStaged.OfType",
36+
* "args": [
37+
* "php",
38+
* ["A", "C"]
39+
* ]
40+
* }
41+
* ]
42+
* }
43+
* </code>
3844
*
3945
* Multiple types can be configured using a comma separated string or an array
40-
* "php,html,xml"
41-
* ["php", "html", "xml"]
46+
* - "php,html,xml"
47+
* - ["php", "html", "xml"]
4248
*
4349
* @package CaptainHook
4450
* @author Sebastian Feldmann <[email protected]>

src/Hook/Condition/FileStaged/ThatIs.php

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,19 @@
2626
*
2727
* Example configuration:
2828
*
29-
* "action": "some-action"
30-
* "conditions": [
31-
* {"exec": "\\CaptainHook\\App\\Hook\\Condition\\FileStaged\\ThatIs",
32-
* "args": [
33-
* {"ofType": "php", "inDirectory": "foo/", "diff-filter": ["A", "C"]}
34-
* ]}
35-
* ]
29+
* <code>
30+
* {
31+
* "action": "some-action"
32+
* "conditions": [
33+
* {
34+
* "exec": "CaptainHook.FileStaged.ThatIs",
35+
* "args": [
36+
* {"ofType": "php", "inDirectory": "foo/", "diff-filter": ["A", "C"]}
37+
* ]
38+
* }
39+
* ]
40+
* }
41+
* </code>
3642
*
3743
* @package CaptainHook
3844
* @author Sebastian Feldmann <[email protected]>

src/Runner/Shorthand.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace CaptainHook\App\Runner;
1313

1414
use CaptainHook\App\Hook;
15-
use PHPUnit\Framework\MockObject\MockObject;
1615
use RuntimeException;
1716

1817
/**
@@ -62,7 +61,7 @@ class Shorthand
6261
],
6362
],
6463
'condition' => [
65-
'inconfig' => [
64+
'config' => [
6665
'customvalueistruthy' => Hook\Condition\Config\CustomValueIsTruthy::class,
6766
'customvalueisfalsy' => Hook\Condition\Config\CustomValueIsFalsy::class,
6867
],
@@ -71,9 +70,11 @@ class Shorthand
7170
'all' => Hook\Condition\FileChanged\All::class,
7271
],
7372
'filestaged' => [
74-
'all' => Hook\Condition\FileStaged\All::class,
75-
'any' => Hook\Condition\FileStaged\Any::class,
76-
'thatis' => Hook\Condition\FileStaged\ThatIs::class,
73+
'all' => Hook\Condition\FileStaged\All::class,
74+
'any' => Hook\Condition\FileStaged\Any::class,
75+
'indirectory' => Hook\Condition\FileStaged\InDirectory::class,
76+
'oftype' => Hook\Condition\FileStaged\OfType::class,
77+
'thatis' => Hook\Condition\FileStaged\ThatIs::class,
7778
],
7879
'status' => [
7980
'onbranch' => Hook\Condition\Branch\On::class,

0 commit comments

Comments
 (0)