Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Last set of PHP-CS-Fixer updates #875

Merged
merged 4 commits into from
Feb 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 26 additions & 15 deletions .php_cs.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,33 @@ return PhpCsFixer\Config::create()
'@PHP56Migration:risky' => true,
'@PHPUnit57Migration:risky' => true,

// Diffs from @PhpCsFixer / @PhpCsFixer:risky
'concat_space' => [
'spacing' => 'one',
],
// Additional rules
'fopen_flags' => true,
'linebreak_after_opening_tag' => true,
'native_function_invocation' => true,

// --- Diffs from @PhpCsFixer / @PhpCsFixer:risky ---

// This is just prettier / easier to read.
'concat_space' => ['spacing' => 'one'],

// This causes strange ordering with codegen'd classes. We might be
// able to enable this if we update codegen to output class elements
// in the correct order.
'ordered_class_elements' => false,

// This can be enabled once we update every test class and method with
// the correct `@covers` annotations.
'php_unit_test_class_requires_covers' => false,
'phpdoc_align' => false,
'protected_to_private' => false,
'self_accessor' => false,

// Should be included in @PhpCsFixer / @PhpCsFixer:risky according to doc, but need to be
// enabled manually for some reason.
'fopen_flags' => true,
'multiline_whitespace_before_semicolons' => true,
'native_function_invocation' => true,
// Keep this disabled to avoid unnecessary diffs in PHPDoc comments of
// codegen'd classes.
'phpdoc_align' => false,

// Additional rules
'linebreak_after_opening_tag' => true,
]);
// This is a "risky" rule that causes a bug in our codebase.
// Specifically, in `StripeObject.updateAttributes` we construct new
// `StripeObject`s for metadata. We can't use `self` there because it
// needs to be a raw `StripeObject`.
'self_accessor' => false,
])
;
6 changes: 4 additions & 2 deletions tests/Stripe/StripeTelemetryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public function testNoTelemetrySentIfNotEnabled()
$stub = $this
->getMockBuilder('HttpClient\\ClientInterface')
->setMethods(['request'])
->getMock();
->getMock()
;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seriously you want to make me mad right?


$stub->expects(static::any())
->method('request')
Expand Down Expand Up @@ -75,7 +76,8 @@ public function testTelemetrySetIfEnabled()
$stub = $this
->getMockBuilder('HttpClient\\ClientInterface')
->setMethods(['request'])
->getMock();
->getMock()
;

$stub->expects(static::any())
->method('request')
Expand Down
9 changes: 6 additions & 3 deletions tests/TestHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ function ($method, $absUrl, $headers, $params, $hasFile) {

return $curlClient->request($method, $absUrl, $headers, $params, $hasFile);
}
);
)
;
}

/**
Expand Down Expand Up @@ -124,7 +125,8 @@ protected function stubRequest(
$base = null
) {
$this->prepareRequestMock($method, $path, $params, $headers, $hasFile, $base)
->willReturn([\json_encode($response), $rcode, []]);
->willReturn([\json_encode($response), $rcode, []])
;
}

/**
Expand Down Expand Up @@ -179,6 +181,7 @@ private function prepareRequestMock(
}),
null === $params ? static::anything() : static::identicalTo($params),
static::identicalTo($hasFile)
);
)
;
}
}