Skip to content

Commit 6c247f7

Browse files
committed
fix(laravel): handle string max_errors from environment variables
Change is_int() guard to is_numeric() + (int) cast so that string values returned by env() (e.g. "10") are accepted instead of silently falling back to the default.
1 parent c7d8774 commit 6c247f7

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/Laravel/ValidatesOpenApiSchema.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use Studio\OpenApiContractTesting\OpenApiCoverageTracker;
1111
use Studio\OpenApiContractTesting\OpenApiResponseValidator;
1212

13-
use function is_int;
13+
use function is_numeric;
1414
use function is_string;
1515
use function str_contains;
1616
use function strtolower;
@@ -54,7 +54,7 @@ protected function assertResponseMatchesOpenApiSchema(
5454

5555
$maxErrors = config('openapi-contract-testing.max_errors', 20);
5656
$validator = new OpenApiResponseValidator(
57-
maxErrors: is_int($maxErrors) ? $maxErrors : 20,
57+
maxErrors: is_numeric($maxErrors) ? (int) $maxErrors : 20,
5858
);
5959
$result = $validator->validate(
6060
$specName,

0 commit comments

Comments
 (0)