Skip to content

Commit 6ed21b4

Browse files
authored
Merge pull request php-curl-class#448 from zachborboa/master
Add PSR-2 coding style checks to continuous integration tests
2 parents 4679e96 + 6bed5fb commit 6ed21b4

File tree

8 files changed

+31
-7
lines changed

8 files changed

+31
-7
lines changed

examples/post_multiple_values_same_key_without_indexes.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,5 @@ function http_build_query_without_indexes($query) {
3333
'baz',
3434
),
3535
)));
36+
37+
// @codingStandardsIgnoreFile

examples/put_large_file_chunked.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,5 @@ function read_file($ch, $fd, $length) {
2929
} else {
3030
echo 'Success' . "\n";
3131
}
32+
33+
// @codingStandardsIgnoreFile

examples/receive_large_file_chunked.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ function file_get_contents_chunked($filename, $chunk_size, $callback) {
1818
file_get_contents_chunked('php://input', 4096, function ($chunk) use (&$file) {
1919
fwrite($file, $chunk);
2020
});
21+
22+
// @codingStandardsIgnoreFile

src/Curl/Decoder.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ class Decoder
1313
* @param $depth
1414
* @param $options
1515
*/
16-
public static function decodeJson() {
16+
public static function decodeJson()
17+
{
1718
$args = func_get_args();
1819

1920
// Call json_decode() without the $options parameter in PHP
@@ -36,7 +37,8 @@ public static function decodeJson() {
3637
* @access public
3738
* @param $response
3839
*/
39-
public static function decodeXml($response) {
40+
public static function decodeXml($response)
41+
{
4042
$xml_obj = @simplexml_load_string($response);
4143
if (!($xml_obj === false)) {
4244
$response = $xml_obj;

tests/PHPCurlClass/PHPCurlClassTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,8 +1286,7 @@ public function testPostCurlFileFormDataContentType()
12861286

12871287
public function testJsonRequest()
12881288
{
1289-
foreach (
1290-
array(
1289+
foreach (array(
12911290
array(
12921291
array(
12931292
'key' => 'value',

tests/check_syntax.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
2+
3+
cd "${DIR}"
14
phpcs \
25
--extensions="php" \
36
--ignore="*/vendor/*" \

tests/ruleset.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
<ruleset name="PSR2Modified">
33
<rule ref="PSR2">
44
<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps" />
5-
<exclude name="PSR2.ControlStructures.ControlStructureSpacing.SpacingAfterOpenBrace" />
6-
<exclude name="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceAfterOpen" />
75
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine" />
86
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.UseOneParamPerLine" />
97
</rule>

tests/script.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ fi
88

99
# Run tests.
1010
phpunit --version
11-
phpunit --configuration tests/phpunit.xml
11+
phpunit --configuration "tests/phpunit.xml"
1212
if [[ "${?}" -ne 0 ]]; then
1313
((errors++))
1414
fi
@@ -112,4 +112,20 @@ if [[ ! -z "${elses}" ]]; then
112112
((errors++))
113113
fi
114114

115+
# Add composer bin directory to the path environment variable.
116+
export PATH="$PWD/vendor/bin:$PATH"
117+
118+
# Detect coding standard violations.
119+
phpcs --version
120+
phpcs \
121+
--extensions="php" \
122+
--ignore="*/vendor/*" \
123+
--standard="tests/ruleset.xml" \
124+
-p \
125+
-s \
126+
.
127+
if [[ "${?}" -ne 0 ]]; then
128+
((errors++))
129+
fi
130+
115131
exit "${errors}"

0 commit comments

Comments
 (0)