@@ -31,44 +31,44 @@ public function __construct(
3131
3232 public function convert (): ObjectSchema
3333 {
34- $ schema = new ObjectSchema ();
34+ $ objectSchema = new ObjectSchema ();
3535
3636 // Get the description from the doc parser
3737 $ description = $ this ->getDocParser ()?->description() ?? null ;
3838
3939 // Add the description to the schema if it exists
4040 if ($ description !== null ) {
41- $ schema ->description ($ description );
41+ $ objectSchema ->description ($ description );
4242 }
4343
4444 // Get the parameters from the doc parser
4545 $ params = $ this ->getDocParser ()?->params();
4646
4747 // Add the parameters to the objectschema
4848 foreach ($ this ->reflection ->getParameters () as $ parameter ) {
49- $ schema ->properties (self ::getSchemaFromReflectionParameter ($ parameter , $ params ));
49+ $ objectSchema ->properties (self ::getSchemaFromReflectionParameter ($ parameter , $ params ));
5050 }
5151
52- return $ schema ;
52+ return $ objectSchema ;
5353 }
5454
5555 /**
5656 * Create a schema from a given type.
5757 *
58- * @param \Cortex\JsonSchema\Support\NodeCollection<array-key, \Cortex\JsonSchema\Support\NodeData> $docParams
58+ * @param \Cortex\JsonSchema\Support\NodeCollection<array-key, \Cortex\JsonSchema\Support\NodeData> $nodeCollection
5959 */
6060 protected function getSchemaFromReflectionParameter (
61- ReflectionParameter $ parameter ,
62- ?NodeCollection $ docParams = null ,
61+ ReflectionParameter $ reflectionParameter ,
62+ ?NodeCollection $ nodeCollection = null ,
6363 ): Schema {
64- $ type = $ parameter ->getType ();
64+ $ type = $ reflectionParameter ->getType ();
6565
6666 // @phpstan-ignore argument.type
6767 $ schema = self ::getSchemaFromReflectionType ($ type );
6868
69- $ schema ->title ($ parameter ->getName ());
69+ $ schema ->title ($ reflectionParameter ->getName ());
7070
71- $ docParam = $ docParams ?->get($ parameter ->getName ());
71+ $ docParam = $ nodeCollection ?->get($ reflectionParameter ->getName ());
7272
7373 // Add the description to the schema if it exists
7474 if ($ docParam ?->description !== null ) {
@@ -79,8 +79,8 @@ protected function getSchemaFromReflectionParameter(
7979 $ schema ->nullable ();
8080 }
8181
82- if ($ parameter ->isDefaultValueAvailable () && ! $ parameter ->isDefaultValueConstant ()) {
83- $ defaultValue = $ parameter ->getDefaultValue ();
82+ if ($ reflectionParameter ->isDefaultValueAvailable () && ! $ reflectionParameter ->isDefaultValueConstant ()) {
83+ $ defaultValue = $ reflectionParameter ->getDefaultValue ();
8484
8585 // If the default value is a backed enum, use its value
8686 if ($ defaultValue instanceof BackedEnum) {
@@ -90,7 +90,7 @@ protected function getSchemaFromReflectionParameter(
9090 $ schema ->default ($ defaultValue );
9191 }
9292
93- if (! $ parameter ->isOptional ()) {
93+ if (! $ reflectionParameter ->isOptional ()) {
9494 $ schema ->required ();
9595 }
9696
@@ -99,9 +99,9 @@ protected function getSchemaFromReflectionParameter(
9999 $ typeName = $ type ->getName ();
100100
101101 if (enum_exists ($ typeName )) {
102- $ reflection = new ReflectionEnum ($ typeName );
102+ $ reflectionEnum = new ReflectionEnum ($ typeName );
103103
104- if ($ reflection ->isBacked ()) {
104+ if ($ reflectionEnum ->isBacked ()) {
105105 /** @var non-empty-array<int, string|int> $values */
106106 $ values = array_column ($ typeName ::cases (), 'value ' );
107107 $ schema ->enum ($ values );
0 commit comments