Skip to content

Commit 8092108

Browse files
authored
chore(styles): php-cs-fixer upgrade and fix (GoogleCloudPlatform#89)
1 parent c319280 commit 8092108

File tree

8 files changed

+15
-9
lines changed

8 files changed

+15
-9
lines changed

.github/workflows/lint.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ jobs:
1212
- name: PHP-CS-Fixer
1313
uses: docker://oskarstark/php-cs-fixer-ga
1414
with:
15-
args: --diff --dry-run
15+
args: . --diff --dry-run
File renamed without changes.

examples/hello/index.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@
2525

2626
function helloHttp(ServerRequestInterface $request)
2727
{
28-
return sprintf("Hello %s from PHP HTTP function!" . PHP_EOL,
29-
$request->getQueryParams()['name'] ?? 'World');
28+
return sprintf(
29+
"Hello %s from PHP HTTP function!" . PHP_EOL,
30+
$request->getQueryParams()['name'] ?? 'World'
31+
);
3032
}
3133

3234
/**

router.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@
5151
}
5252
if (!is_callable($target)) {
5353
throw new InvalidArgumentException(sprintf(
54-
'Function target is not callable: "%s"', $target));
54+
'Function target is not callable: "%s"',
55+
$target
56+
));
5557
}
5658

5759
$signatureType = getenv('FUNCTION_SIGNATURE_TYPE', true) ?: 'http';

src/FunctionWrapper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
abstract class FunctionWrapper
2929
{
30-
const FUNCTION_STATUS_HEADER = 'X-Google-Status';
30+
public const FUNCTION_STATUS_HEADER = 'X-Google-Status';
3131

3232
protected $function;
3333

src/Invoker.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ public function __construct(callable $target, string $signatureType)
4444
$this->function = new CloudEventFunctionWrapper($target);
4545
} else {
4646
throw new InvalidArgumentException(sprintf(
47-
'Invalid signature type: "%s"', $signatureType));
47+
'Invalid signature type: "%s"',
48+
$signatureType
49+
));
4850
}
4951
$this->errorLogFunc = function (string $error) {
5052
fwrite(fopen('php://stderr', 'wb'), json_encode([
@@ -56,7 +58,7 @@ public function __construct(callable $target, string $signatureType)
5658

5759
public function handle(
5860
ServerRequestInterface $request = null
59-
) : ResponseInterface {
61+
): ResponseInterface {
6062
if ($request === null) {
6163
$request = ServerRequest::fromGlobals();
6264
}

tests/LegacyEventMapperTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public function testFirebaseAuth()
184184
],
185185
'eventId' => 'aaaaaa-1111-bbbb-2222-cccccccccccc',
186186
'eventType' => 'providers/firebase.auth/eventTypes/user.create',
187-
'notSupported' => new \stdClass,
187+
'notSupported' => new \stdClass(),
188188
'resource' => 'projects/my-project-id',
189189
'timestamp' => '2020-09-29T11:32:00.000Z',
190190
];

tests/conformance/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function fixCloudEventData(CloudEvent $cloudevent): CloudEvent
4242
$fields = ['oldValue', 'updateMask'];
4343
foreach ($fields as $f) {
4444
if (array_key_exists($f, $data) && empty($data[$f])) {
45-
$data[$f] = new stdClass;
45+
$data[$f] = new stdClass();
4646
$dataModified = true;
4747
}
4848
}

0 commit comments

Comments
 (0)