File tree Expand file tree Collapse file tree 2 files changed +5
-23
lines changed Expand file tree Collapse file tree 2 files changed +5
-23
lines changed Original file line number Diff line number Diff line change @@ -35,11 +35,7 @@ class XmlFileLoader extends FileLoader
35
35
36
36
public function loadClassMetadata (ClassMetadataInterface $ classMetadata ): bool
37
37
{
38
- if (null === $ this ->classes ) {
39
- $ this ->classes = $ this ->getClassesFromXml ();
40
- }
41
-
42
- if (!$ this ->classes ) {
38
+ if (!$ this ->classes ??= $ this ->getClassesFromXml ()) {
43
39
return false ;
44
40
}
45
41
@@ -128,11 +124,7 @@ public function loadClassMetadata(ClassMetadataInterface $classMetadata): bool
128
124
*/
129
125
public function getMappedClasses (): array
130
126
{
131
- if (null === $ this ->classes ) {
132
- $ this ->classes = $ this ->getClassesFromXml ();
133
- }
134
-
135
- return array_keys ($ this ->classes );
127
+ return array_keys ($ this ->classes ??= $ this ->getClassesFromXml ());
136
128
}
137
129
138
130
/**
Original file line number Diff line number Diff line change @@ -38,11 +38,7 @@ class YamlFileLoader extends FileLoader
38
38
39
39
public function loadClassMetadata (ClassMetadataInterface $ classMetadata ): bool
40
40
{
41
- if (null === $ this ->classes ) {
42
- $ this ->classes = $ this ->getClassesFromYaml ();
43
- }
44
-
45
- if (!$ this ->classes ) {
41
+ if (!$ this ->classes ??= $ this ->getClassesFromYaml ()) {
46
42
return false ;
47
43
}
48
44
@@ -153,11 +149,7 @@ public function loadClassMetadata(ClassMetadataInterface $classMetadata): bool
153
149
*/
154
150
public function getMappedClasses (): array
155
151
{
156
- if (null === $ this ->classes ) {
157
- $ this ->classes = $ this ->getClassesFromYaml ();
158
- }
159
-
160
- return array_keys ($ this ->classes );
152
+ return array_keys ($ this ->classes ??= $ this ->getClassesFromYaml ());
161
153
}
162
154
163
155
private function getClassesFromYaml (): array
@@ -166,9 +158,7 @@ private function getClassesFromYaml(): array
166
158
throw new MappingException (sprintf ('This is not a local file "%s". ' , $ this ->file ));
167
159
}
168
160
169
- if (null === $ this ->yamlParser ) {
170
- $ this ->yamlParser = new Parser ();
171
- }
161
+ $ this ->yamlParser ??= new Parser ();
172
162
173
163
$ classes = $ this ->yamlParser ->parseFile ($ this ->file , Yaml::PARSE_CONSTANT );
174
164
You can’t perform that action at this time.
0 commit comments