@@ -26,7 +26,7 @@ class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface
26
26
{
27
27
protected $ registry ;
28
28
29
- private $ cache = array () ;
29
+ private $ cache = [] ;
30
30
31
31
public function __construct (ManagerRegistry $ registry )
32
32
{
@@ -39,7 +39,7 @@ public function __construct(ManagerRegistry $registry)
39
39
public function guessType ($ class , $ property )
40
40
{
41
41
if (!$ ret = $ this ->getMetadata ($ class )) {
42
- return new TypeGuess ('Symfony\Component\Form\Extension\Core\Type\TextType ' , array () , Guess::LOW_CONFIDENCE );
42
+ return new TypeGuess ('Symfony\Component\Form\Extension\Core\Type\TextType ' , [] , Guess::LOW_CONFIDENCE );
43
43
}
44
44
45
45
list ($ metadata , $ name ) = $ ret ;
@@ -48,45 +48,45 @@ public function guessType($class, $property)
48
48
$ multiple = $ metadata ->isCollectionValuedAssociation ($ property );
49
49
$ mapping = $ metadata ->getAssociationMapping ($ property );
50
50
51
- return new TypeGuess ('Symfony\Bridge\Doctrine\Form\Type\EntityType ' , array ( 'em ' => $ name , 'class ' => $ mapping ['targetEntity ' ], 'multiple ' => $ multiple) , Guess::HIGH_CONFIDENCE );
51
+ return new TypeGuess ('Symfony\Bridge\Doctrine\Form\Type\EntityType ' , [ 'em ' => $ name , 'class ' => $ mapping ['targetEntity ' ], 'multiple ' => $ multiple] , Guess::HIGH_CONFIDENCE );
52
52
}
53
53
54
54
switch ($ metadata ->getTypeOfField ($ property )) {
55
55
case Type::TARRAY :
56
56
case Type::SIMPLE_ARRAY :
57
- return new TypeGuess ('Symfony\Component\Form\Extension\Core\Type\CollectionType ' , array () , Guess::MEDIUM_CONFIDENCE );
57
+ return new TypeGuess ('Symfony\Component\Form\Extension\Core\Type\CollectionType ' , [] , Guess::MEDIUM_CONFIDENCE );
58
58
case Type::BOOLEAN :
59
- return new TypeGuess ('Symfony\Component\Form\Extension\Core\Type\CheckboxType ' , array () , Guess::HIGH_CONFIDENCE );
59
+ return new TypeGuess ('Symfony\Component\Form\Extension\Core\Type\CheckboxType ' , [] , Guess::HIGH_CONFIDENCE );
60
60
case Type::DATETIME :
61
61
case Type::DATETIMETZ :
62
62
case 'vardatetime ' :
63
- return new TypeGuess ('Symfony\Component\Form\Extension\Core\Type\DateTimeType ' , array () , Guess::HIGH_CONFIDENCE );
63
+ return new TypeGuess ('Symfony\Component\Form\Extension\Core\Type\DateTimeType ' , [] , Guess::HIGH_CONFIDENCE );
64
64
case 'datetime_immutable ' :
65
65
case 'datetimetz_immutable ' :
66
- return new TypeGuess ('Symfony\Component\Form\Extension\Core\Type\DateTimeType ' , array ( 'input ' => 'datetime_immutable ' ) , Guess::HIGH_CONFIDENCE );
66
+ return new TypeGuess ('Symfony\Component\Form\Extension\Core\Type\DateTimeType ' , [ 'input ' => 'datetime_immutable ' ] , Guess::HIGH_CONFIDENCE );
67
67
case 'dateinterval ' :
68
- return new TypeGuess ('Symfony\Component\Form\Extension\Core\Type\DateIntervalType ' , array () , Guess::HIGH_CONFIDENCE );
68
+ return new TypeGuess ('Symfony\Component\Form\Extension\Core\Type\DateIntervalType ' , [] , Guess::HIGH_CONFIDENCE );
69
69
case Type::DATE :
70
- return new TypeGuess ('Symfony\Component\Form\Extension\Core\Type\DateType ' , array () , Guess::HIGH_CONFIDENCE );
70
+ return new TypeGuess ('Symfony\Component\Form\Extension\Core\Type\DateType ' , [] , Guess::HIGH_CONFIDENCE );
71
71
case 'date_immutable ' :
72
- return new TypeGuess ('Symfony\Component\Form\Extension\Core\Type\DateType ' , array ( 'input ' => 'datetime_immutable ' ) , Guess::HIGH_CONFIDENCE );
72
+ return new TypeGuess ('Symfony\Component\Form\Extension\Core\Type\DateType ' , [ 'input ' => 'datetime_immutable ' ] , Guess::HIGH_CONFIDENCE );
73
73
case Type::TIME :
74
- return new TypeGuess ('Symfony\Component\Form\Extension\Core\Type\TimeType ' , array () , Guess::HIGH_CONFIDENCE );
74
+ return new TypeGuess ('Symfony\Component\Form\Extension\Core\Type\TimeType ' , [] , Guess::HIGH_CONFIDENCE );
75
75
case 'time_immutable ' :
76
- return new TypeGuess ('Symfony\Component\Form\Extension\Core\Type\TimeType ' , array ( 'input ' => 'datetime_immutable ' ) , Guess::HIGH_CONFIDENCE );
76
+ return new TypeGuess ('Symfony\Component\Form\Extension\Core\Type\TimeType ' , [ 'input ' => 'datetime_immutable ' ] , Guess::HIGH_CONFIDENCE );
77
77
case Type::DECIMAL :
78
78
case Type::FLOAT :
79
- return new TypeGuess ('Symfony\Component\Form\Extension\Core\Type\NumberType ' , array () , Guess::MEDIUM_CONFIDENCE );
79
+ return new TypeGuess ('Symfony\Component\Form\Extension\Core\Type\NumberType ' , [] , Guess::MEDIUM_CONFIDENCE );
80
80
case Type::INTEGER :
81
81
case Type::BIGINT :
82
82
case Type::SMALLINT :
83
- return new TypeGuess ('Symfony\Component\Form\Extension\Core\Type\IntegerType ' , array () , Guess::MEDIUM_CONFIDENCE );
83
+ return new TypeGuess ('Symfony\Component\Form\Extension\Core\Type\IntegerType ' , [] , Guess::MEDIUM_CONFIDENCE );
84
84
case Type::STRING :
85
- return new TypeGuess ('Symfony\Component\Form\Extension\Core\Type\TextType ' , array () , Guess::MEDIUM_CONFIDENCE );
85
+ return new TypeGuess ('Symfony\Component\Form\Extension\Core\Type\TextType ' , [] , Guess::MEDIUM_CONFIDENCE );
86
86
case Type::TEXT :
87
- return new TypeGuess ('Symfony\Component\Form\Extension\Core\Type\TextareaType ' , array () , Guess::MEDIUM_CONFIDENCE );
87
+ return new TypeGuess ('Symfony\Component\Form\Extension\Core\Type\TextareaType ' , [] , Guess::MEDIUM_CONFIDENCE );
88
88
default :
89
- return new TypeGuess ('Symfony\Component\Form\Extension\Core\Type\TextType ' , array () , Guess::LOW_CONFIDENCE );
89
+ return new TypeGuess ('Symfony\Component\Form\Extension\Core\Type\TextType ' , [] , Guess::LOW_CONFIDENCE );
90
90
}
91
91
}
92
92
@@ -141,7 +141,7 @@ public function guessMaxLength($class, $property)
141
141
return new ValueGuess ($ mapping ['length ' ], Guess::HIGH_CONFIDENCE );
142
142
}
143
143
144
- if (\in_array ($ ret [0 ]->getTypeOfField ($ property ), array ( Type::DECIMAL , Type::FLOAT ) )) {
144
+ if (\in_array ($ ret [0 ]->getTypeOfField ($ property ), [ Type::DECIMAL , Type::FLOAT ] )) {
145
145
return new ValueGuess (null , Guess::MEDIUM_CONFIDENCE );
146
146
}
147
147
}
@@ -154,7 +154,7 @@ public function guessPattern($class, $property)
154
154
{
155
155
$ ret = $ this ->getMetadata ($ class );
156
156
if ($ ret && isset ($ ret [0 ]->fieldMappings [$ property ]) && !$ ret [0 ]->hasAssociation ($ property )) {
157
- if (\in_array ($ ret [0 ]->getTypeOfField ($ property ), array ( Type::DECIMAL , Type::FLOAT ) )) {
157
+ if (\in_array ($ ret [0 ]->getTypeOfField ($ property ), [ Type::DECIMAL , Type::FLOAT ] )) {
158
158
return new ValueGuess (null , Guess::MEDIUM_CONFIDENCE );
159
159
}
160
160
}
@@ -172,7 +172,7 @@ protected function getMetadata($class)
172
172
$ this ->cache [$ class ] = null ;
173
173
foreach ($ this ->registry ->getManagers () as $ name => $ em ) {
174
174
try {
175
- return $ this ->cache [$ class ] = array ( $ em ->getClassMetadata ($ class ), $ name) ;
175
+ return $ this ->cache [$ class ] = [ $ em ->getClassMetadata ($ class ), $ name] ;
176
176
} catch (MappingException $ e ) {
177
177
// not an entity or mapped super class
178
178
} catch (LegacyMappingException $ e ) {
0 commit comments