Merge pull request #448 from zachborboa/master

Add PSR-2 coding style checks to continuous integration tests
This commit is contained in:
Zach Borboa
2017-05-02 19:09:43 -07:00
committed by GitHub
8 changed files with 31 additions and 7 deletions
@@ -33,3 +33,5 @@ $curl->post('https://httpbin.org/post', http_build_query_without_indexes(array(
'baz',
),
)));
// @codingStandardsIgnoreFile
+2
View File
@@ -29,3 +29,5 @@ if ($curl->error) {
} else {
echo 'Success' . "\n";
}
// @codingStandardsIgnoreFile
+2
View File
@@ -18,3 +18,5 @@ $file = fopen($tmpnam, 'wb+');
file_get_contents_chunked('php://input', 4096, function ($chunk) use (&$file) {
fwrite($file, $chunk);
});
// @codingStandardsIgnoreFile
+4 -2
View File
@@ -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;
+1 -2
View File
@@ -1286,8 +1286,7 @@ class CurlTest extends \PHPUnit\Framework\TestCase
public function testJsonRequest()
{
foreach (
array(
foreach (array(
array(
array(
'key' => 'value',
+3
View File
@@ -1,3 +1,6 @@
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "${DIR}"
phpcs \
--extensions="php" \
--ignore="*/vendor/*" \
-2
View File
@@ -2,8 +2,6 @@
<ruleset name="PSR2Modified">
<rule ref="PSR2">
<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps" />
<exclude name="PSR2.ControlStructures.ControlStructureSpacing.SpacingAfterOpenBrace" />
<exclude name="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceAfterOpen" />
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine" />
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.UseOneParamPerLine" />
</rule>
+17 -1
View File
@@ -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}"