Conversation
There was a problem hiding this comment.
4 issues found across 17 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="modules/openapi-generator/src/test/resources/3_0/php-laravel/petstore-with-fake-endpoints-models-for-testing.yaml">
<violation number="1" location="modules/openapi-generator/src/test/resources/3_0/php-laravel/petstore-with-fake-endpoints-models-for-testing.yaml:612">
P3: Large commented-out endpoint block (lines 612-712, ~100 lines). The entire `testEnumParameters` GET /fake endpoint is disabled. If no longer needed, remove it entirely to keep the spec clean; if needed for future use, restore or keep with a clear TODO explaining why it's disabled.</violation>
<violation number="2" location="modules/openapi-generator/src/test/resources/3_0/php-laravel/petstore-with-fake-endpoints-models-for-testing.yaml:1290">
P2: Invalid `required` value: `required: optional` is not a valid boolean in OpenAPI 3.0. The `required` field for a Parameter Object must be `true` or `false`. Using the string `optional` will cause spec validation failures.</violation>
</file>
<file name=".github/workflows/samples-php-servers-phpstan.yaml">
<violation number="1" location=".github/workflows/samples-php-servers-phpstan.yaml:40">
P2: No `phpstan.neon` or `phpstan.neon.dist` exists in the sample directory, so PHPStan defaults to level 0 (basic checks only). The analysis will miss type-safety issues, missing return types, and dead code that a higher level would catch — limiting the value of running static analysis at all.</violation>
</file>
<file name="samples/server/petstore/php-laravel/Model/EnumTestEnumNumber.php">
<violation number="1" location="samples/server/petstore/php-laravel/Model/EnumTestEnumNumber.php:29">
P0: Enum `EnumTestEnumNumber` declares a `float` backing type (`: float`), which PHP does not support. PHP backed enums only allow `int` and `string` as backing types; using `float` will cause a fatal compile-time error on any PHP version (8.1+). This blocks the `EnumTest` model from loading and breaks deserialization of the `enum_number` property in the `Enum_Test` spec schema.</violation>
</file>
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.
Re-trigger cubic
| * EnumTestEnumNumber | ||
| */ | ||
| enum TestEnumParametersEnumQueryDoubleParameter: float | ||
| enum EnumTestEnumNumber: float |
There was a problem hiding this comment.
P0: Enum EnumTestEnumNumber declares a float backing type (: float), which PHP does not support. PHP backed enums only allow int and string as backing types; using float will cause a fatal compile-time error on any PHP version (8.1+). This blocks the EnumTest model from loading and breaks deserialization of the enum_number property in the Enum_Test spec schema.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/server/petstore/php-laravel/Model/EnumTestEnumNumber.php, line 29:
<comment>Enum `EnumTestEnumNumber` declares a `float` backing type (`: float`), which PHP does not support. PHP backed enums only allow `int` and `string` as backing types; using `float` will cause a fatal compile-time error on any PHP version (8.1+). This blocks the `EnumTest` model from loading and breaks deserialization of the `enum_number` property in the `Enum_Test` spec schema.</comment>
<file context>
@@ -19,14 +19,14 @@
+ * EnumTestEnumNumber
*/
-enum TestEnumParametersEnumQueryDoubleParameter: float
+enum EnumTestEnumNumber: float
{
case NUMBER_1_DOT_1 = 1.1;
</file context>
| - name: query_1 | ||
| in: query | ||
| description: query parameter | ||
| required: optional |
There was a problem hiding this comment.
P2: Invalid required value: required: optional is not a valid boolean in OpenAPI 3.0. The required field for a Parameter Object must be true or false. Using the string optional will cause spec validation failures.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At modules/openapi-generator/src/test/resources/3_0/php-laravel/petstore-with-fake-endpoints-models-for-testing.yaml, line 1290:
<comment>Invalid `required` value: `required: optional` is not a valid boolean in OpenAPI 3.0. The `required` field for a Parameter Object must be `true` or `false`. Using the string `optional` will cause spec validation failures.</comment>
<file context>
@@ -0,0 +1,2064 @@
+ - name: query_1
+ in: query
+ description: query parameter
+ required: optional
+ schema:
+ type: string
</file context>
| working-directory: ${{ matrix.sample }} | ||
| run: | | ||
| composer require --dev phpstan/phpstan | ||
| vendor/bin/phpstan analyse Api Http Model routes.php |
There was a problem hiding this comment.
P2: No phpstan.neon or phpstan.neon.dist exists in the sample directory, so PHPStan defaults to level 0 (basic checks only). The analysis will miss type-safety issues, missing return types, and dead code that a higher level would catch — limiting the value of running static analysis at all.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/samples-php-servers-phpstan.yaml, line 40:
<comment>No `phpstan.neon` or `phpstan.neon.dist` exists in the sample directory, so PHPStan defaults to level 0 (basic checks only). The analysis will miss type-safety issues, missing return types, and dead code that a higher level would catch — limiting the value of running static analysis at all.</comment>
<file context>
@@ -0,0 +1,40 @@
+ working-directory: ${{ matrix.sample }}
+ run: |
+ composer require --dev phpstan/phpstan
+ vendor/bin/phpstan analyse Api Http Model routes.php
</file context>
| $ref: '#/components/schemas/Client' | ||
| requestBody: | ||
| $ref: '#/components/requestBodies/Client' | ||
| #get: |
There was a problem hiding this comment.
P3: Large commented-out endpoint block (lines 612-712, ~100 lines). The entire testEnumParameters GET /fake endpoint is disabled. If no longer needed, remove it entirely to keep the spec clean; if needed for future use, restore or keep with a clear TODO explaining why it's disabled.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At modules/openapi-generator/src/test/resources/3_0/php-laravel/petstore-with-fake-endpoints-models-for-testing.yaml, line 612:
<comment>Large commented-out endpoint block (lines 612-712, ~100 lines). The entire `testEnumParameters` GET /fake endpoint is disabled. If no longer needed, remove it entirely to keep the spec clean; if needed for future use, restore or keep with a clear TODO explaining why it's disabled.</comment>
<file context>
@@ -0,0 +1,2064 @@
+ $ref: '#/components/schemas/Client'
+ requestBody:
+ $ref: '#/components/requestBodies/Client'
+ #get:
+ # tags:
+ # - fake
</file context>
FYI @jebentier (2017/07), @dkarlovi (2017/07), @mandrean (2017/08), @jfastnacht (2017/09), @ybelenko (2018/07), @renepardon (2018/12)
cc @gijs-blanken as well
PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
Summary by cubic
Upgrade the Laravel server generator and samples to Laravel 13 on PHP 8.3+. Switch the main sample to a custom spec, add a
php-laravel-petstoresample, and add a dedicated PHPStan CI on PHP 8.3/8.4.Dependencies
php: ^8.3 (was ^8.1)laravel/framework: ^13.0 (was ^10.0)phpunit/phpunit: ^12.0 (was ^9.5)Refactors
composer.mustache; move the Laravel test spec tomodules/openapi-generator/src/test/resources/3_0/php-laravel/...and adjustbin/configs/php-laravel.yaml; regenerate samples using the custom spec; remove the enum-parameter endpoint/models/routes; rename the enum toEnumTestEnumNumberand updateEnumTest; add a newphp-laravel-petstoresample.samples-php8workflow; currently runs forphp-laravel-issue-21334(main sample temporarily disabled).Written for commit 2d4496f. Summary will update on new commits.