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
4747 {
4848 $ directory = new RecursiveDirectoryIterator ($ this ->sourceDirectory );
4949 $ iterator = new RecursiveIteratorIterator ($ directory );
50+ $ schemaFiles = [];
5051
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 );
5359
5460 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 " );
5662 }
5763
58- yield new JsonSchema ($ file[ 0 ] , $ decodedJsonSchema );
64+ yield new JsonSchema ($ file , $ decodedJsonSchema );
5965 }
6066 }
6167
You can’t perform that action at this time.
0 commit comments