@@ -214,7 +214,7 @@ public function handleQuery(string $query, array $params): string
214214
215215 $ stmt = $ this ->db ->query ($ sql );
216216 assert (false !== $ stmt );
217- //If we got here, there's no errors
217+ // If we got here, there's no errors
218218 $ response .= $ this ->getSuccessInit ($ meta );
219219 $ first = true ;
220220 foreach ($ stmt as $ row ) {
@@ -272,11 +272,11 @@ public function generateMetadata(array $query): array
272272 }
273273
274274 if (!isset ($ query ['select ' ])) {
275- //By default, return all fields defined for an entity
275+ // By default, return all fields defined for an entity
276276 $ query ['select ' ] = array_keys ($ entity ['fields ' ]);
277277 }
278278
279- //The query fields might be different from the "select" fields (callback dependant fields will not be returned)
279+ // The query fields might be different from the "select" fields (callback dependant fields will not be returned)
280280 $ meta ['query_fields ' ] = [];
281281 $ meta ['joins ' ] = [];
282282 $ meta ['field_spec ' ] = [];
@@ -313,7 +313,7 @@ public function generateMetadata(array $query): array
313313 $ meta ['select ' ] = $ query ['select ' ];
314314
315315 if (isset ($ query ['where ' ])) {
316- //Parse the where clauses and error out on non-existant and callback fields and add joins
316+ // Parse the where clauses and error out on non-existant and callback fields and add joins
317317 foreach ($ query ['where ' ] as $ whereToken ) {
318318 if ('where_field ' === $ whereToken ['type ' ]) {
319319 $ field = $ whereToken ['value ' ];
@@ -334,7 +334,7 @@ public function generateMetadata(array $query): array
334334 }
335335 }
336336
337- //Also add the joins & field spec information for the orderby, groupby, and pivot clauses
337+ // Also add the joins & field spec information for the orderby, groupby, and pivot clauses
338338 if (isset ($ query ['pivot ' ])) {
339339 foreach ($ query ['pivot ' ] as $ field ) {
340340 if (!isset ($ entity ['fields ' ][$ field ])) {
@@ -393,7 +393,7 @@ public function generateMetadata(array $query): array
393393 }
394394 }
395395
396- //Some of the query information we just copy into the metadata array
396+ // Some of the query information we just copy into the metadata array
397397 $ copyKeys = ['where ' , 'orderby ' , 'groupby ' , 'pivot ' , 'limit ' , 'offset ' , 'labels ' , 'formats ' , 'options ' ];
398398 foreach ($ copyKeys as $ copyKey ) {
399399 if (isset ($ query [$ copyKey ])) {
@@ -544,7 +544,7 @@ public function getRowValues(array $row, array $meta): string
544544 $ time = strtotime ($ year .'0104 + ' .$ week .' weeks ' );
545545 assert (false !== $ time );
546546 $ monday = strtotime ('- ' .((int ) date ('w ' , $ time ) - 1 ).' days ' , $ time );
547- assert (false !== $ monday );
547+ assert (false !== $ monday ); // @phpstan-ignore-line ; PHP < 8.0
548548 [$ year , $ month , $ day ] = explode ('- ' , date ('Y-m-d ' , $ monday ));
549549 $ formatted = date ($ format , $ monday );
550550 } else {
@@ -927,7 +927,7 @@ protected function generateSQL(array &$meta): string
927927 }
928928
929929 if (isset ($ meta ['pivot ' ])) {
930- //Pivot queries are special - they require an entity to be passed and modify the query directly
930+ // Pivot queries are special - they require an entity to be passed and modify the query directly
931931 $ entity = $ meta ['entity ' ];
932932 $ pivotFields = [];
933933 $ pivotJoins = [];
@@ -965,17 +965,17 @@ protected function generateSQL(array &$meta): string
965965 $ stmt = $ this ->db ->query ($ pivotSql );
966966 assert (false !== $ stmt );
967967 $ rows = $ stmt ->fetchAll (PDO ::FETCH_ASSOC );
968- assert (is_array ( $ rows ));
968+ assert (false !== $ rows ); // @phpstan-ignore-line ; PHP < 8.0
969969 foreach ($ rows as $ row ) {
970- //Create a version of all function-ed fields for each unique combination of pivot values
970+ // Create a version of all function-ed fields for each unique combination of pivot values
971971 foreach ($ funcFields as $ field ) {
972972 $ field [2 ] = $ row ;
973973
974974 $ meta ['query_fields ' ][] = $ field ;
975975 }
976976 }
977977
978- //For pivot queries, the fields we return and the fields we query against are always the same
978+ // For pivot queries, the fields we return and the fields we query against are always the same
979979 $ meta ['select ' ] = $ meta ['query_fields ' ];
980980 }
981981
@@ -996,7 +996,7 @@ protected function generateSQL(array &$meta): string
996996 if (isset ($ meta ['where ' ])) {
997997 $ where = [];
998998 foreach ($ meta ['where ' ] as &$ wherePart ) {
999- //Replace field references with their SQL forms
999+ // Replace field references with their SQL forms
10001000 switch ($ wherePart ['type ' ]) {
10011001 case 'where_field ' :
10021002 $ wherePart ['value ' ] = $ this ->getFieldSQL ($ wherePart ['value ' ], $ meta ['field_spec ' ][$ wherePart ['value ' ]]);
@@ -1058,7 +1058,7 @@ protected function generateSQL(array &$meta): string
10581058 $ first = true ;
10591059 foreach ($ meta ['orderby ' ] as $ field => $ dir ) {
10601060 if (isset ($ meta ['field_spec ' ][$ field ]['sort_field ' ])) {
1061- //An entity field can delegate sorting to another field by using the "sort_field" key
1061+ // An entity field can delegate sorting to another field by using the "sort_field" key
10621062 $ field = $ meta ['field_spec ' ][$ field ]['sort_field ' ];
10631063 }
10641064 $ spec = $ meta ['field_spec ' ][$ field ];
0 commit comments