@@ -32,7 +32,7 @@ public static function create(RuntimeReflectionProperty $property)
32
32
$ isNullable = true ;
33
33
34
34
if ($ reflectionType instanceof ReflectionType) {
35
- $ type = $ reflectionType ;
35
+ $ type = ( string ) $ reflectionType ;
36
36
$ isNullable = $ reflectionType ->allowsNull ();
37
37
}
38
38
if ($ reflectionType instanceof ReflectionNamedType) {
@@ -41,6 +41,14 @@ public static function create(RuntimeReflectionProperty $property)
41
41
$ isNullable = $ reflectionType ->allowsNull ();
42
42
}
43
43
44
+ if ($ property ->notTransform ()) {
45
+ return new ScalarType (
46
+ $ type ,
47
+ $ isScalar ,
48
+ $ isNullable
49
+ );
50
+ }
51
+
44
52
if ($ type === TypeEnums::TYPE_ARRAY ) {
45
53
$ arrayTypeAttr = $ property ->getAttributeArguments (ConvertArray::class);
46
54
@@ -50,18 +58,19 @@ public static function create(RuntimeReflectionProperty $property)
50
58
$ arrayType = TransformUtils::getClassFromPhpDoc ($ property ->getDocComment ());
51
59
}
52
60
$ arrayType ??= TypeEnums::TYPE_MIXED ;
53
- $ type = new ArrayType (
61
+
62
+ $ typeInstance = new ArrayType (
54
63
$ type ,
55
64
$ isScalar ,
56
65
$ isNullable
57
66
);
58
- $ type ->itemsType = $ arrayType ?? TypeEnums::TYPE_MIXED ;
59
- $ type ->isScalarItems = in_array ($ arrayType , [TypeEnums::TYPE_INTEGER , TypeEnums::TYPE_FLOAT , TypeEnums::TYPE_STRING , TypeEnums::TYPE_BOOLEAN , TypeEnums::TYPE_MIXED ]);
67
+ $ typeInstance ->itemsType = $ arrayType ?? TypeEnums::TYPE_MIXED ;
68
+ $ typeInstance ->isScalarItems = in_array ($ arrayType , [TypeEnums::TYPE_INTEGER , TypeEnums::TYPE_FLOAT , TypeEnums::TYPE_STRING , TypeEnums::TYPE_BOOLEAN , TypeEnums::TYPE_MIXED ]);
60
69
61
- return $ type ;
70
+ return $ typeInstance ;
62
71
}
63
72
64
- if ($ isScalar || $ property -> notTransform () ) {
73
+ if ($ isScalar ) {
65
74
return new ScalarType (
66
75
$ type ,
67
76
$ isScalar ,
@@ -80,7 +89,6 @@ public static function create(RuntimeReflectionProperty $property)
80
89
return new TransformableType (
81
90
$ type ,
82
91
$ isScalar ,
83
- $ isNullable
84
92
);
85
93
}
86
94
}
0 commit comments