diff --git a/build.xml b/build.xml
index fafc51f..3668aab 100644
--- a/build.xml
+++ b/build.xml
@@ -71,8 +71,8 @@
-
-
+
+
diff --git a/composer.json b/composer.json
index 8470338..ce4817a 100644
--- a/composer.json
+++ b/composer.json
@@ -27,7 +27,8 @@
"twig/markdown-extra": "^3.0",
"matthiasmullie/minify": "^1.3",
"rize/uri-template": "*",
- "splitbrain/php-cli": "^1.3"
+ "splitbrain/php-cli": "^1.3",
+ "psr/log": "^2.0"
},
"require-dev": {
"lunr/halo": "dev-master",
diff --git a/composer.lock b/composer.lock
index 2a1f542..f6f9dc5 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "3eedefe2b86599a32d7b9462e99f07be",
+ "content-hash": "bfa30dc97a1bdd31a9cc2f29b8f254e1",
"packages": [
{
"name": "lukasoppermann/http-status",
@@ -243,6 +243,56 @@
},
"time": "2022-09-26T12:21:08+00:00"
},
+ {
+ "name": "psr/log",
+ "version": "2.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/log.git",
+ "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/log/zipball/ef29f6d262798707a9edd554e2b82517ef3a9376",
+ "reference": "ef29f6d262798707a9edd554e2b82517ef3a9376",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.0.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Log\\": "src"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "https://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interface for logging libraries",
+ "homepage": "https://github.com/php-fig/log",
+ "keywords": [
+ "log",
+ "psr",
+ "psr-3"
+ ],
+ "support": {
+ "source": "https://github.com/php-fig/log/tree/2.0.0"
+ },
+ "time": "2021-07-14T16:41:46+00:00"
+ },
{
"name": "rize/uri-template",
"version": "0.4.1",
@@ -431,16 +481,16 @@
},
{
"name": "symfony/polyfill-ctype",
- "version": "v1.33.0",
+ "version": "v1.35.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
- "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638"
+ "reference": "141046a8f9477948ff284fa65be2095baafb94f2"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638",
- "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638",
+ "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/141046a8f9477948ff284fa65be2095baafb94f2",
+ "reference": "141046a8f9477948ff284fa65be2095baafb94f2",
"shasum": ""
},
"require": {
@@ -490,7 +540,7 @@
"portable"
],
"support": {
- "source": "https://github.com/symfony/polyfill-ctype/tree/v1.33.0"
+ "source": "https://github.com/symfony/polyfill-ctype/tree/v1.35.0"
},
"funding": [
{
@@ -510,20 +560,20 @@
"type": "tidelift"
}
],
- "time": "2024-09-09T11:45:10+00:00"
+ "time": "2026-04-10T16:19:22+00:00"
},
{
"name": "symfony/polyfill-mbstring",
- "version": "v1.33.0",
+ "version": "v1.35.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
- "reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493"
+ "reference": "6a21eb99c6973357967f6ce3708cd55a6bec6315"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493",
- "reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493",
+ "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6a21eb99c6973357967f6ce3708cd55a6bec6315",
+ "reference": "6a21eb99c6973357967f6ce3708cd55a6bec6315",
"shasum": ""
},
"require": {
@@ -575,7 +625,7 @@
"shim"
],
"support": {
- "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.33.0"
+ "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.35.0"
},
"funding": [
{
@@ -595,20 +645,20 @@
"type": "tidelift"
}
],
- "time": "2024-12-23T08:48:59+00:00"
+ "time": "2026-04-10T17:25:58+00:00"
},
{
"name": "twig/markdown-extra",
- "version": "v3.23.0",
+ "version": "v3.24.0",
"source": {
"type": "git",
"url": "https://github.com/twigphp/markdown-extra.git",
- "reference": "faf069b259e2d3930c73c2f53e2dec8440bd90a2"
+ "reference": "67a11120356e034a5bbc70c5b9b9a4d0f31ca06e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/twigphp/markdown-extra/zipball/faf069b259e2d3930c73c2f53e2dec8440bd90a2",
- "reference": "faf069b259e2d3930c73c2f53e2dec8440bd90a2",
+ "url": "https://api.github.com/repos/twigphp/markdown-extra/zipball/67a11120356e034a5bbc70c5b9b9a4d0f31ca06e",
+ "reference": "67a11120356e034a5bbc70c5b9b9a4d0f31ca06e",
"shasum": ""
},
"require": {
@@ -655,7 +705,7 @@
"twig"
],
"support": {
- "source": "https://github.com/twigphp/markdown-extra/tree/v3.23.0"
+ "source": "https://github.com/twigphp/markdown-extra/tree/v3.24.0"
},
"funding": [
{
@@ -667,20 +717,20 @@
"type": "tidelift"
}
],
- "time": "2025-12-02T14:45:16+00:00"
+ "time": "2026-02-07T08:07:38+00:00"
},
{
"name": "twig/twig",
- "version": "v3.23.0",
+ "version": "v3.24.0",
"source": {
"type": "git",
"url": "https://github.com/twigphp/Twig.git",
- "reference": "a64dc5d2cc7d6cafb9347f6cd802d0d06d0351c9"
+ "reference": "a6769aefb305efef849dc25c9fd1653358c148f0"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/twigphp/Twig/zipball/a64dc5d2cc7d6cafb9347f6cd802d0d06d0351c9",
- "reference": "a64dc5d2cc7d6cafb9347f6cd802d0d06d0351c9",
+ "url": "https://api.github.com/repos/twigphp/Twig/zipball/a6769aefb305efef849dc25c9fd1653358c148f0",
+ "reference": "a6769aefb305efef849dc25c9fd1653358c148f0",
"shasum": ""
},
"require": {
@@ -690,7 +740,8 @@
"symfony/polyfill-mbstring": "^1.3"
},
"require-dev": {
- "phpstan/phpstan": "^2.0",
+ "php-cs-fixer/shim": "^3.0@stable",
+ "phpstan/phpstan": "^2.0@stable",
"psr/container": "^1.0|^2.0",
"symfony/phpunit-bridge": "^5.4.9|^6.4|^7.0"
},
@@ -734,7 +785,7 @@
],
"support": {
"issues": "https://github.com/twigphp/Twig/issues",
- "source": "https://github.com/twigphp/Twig/tree/v3.23.0"
+ "source": "https://github.com/twigphp/Twig/tree/v3.24.0"
},
"funding": [
{
@@ -746,7 +797,7 @@
"type": "tidelift"
}
],
- "time": "2026-01-23T21:00:41+00:00"
+ "time": "2026-03-17T21:31:11+00:00"
}
],
"packages-dev": [
@@ -3117,16 +3168,16 @@
},
{
"name": "symfony/console",
- "version": "v8.0.6",
+ "version": "v8.0.8",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
- "reference": "488285876e807a4777f074041d8bb508623419fa"
+ "reference": "5b66d385dc58f69652e56f78a4184615e3f2b7f7"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/console/zipball/488285876e807a4777f074041d8bb508623419fa",
- "reference": "488285876e807a4777f074041d8bb508623419fa",
+ "url": "https://api.github.com/repos/symfony/console/zipball/5b66d385dc58f69652e56f78a4184615e3f2b7f7",
+ "reference": "5b66d385dc58f69652e56f78a4184615e3f2b7f7",
"shasum": ""
},
"require": {
@@ -3183,7 +3234,7 @@
"terminal"
],
"support": {
- "source": "https://github.com/symfony/console/tree/v8.0.6"
+ "source": "https://github.com/symfony/console/tree/v8.0.8"
},
"funding": [
{
@@ -3203,20 +3254,20 @@
"type": "tidelift"
}
],
- "time": "2026-02-25T16:59:43+00:00"
+ "time": "2026-03-30T15:14:47+00:00"
},
{
"name": "symfony/filesystem",
- "version": "v8.0.6",
+ "version": "v8.0.8",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
- "reference": "7bf9162d7a0dff98d079b72948508fa48018a770"
+ "reference": "66b769ae743ce2d13e435528fbef4af03d623e5a"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/filesystem/zipball/7bf9162d7a0dff98d079b72948508fa48018a770",
- "reference": "7bf9162d7a0dff98d079b72948508fa48018a770",
+ "url": "https://api.github.com/repos/symfony/filesystem/zipball/66b769ae743ce2d13e435528fbef4af03d623e5a",
+ "reference": "66b769ae743ce2d13e435528fbef4af03d623e5a",
"shasum": ""
},
"require": {
@@ -3253,7 +3304,7 @@
"description": "Provides basic utilities for the filesystem",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/filesystem/tree/v8.0.6"
+ "source": "https://github.com/symfony/filesystem/tree/v8.0.8"
},
"funding": [
{
@@ -3273,20 +3324,20 @@
"type": "tidelift"
}
],
- "time": "2026-02-25T16:59:43+00:00"
+ "time": "2026-03-30T15:14:47+00:00"
},
{
"name": "symfony/polyfill-intl-grapheme",
- "version": "v1.33.0",
+ "version": "v1.35.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-grapheme.git",
- "reference": "380872130d3a5dd3ace2f4010d95125fde5d5c70"
+ "reference": "ad1b7b9092976d6c948b8a187cec9faaea9ec1df"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/380872130d3a5dd3ace2f4010d95125fde5d5c70",
- "reference": "380872130d3a5dd3ace2f4010d95125fde5d5c70",
+ "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/ad1b7b9092976d6c948b8a187cec9faaea9ec1df",
+ "reference": "ad1b7b9092976d6c948b8a187cec9faaea9ec1df",
"shasum": ""
},
"require": {
@@ -3335,7 +3386,7 @@
"shim"
],
"support": {
- "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.33.0"
+ "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.35.0"
},
"funding": [
{
@@ -3355,11 +3406,11 @@
"type": "tidelift"
}
],
- "time": "2025-06-27T09:58:17+00:00"
+ "time": "2026-04-10T16:19:22+00:00"
},
{
"name": "symfony/polyfill-intl-normalizer",
- "version": "v1.33.0",
+ "version": "v1.35.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-normalizer.git",
@@ -3420,7 +3471,7 @@
"shim"
],
"support": {
- "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.33.0"
+ "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.35.0"
},
"funding": [
{
@@ -3531,16 +3582,16 @@
},
{
"name": "symfony/string",
- "version": "v8.0.6",
+ "version": "v8.0.8",
"source": {
"type": "git",
"url": "https://github.com/symfony/string.git",
- "reference": "6c9e1108041b5dce21a9a4984b531c4923aa9ec4"
+ "reference": "ae9488f874d7603f9d2dfbf120203882b645d963"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/string/zipball/6c9e1108041b5dce21a9a4984b531c4923aa9ec4",
- "reference": "6c9e1108041b5dce21a9a4984b531c4923aa9ec4",
+ "url": "https://api.github.com/repos/symfony/string/zipball/ae9488f874d7603f9d2dfbf120203882b645d963",
+ "reference": "ae9488f874d7603f9d2dfbf120203882b645d963",
"shasum": ""
},
"require": {
@@ -3597,7 +3648,7 @@
"utf8"
],
"support": {
- "source": "https://github.com/symfony/string/tree/v8.0.6"
+ "source": "https://github.com/symfony/string/tree/v8.0.8"
},
"funding": [
{
@@ -3617,20 +3668,20 @@
"type": "tidelift"
}
],
- "time": "2026-02-09T10:14:57+00:00"
+ "time": "2026-03-30T15:14:47+00:00"
},
{
"name": "symfony/yaml",
- "version": "v8.0.6",
+ "version": "v8.0.8",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
- "reference": "5f006c50a981e1630bbb70ad409c5d85f9a716e0"
+ "reference": "54174ab48c0c0f9e21512b304be17f8150ccf8f1"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/yaml/zipball/5f006c50a981e1630bbb70ad409c5d85f9a716e0",
- "reference": "5f006c50a981e1630bbb70ad409c5d85f9a716e0",
+ "url": "https://api.github.com/repos/symfony/yaml/zipball/54174ab48c0c0f9e21512b304be17f8150ccf8f1",
+ "reference": "54174ab48c0c0f9e21512b304be17f8150ccf8f1",
"shasum": ""
},
"require": {
@@ -3672,7 +3723,7 @@
"description": "Loads and dumps YAML files",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/yaml/tree/v8.0.6"
+ "source": "https://github.com/symfony/yaml/tree/v8.0.8"
},
"funding": [
{
@@ -3692,7 +3743,7 @@
"type": "tidelift"
}
],
- "time": "2026-02-09T10:14:57+00:00"
+ "time": "2026-03-30T15:14:47+00:00"
},
{
"name": "theseer/autoload",
diff --git a/src/PHPDraft/In/CLI.php b/src/PHPDraft/In/CLI.php
index f46c6e6..64d8687 100644
--- a/src/PHPDraft/In/CLI.php
+++ b/src/PHPDraft/In/CLI.php
@@ -12,7 +12,6 @@
class CLI extends BaseCLI
{
-
protected function setup(Options $options): void
{
$options->setHelp('Usage: phpdraft [options]');
@@ -37,7 +36,7 @@ protected function setup(Options $options): void
protected function main(Options $options): void
{
$args = $options->getOpt();
- if ($options->getOpt('version') !== FALSE) {
+ if ($options->getOpt('version') !== false) {
Version::version();
throw new ExecutionException('', 0);
}
@@ -45,23 +44,22 @@ protected function main(Options $options): void
stream_set_blocking(STDIN, false);
/** @var false|string $stdin */
$stdin = stream_get_contents(STDIN);
- $tmp_file_name = NULL;
- if ($stdin !== FALSE && $stdin !== '') {
+ $tmp_file_name = null;
+ if ($stdin !== false && $stdin !== '') {
$tmp_file_name = tempnam(sys_get_temp_dir(), 'phpdraft');
file_put_contents($tmp_file_name, $stdin);
}
/** @var false|string $file_name */
$file_name = $options->getOpt('file');
- if ($tmp_file_name !== NULL && $file_name !== FALSE) {
+ if ($tmp_file_name !== null && $file_name !== false) {
throw new ExecutionException('ERROR: Passed data in both file and stdin', 2);
}
- if (!($options->getOpt('debug-json-file') === FALSE || $options->getOpt('debug-json') === FALSE || $file_name !== FALSE)) {
+ if (!($options->getOpt('debug-json-file') === false || $options->getOpt('debug-json') === false || $file_name !== false)) {
throw new ExecutionException('Missing required option: file', 1);
}
- if ($file_name === FALSE || $file_name === '')
- {
+ if ($file_name === false || $file_name === '') {
throw new ExecutionException('ERROR: File does not exist', 200);
}
@@ -95,14 +93,14 @@ protected function main(Options $options): void
$name = 'PHPD_SORT_' . strtoupper($options->getOpt('sort', ''));
$html->sorting = defined("Sorting::$name") ? Sorting::{$name} : Sorting::PHPD_SORT_NONE->value;
- $color1 = getenv('COLOR_PRIMARY') === FALSE ? NULL : getenv('COLOR_PRIMARY');
- $color2 = getenv('COLOR_SECONDARY') === FALSE ? NULL : getenv('COLOR_SECONDARY');
+ $color1 = getenv('COLOR_PRIMARY') === false ? null : getenv('COLOR_PRIMARY');
+ $color2 = getenv('COLOR_SECONDARY') === false ? null : getenv('COLOR_SECONDARY');
$colors = (is_null($color1) || is_null($color2)) ? '' : '__' . $color1 . '__' . $color2;
$html->build_html(
$options->getOpt('template', 'default') . $colors,
- $args['header-image'] ?? NULL,
- $args['css'] ?? NULL,
- $args['javascript'] ?? NULL,
+ $args['header-image'] ?? null,
+ $args['css'] ?? null,
+ $args['javascript'] ?? null,
);
if (isset($args['html'])) {
@@ -112,4 +110,4 @@ protected function main(Options $options): void
echo $html;
}
-}
\ No newline at end of file
+}
diff --git a/src/PHPDraft/Out/OpenAPI/OpenApiRenderer.php b/src/PHPDraft/Out/OpenAPI/OpenApiRenderer.php
index 1797d1a..ddd1305 100644
--- a/src/PHPDraft/Out/OpenAPI/OpenApiRenderer.php
+++ b/src/PHPDraft/Out/OpenAPI/OpenApiRenderer.php
@@ -12,7 +12,7 @@
class OpenApiRenderer extends BaseTemplateRenderer
{
- const NO_DESCRIPTION_PROVIDED = 'No description provided';
+ private const NO_DESCRIPTION_PROVIDED = 'No description provided';
public function init(object $json): self
{
@@ -131,24 +131,26 @@ private function getPaths(): object
}
$cleaned_href = preg_replace('/{\?.*}/', '', $transition->href);
$cleaned_href = rtrim($cleaned_href, "/");
- $optional_paths = array_filter($parameters, fn ($parameter) => $parameter['in'] === 'path' && $parameter['required'] === FALSE);
+ $optional_paths = array_filter($parameters, fn ($parameter) => $parameter['in'] === 'path' && $parameter['required'] === false);
if ($optional_paths === []) {
$return[$cleaned_href] = (object) $transition_return;
continue;
}
$cleaned_parameters = [];
- $optional_href = NULL;
+ $optional_href = null;
foreach ($parameters as $key => $parameter) {
- if ($parameter['in'] === 'path' && $parameter['required'] === TRUE) {
+ if ($parameter['in'] === 'path' && $parameter['required'] === true) {
$cleaned_parameters[] = $parameter;
continue;
}
- if ($parameter['in'] !== 'path') { continue; }
+ if ($parameter['in'] !== 'path') {
+ continue;
+ }
$optional_href = str_replace("/{{$parameter["name"]}}", '', $cleaned_href);
- $parameters[$key]['required'] = TRUE;
+ $parameters[$key]['required'] = true;
}
//Full path
@@ -230,7 +232,7 @@ private function toOperation(HTTPRequest $request, Transition $transition, array
}
$body = $this->toBody($request);
- if ($body === NULL) {
+ if ($body === null) {
return $operation;
}
@@ -363,7 +365,7 @@ private function toResponses(array $responses): array
private function toBody(HTTPRequest $request): ?array
{
if (in_array($request->method, ['GET', 'DELETE'], true)) {
- return NULL;
+ return null;
}
$return = ['content' => []];
@@ -446,7 +448,8 @@ private function getComponent(BasicStructureElement $structure): array
{
$object = [];
if ($this->isRef($structure->element) && $structure->element !== 'enum') {
- $object['$ref'] = '#/components/schemas/' . $this->refIdFromType($structure->element === 'member' ? $structure->type : $structure->element);;
+ $object['$ref'] = '#/components/schemas/' . $this->refIdFromType($structure->element === 'member' ? $structure->type : $structure->element);
+ ;
return $object;
}
@@ -471,7 +474,8 @@ private function getComponent(BasicStructureElement $structure): array
case 'enum':
// $object['type'] = $structure->type;;
case 'array':
- $object['items'] = (object) $properties;;
+ $object['items'] = (object) $properties;
+ ;
break;
case 'object':
$object['properties'] = $properties;
@@ -544,7 +548,8 @@ private function getSchemaProperty(BasicStructureElement|ElementStructureElement
return $propery_data;
} elseif ($value->type === 'object') {
$propery_data['type'] = $value->type;
- $propery_data['properties'] = $this->getComponent($value->value)['properties'] ?? new class{};
+ $propery_data['properties'] = $this->getComponent($value->value)['properties'] ?? new class {
+ };
return $propery_data;
}
@@ -590,8 +595,8 @@ private function getTags(): array
return $return;
}
- private function refIdFromType(string $type): string {
+ private function refIdFromType(string $type): string
+ {
return str_replace(' ', '_', $type);
}
-
}
diff --git a/src/PHPDraft/Out/OpenAPI/Tests/OpenApiRendererTest.php b/src/PHPDraft/Out/OpenAPI/Tests/OpenApiRendererTest.php
index b48863f..f5f690e 100644
--- a/src/PHPDraft/Out/OpenAPI/Tests/OpenApiRendererTest.php
+++ b/src/PHPDraft/Out/OpenAPI/Tests/OpenApiRendererTest.php
@@ -117,7 +117,7 @@ public function testToBody(): void
$result = $method->invokeArgs($this->class, [$mock]);
$this->assertEquals(['content' => (object)[],
- 'description' => 'No description provided'], $result);
+ 'description' => 'No description provided'], $result);
}
public function testToParameters(): void