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
36 changes: 36 additions & 0 deletions .github/workflows/samples-php-syntax-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Samples PHP Syntax Checker

on:
push:
paths:
- samples/client/petstore/php/OpenAPIClient-php/**
- samples/client/petstore/php-nextgen/OpenAPIClient-php/**
pull_request:
paths:
- samples/client/petstore/php/OpenAPIClient-php/**
- samples/client/petstore/php-nextgen/OpenAPIClient-php/**
jobs:
build:
name: Build PHP projects
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php:
- "8.1"
- "8.2"
- "8.3"
- "8.4"
sample:
# clients
- samples/client/petstore/php/OpenAPIClient-php/
- samples/client/petstore/php-nextgen/OpenAPIClient-php/
steps:
- uses: actions/checkout@v4
- name: Setup PHP with tools
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php }}"
- name: php -l
working-directory: ${{ matrix.sample }}
run: find . -name "*.php" -exec php -l {} +
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
#
#
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,8 @@ public function getDummy(Request $request): JsonResponse

$param_withRandomCase = $request->string('param_withRandomCase')->value();

try {
$apiResult = $this->api->getDummy($paramCamelCase, $ParamPascalCase, $param_withRandomCase);
} catch (\Exception $exception) {
// This shouldn't happen
report($exception);
return response()->json(['error' => $exception->getMessage()], 500);
}

$apiResult = $this->api->getDummy($paramCamelCase, $ParamPascalCase, $param_withRandomCase);

if ($apiResult instanceof \OpenAPI\Server\Model\NoContent200) {
return response()->json($this->serde->serialize($apiResult, format: 'array'), 200);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,8 @@ public function call123TestSpecialTags(Request $request): JsonResponse

$client = $this->serde->deserialize($request->getContent(), from: 'json', to: \OpenAPI\Server\Model\Client::class);

try {
$apiResult = $this->api->call123TestSpecialTags($client);
} catch (\Exception $exception) {
// This shouldn't happen
report($exception);
return response()->json(['error' => $exception->getMessage()], 500);
}

$apiResult = $this->api->call123TestSpecialTags($client);

if ($apiResult instanceof \OpenAPI\Server\Model\Client) {
return response()->json($this->serde->serialize($apiResult, format: 'array'), 200);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,8 @@ public function fooGet(Request $request): JsonResponse
return response()->json(['error' => 'Invalid input'], 400);
}

try {
$apiResult = $this->api->fooGet();
} catch (\Exception $exception) {
// This shouldn't happen
report($exception);
return response()->json(['error' => $exception->getMessage()], 500);
}

$apiResult = $this->api->fooGet();

if ($apiResult instanceof \OpenAPI\Server\Model\FooGetDefaultResponse) {
return response()->json($this->serde->serialize($apiResult, format: 'array'), 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,8 @@ public function testClassname(Request $request): JsonResponse

$client = $this->serde->deserialize($request->getContent(), from: 'json', to: \OpenAPI\Server\Model\Client::class);

try {
$apiResult = $this->api->testClassname($client);
} catch (\Exception $exception) {
// This shouldn't happen
report($exception);
return response()->json(['error' => $exception->getMessage()], 500);
}

$apiResult = $this->api->testClassname($client);

if ($apiResult instanceof \OpenAPI\Server\Model\Client) {
return response()->json($this->serde->serialize($apiResult, format: 'array'), 200);
Expand Down
Loading
Loading