Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ jobs:
- name: PHP-CS-Fixer
uses: docker://oskarstark/php-cs-fixer-ga
with:
args: --diff --dry-run
args: . --diff --dry-run
File renamed without changes.
6 changes: 4 additions & 2 deletions examples/hello/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@

function helloHttp(ServerRequestInterface $request)
{
return sprintf("Hello %s from PHP HTTP function!" . PHP_EOL,
$request->getQueryParams()['name'] ?? 'World');
return sprintf(
"Hello %s from PHP HTTP function!" . PHP_EOL,
$request->getQueryParams()['name'] ?? 'World'
);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion router.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@
}
if (!is_callable($target)) {
throw new InvalidArgumentException(sprintf(
'Function target is not callable: "%s"', $target));
'Function target is not callable: "%s"',
$target
));
}

$signatureType = getenv('FUNCTION_SIGNATURE_TYPE', true) ?: 'http';
Expand Down
2 changes: 1 addition & 1 deletion src/FunctionWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

abstract class FunctionWrapper
{
const FUNCTION_STATUS_HEADER = 'X-Google-Status';
public const FUNCTION_STATUS_HEADER = 'X-Google-Status';

protected $function;

Expand Down
6 changes: 4 additions & 2 deletions src/Invoker.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ public function __construct(callable $target, string $signatureType)
$this->function = new CloudEventFunctionWrapper($target);
} else {
throw new InvalidArgumentException(sprintf(
'Invalid signature type: "%s"', $signatureType));
'Invalid signature type: "%s"',
$signatureType
));
}
$this->errorLogFunc = function (string $error) {
fwrite(fopen('php://stderr', 'wb'), json_encode([
Expand All @@ -56,7 +58,7 @@ public function __construct(callable $target, string $signatureType)

public function handle(
ServerRequestInterface $request = null
) : ResponseInterface {
): ResponseInterface {
if ($request === null) {
$request = ServerRequest::fromGlobals();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/LegacyEventMapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public function testFirebaseAuth()
],
'eventId' => 'aaaaaa-1111-bbbb-2222-cccccccccccc',
'eventType' => 'providers/firebase.auth/eventTypes/user.create',
'notSupported' => new \stdClass,
'notSupported' => new \stdClass(),
'resource' => 'projects/my-project-id',
'timestamp' => '2020-09-29T11:32:00.000Z',
];
Expand Down
2 changes: 1 addition & 1 deletion tests/conformance/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function fixCloudEventData(CloudEvent $cloudevent): CloudEvent
$fields = ['oldValue', 'updateMask'];
foreach ($fields as $f) {
if (array_key_exists($f, $data) && empty($data[$f])) {
$data[$f] = new stdClass;
$data[$f] = new stdClass();
$dataModified = true;
}
}
Expand Down