diff --git a/build/wiki-code-samples/tutorial/test.php b/build/wiki-code-samples/tutorial/test.php new file mode 100644 index 0000000..6313abf --- /dev/null +++ b/build/wiki-code-samples/tutorial/test.php @@ -0,0 +1,17 @@ +contentsAreValid($array)) { + $value = $obj->getValue(); + + # Value needs to be an array. + if (is_array($value) === false) { + # Error. + $obj->throwError(); + exit(); + } +} diff --git a/wiki/Coding-Standard-Tutorial.md b/wiki/Coding-Standard-Tutorial.md index 92e97a0..c3d3511 100644 --- a/wiki/Coding-Standard-Tutorial.md +++ b/wiki/Coding-Standard-Tutorial.md @@ -185,17 +185,23 @@ if ($obj->contentsAreValid($array)) { ``` When PHP_CodeSniffer is run on the file using our new coding standard, 3 errors will be reported: + ```bash $ phpcs --standard=MyStandard test.php FILE: test.php --------------------------------------------------------------------------------- -FOUND 3 ERROR(S) AFFECTING 3 LINE(S) --------------------------------------------------------------------------------- +------------------------------------------------------------------------------------- +FOUND 3 ERRORS AFFECTING 3 LINES +------------------------------------------------------------------------------------- 7 | ERROR | Hash comments are prohibited; found # Hash comments should be flagged. 11 | ERROR | Hash comments are prohibited; found # Value needs to be an array. 13 | ERROR | Hash comments are prohibited; found # Error. --------------------------------------------------------------------------------- +------------------------------------------------------------------------------------- ```

back to top