Skip to content

Commit

Permalink
phpcs fixes and add a few more rules
Browse files Browse the repository at this point in the history
  • Loading branch information
nicosp committed Nov 27, 2024
1 parent 4bc3124 commit 2abf63f
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 44 deletions.
8 changes: 8 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<ruleset name="coding-style">
<description>QoboLtd PHRETS coding style</description>

<rule ref="Generic.Arrays.ArrayIndent"/>
<rule ref="Generic.PHP.DeprecatedFunctions"/>
<rule ref="PSR2"/>

Expand All @@ -9,11 +10,18 @@
<exclude-pattern>./src/Versions/RETSVersion.php</exclude-pattern>
</rule>

<rule ref="SlevomatCodingStandard.Arrays.DisallowImplicitArrayCreation" />
<rule ref="SlevomatCodingStandard.Classes.UselessLateStaticBinding" />
<rule ref="SlevomatCodingStandard.ControlStructures.NewWithParentheses" />
<rule ref="SlevomatCodingStandard.Functions.DisallowTrailingCommaInCall" />
<rule ref="SlevomatCodingStandard.Functions.DisallowTrailingCommaInClosureUse" />
<rule ref="SlevomatCodingStandard.Functions.DisallowTrailingCommaInDeclaration" />
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses" />
<rule ref="SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameInAnnotation" />
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses" />
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint" />
<rule ref="SlevomatCodingStandard.TypeHints.UselessConstantTypeHint" />
<rule ref="SlevomatCodingStandard.Variables.UselessVariable" />

<file>./src/</file>
<file>./tests/</file>
Expand Down
3 changes: 1 addition & 2 deletions src/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -485,8 +485,7 @@ protected function request(string $capability, array $options = [], bool $is_ret
'headers' => $options['headers'],
'body' => $options['body'],
]);
} elseif (
$this->configuration->readOption('use_post_method') ||
} elseif ($this->configuration->readOption('use_post_method') ||
array_key_exists('form_params', $options)
) {
if (array_key_exists('form_params', $options)) {
Expand Down
84 changes: 42 additions & 42 deletions tests/Parsers/GetObject/MultipleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,27 @@ class MultipleTest extends TestCase
public function itBreaksThingsApart(): void
{
$headers = [
'Server' => [
0 => 'Apache-Coyote/1.1',
],
'Cache-Control' => [
0 => 'private',
],
'RETS-Version' => [
0 => 'RETS/1.5',
],
'MIME-Version' => [
0 => '1.0',
],
'Content-Type' => [
0 => 'multipart/parallel; boundary="FLEXeTNY6TFTGAwV1agjJsFyFogbnfoS1dm6y489g08F2TjwZWzQEW"',
],
'Content-Length' => [
0 => '1249',
],
'Date' => [
0 => 'Mon, 09 Jun 2014 00:10:51 GMT',
],
'Server' => [
0 => 'Apache-Coyote/1.1',
],
'Cache-Control' => [
0 => 'private',
],
'RETS-Version' => [
0 => 'RETS/1.5',
],
'MIME-Version' => [
0 => '1.0',
],
'Content-Type' => [
0 => 'multipart/parallel; boundary="FLEXeTNY6TFTGAwV1agjJsFyFogbnfoS1dm6y489g08F2TjwZWzQEW"',
],
'Content-Length' => [
0 => '1249',
],
'Date' => [
0 => 'Mon, 09 Jun 2014 00:10:51 GMT',
],
];
$body = json_decode(file_get_contents('tests/Fixtures/GetObject/Multiple1.txt'), true, 512, JSON_THROW_ON_ERROR);

Expand All @@ -59,27 +59,27 @@ public function itHandlesEmptyBodies(): void
public function itHandlesUnquotedBoundaries(): void
{
$headers = [
'Server' => [
0 => 'Apache-Coyote/1.1',
],
'Cache-Control' => [
0 => 'private',
],
'RETS-Version' => [
0 => 'RETS/1.5',
],
'MIME-Version' => [
0 => '1.0',
],
'Content-Type' => [
0 => 'multipart/parallel; boundary=FLEXeTNY6TFTGAwV1agjJsFyFogbnfoS1dm6y489g08F2TjwZWzQEW',
],
'Content-Length' => [
0 => '1249',
],
'Date' => [
0 => 'Mon, 09 Jun 2014 00:10:51 GMT',
],
'Server' => [
0 => 'Apache-Coyote/1.1',
],
'Cache-Control' => [
0 => 'private',
],
'RETS-Version' => [
0 => 'RETS/1.5',
],
'MIME-Version' => [
0 => '1.0',
],
'Content-Type' => [
0 => 'multipart/parallel; boundary=FLEXeTNY6TFTGAwV1agjJsFyFogbnfoS1dm6y489g08F2TjwZWzQEW',
],
'Content-Length' => [
0 => '1249',
],
'Date' => [
0 => 'Mon, 09 Jun 2014 00:10:51 GMT',
],
];
$body = json_decode(file_get_contents('tests/Fixtures/GetObject/Multiple1.txt', true));

Expand Down

0 comments on commit 2abf63f

Please sign in to comment.