File tree Expand file tree Collapse file tree 3 files changed +14
-12
lines changed
Expand file tree Collapse file tree 3 files changed +14
-12
lines changed Original file line number Diff line number Diff line change 2525 }
2626 ],
2727 "require" : {
28- "php" : " ^7.4|^ 8.0" ,
28+ "php" : " ^8.0" ,
2929 "guzzlehttp/guzzle" : " ^7.0.1" ,
3030 "illuminate/support" : " ^8.0|^9.0"
3131 },
Original file line number Diff line number Diff line change @@ -102,17 +102,19 @@ public function filterBy(Collection $filter): Database
102102 *
103103 * @throws HandlingException
104104 *
105- * @todo As soon as this package drops PHP 7.4 support, we can use union types here (Sorting and Collection)
106105 */
107- public function sortBy ($ sorts ): Database
106+ public function sortBy (Sorting | Collection $ sorts ): Database
108107 {
109- if ($ sorts instanceof Sorting) {
110- $ this ->sorts ->push ($ sorts );
111- } elseif ($ sorts instanceof Collection) {
112- $ this ->sorts = $ sorts ;
113- }
114- else {
115- throw new HandlingException ("The parameter 'sorts' must be either a instance of the class Sorting or a Collection of Sortings. " );
108+ $ sortInstance = get_class ($ sorts );
109+ switch ($ sortInstance ) {
110+ case Sorting::class:
111+ $ this ->sorts ->push ($ sorts );
112+ break ;
113+ case Collection::class:
114+ $ this ->sorts = $ sorts ;
115+ break ;
116+ default :
117+ throw new HandlingException ("The parameter 'sorts' must be either a instance of the class Sorting or a Collection of Sortings. " );
116118 }
117119
118120 return $ this ;
Original file line number Diff line number Diff line change @@ -227,7 +227,7 @@ private function buildRequestHeader(): array
227227 }
228228
229229 /**
230- * Due to the inconsistency of the Notion API requiring a endpoint url
230+ * Due to the inconsistency of the Notion API requiring an endpoint url
231231 * with v* as well as a dated version in the request header, this method
232232 * maps the given version (e.g. v1) to the version date Notion requires
233233 * in the header (e.g. "2021-05-13").
@@ -240,7 +240,7 @@ private function mapVersionToHeaderVersion(): string
240240 {
241241 switch ($ this ->version ) {
242242 case 'v1 ' :
243- return '2022-06-28 ' ;
243+ return '2021-05-13 ' ;
244244 default :
245245 throw new HandlingException ('Invalid version. ' );
246246 }
You can’t perform that action at this time.
0 commit comments