You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Need to change the coding standard rules applied? Either:
55
-
- ignore a rule in the affected code, by adding `phpcs:ignore {rule}`, where {rule} is the given rule that failed in the above output.
56
-
- edit the [phpcs.xml](phpcs.xml) file.
57
-
58
-
**Rules should be ignored with caution**
59
-
60
36
## Run PHP CodeSniffer for Tests
61
37
62
-
[PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) checks that all test code meets Coding Standards.
38
+
[PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) checks that all test code meets the [PSR-12 Coding Standards](https://www.php-fig.org/psr/psr-12/).
63
39
64
-
To run the tests, enter the following command:
40
+
To run CodeSniffer on tests, enter the following command:
- (Experimental) running `vendor/bin/phpcbf --standard=phpcs.tests.xml` to automatically fix coding standards
77
51
78
52
Need to change the coding standard rules applied? Either:
79
53
- ignore a rule in the affected code, by adding `phpcs:ignore {rule}`, where {rule} is the given rule that failed in the above output.
80
-
- edit the [phpcs.xml](phpcs.xml) file.
54
+
- edit the [phpcs.tests.xml](phpcs.tests.xml) file.
81
55
82
56
**Rules can be ignored with caution**, but it's essential that rules relating to coding style and inline code commenting / docblocks remain.
83
57
84
-
## Run PHPStan
85
-
86
-
[PHPStan](https://phpstan.org) performs static analysis on the code. This ensures:
87
-
88
-
- DocBlocks declarations are valid and uniform
89
-
- Typehinting variables and return types declared in DocBlocks are correctly cast
90
-
- Any unused functions are detected
91
-
- Unnecessary checks / code is highlighted for possible removal
92
-
- Conditions that do not evaluate can be fixed/removed as necessary
93
-
94
-
Run the following command to run PHPStan:
95
-
96
-
```bash
97
-
vendor/bin/phpstan --memory-limit=1G
98
-
```
99
-
100
-
Any errors should be corrected by making applicable code changes.
101
-
102
-
False positives [can be excluded by configuring](https://phpstan.org/user-guide/ignoring-errors) the `phpstan.neon` file.
103
-
104
58
## Next Steps
105
59
106
60
Once your tests are written and successfully run locally, submit your branch via a new [Pull Request](https://github.com/ConvertKit/ConvertKitSDK-PHP/compare).
0 commit comments