diff --git a/examples/post_multiple_values_same_key_without_indexes.php b/examples/post_multiple_values_same_key_without_indexes.php index 6341407..ac7b5c4 100644 --- a/examples/post_multiple_values_same_key_without_indexes.php +++ b/examples/post_multiple_values_same_key_without_indexes.php @@ -33,3 +33,5 @@ $curl->post('https://httpbin.org/post', http_build_query_without_indexes(array( 'baz', ), ))); + +// @codingStandardsIgnoreFile diff --git a/examples/put_large_file_chunked.php b/examples/put_large_file_chunked.php index bd8fbea..983038b 100644 --- a/examples/put_large_file_chunked.php +++ b/examples/put_large_file_chunked.php @@ -29,3 +29,5 @@ if ($curl->error) { } else { echo 'Success' . "\n"; } + +// @codingStandardsIgnoreFile diff --git a/examples/receive_large_file_chunked.php b/examples/receive_large_file_chunked.php index 6cbcf88..d2bc687 100644 --- a/examples/receive_large_file_chunked.php +++ b/examples/receive_large_file_chunked.php @@ -18,3 +18,5 @@ $file = fopen($tmpnam, 'wb+'); file_get_contents_chunked('php://input', 4096, function ($chunk) use (&$file) { fwrite($file, $chunk); }); + +// @codingStandardsIgnoreFile diff --git a/src/Curl/Decoder.php b/src/Curl/Decoder.php index 60925be..f12fcce 100644 --- a/src/Curl/Decoder.php +++ b/src/Curl/Decoder.php @@ -13,7 +13,8 @@ class Decoder * @param $depth * @param $options */ - public static function decodeJson() { + public static function decodeJson() + { $args = func_get_args(); // Call json_decode() without the $options parameter in PHP @@ -36,7 +37,8 @@ class Decoder * @access public * @param $response */ - public static function decodeXml($response) { + public static function decodeXml($response) + { $xml_obj = @simplexml_load_string($response); if (!($xml_obj === false)) { $response = $xml_obj; diff --git a/tests/PHPCurlClass/PHPCurlClassTest.php b/tests/PHPCurlClass/PHPCurlClassTest.php index f4f4c4a..a8c4587 100644 --- a/tests/PHPCurlClass/PHPCurlClassTest.php +++ b/tests/PHPCurlClass/PHPCurlClassTest.php @@ -1286,8 +1286,7 @@ class CurlTest extends \PHPUnit\Framework\TestCase public function testJsonRequest() { - foreach ( - array( + foreach (array( array( array( 'key' => 'value', diff --git a/tests/check_syntax.sh b/tests/check_syntax.sh index dff7863..87073bc 100755 --- a/tests/check_syntax.sh +++ b/tests/check_syntax.sh @@ -1,3 +1,6 @@ +DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +cd "${DIR}" phpcs \ --extensions="php" \ --ignore="*/vendor/*" \ diff --git a/tests/ruleset.xml b/tests/ruleset.xml index 11c4eba..885b183 100644 --- a/tests/ruleset.xml +++ b/tests/ruleset.xml @@ -2,8 +2,6 @@ - - diff --git a/tests/script.sh b/tests/script.sh index d7c4eba..c943ad1 100755 --- a/tests/script.sh +++ b/tests/script.sh @@ -8,7 +8,7 @@ fi # Run tests. phpunit --version -phpunit --configuration tests/phpunit.xml +phpunit --configuration "tests/phpunit.xml" if [[ "${?}" -ne 0 ]]; then ((errors++)) fi @@ -112,4 +112,20 @@ if [[ ! -z "${elses}" ]]; then ((errors++)) fi +# Add composer bin directory to the path environment variable. +export PATH="$PWD/vendor/bin:$PATH" + +# Detect coding standard violations. +phpcs --version +phpcs \ + --extensions="php" \ + --ignore="*/vendor/*" \ + --standard="tests/ruleset.xml" \ + -p \ + -s \ + . +if [[ "${?}" -ne 0 ]]; then + ((errors++)) +fi + exit "${errors}"