File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -47,15 +47,21 @@ public function getSchemas(): iterable
47
47
{
48
48
$ directory = new RecursiveDirectoryIterator ($ this ->sourceDirectory );
49
49
$ iterator = new RecursiveIteratorIterator ($ directory );
50
+ $ schemaFiles = [];
50
51
51
- foreach (new RegexIterator ($ iterator , '/^.+\.json$/i ' , RecursiveRegexIterator::GET_MATCH ) as $ file ) {
52
- $ jsonSchema = file_get_contents ($ file [0 ]);
52
+ foreach (new RegexIterator ($ iterator , '/^.+\.json$/i ' , RegexIterator::GET_MATCH ) as $ file ) {
53
+ $ schemaFiles [] = $ file [0 ];
54
+ }
55
+
56
+ sort ($ schemaFiles , SORT_REGULAR );
57
+ foreach ($ schemaFiles as $ file ) {
58
+ $ jsonSchema = file_get_contents ($ file );
53
59
54
60
if (!$ jsonSchema || !($ decodedJsonSchema = json_decode ($ jsonSchema , true ))) {
55
- throw new SchemaException ("Invalid JSON-Schema file { $ file[ 0 ]} " );
61
+ throw new SchemaException ("Invalid JSON-Schema file $ file " );
56
62
}
57
63
58
- yield new JsonSchema ($ file[ 0 ] , $ decodedJsonSchema );
64
+ yield new JsonSchema ($ file , $ decodedJsonSchema );
59
65
}
60
66
}
61
67
You can’t perform that action at this time.
0 commit comments