File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 15
15
16
16
namespace FastyBird \JsonApi \Builder ;
17
17
18
- use DivisionByZeroError ;
19
18
use FastyBird \JsonApi \JsonApi ;
20
19
use InvalidArgumentException ;
21
20
use Neomerx ;
@@ -77,7 +76,6 @@ public function __construct(
77
76
* @param object|Array<object>|null $entity
78
77
* @param callable(string): bool $linkValidator
79
78
*
80
- * @throws DivisionByZeroError
81
79
* @throws InvalidArgumentException
82
80
* @throws RuntimeException
83
81
*/
@@ -113,7 +111,7 @@ public function build(
113
111
$ pageLimit = null ;
114
112
}
115
113
116
- if ($ pageOffset !== null && $ pageLimit !== null ) {
114
+ if ($ pageOffset !== null && $ pageLimit !== null && $ pageLimit > 0 ) {
117
115
$ lastPage = (int ) round ($ totalCount / $ pageLimit ) * $ pageLimit ;
118
116
119
117
if ($ lastPage === $ totalCount ) {
Original file line number Diff line number Diff line change @@ -425,6 +425,13 @@ protected function mapEntity(string $entityClassName): array
425
425
$ varAnnotation = $ this ->parseAnnotation ($ rp , 'var ' );
426
426
427
427
try {
428
+ $ propertyType = $ rp ->getType ();
429
+
430
+ if ($ propertyType instanceof ReflectionNamedType) {
431
+ $ varAnnotation = ($ varAnnotation === null ? '' : $ varAnnotation . '| ' )
432
+ . $ propertyType ->getName () . ($ propertyType ->allowsNull () ? '|null ' : '' );
433
+ }
434
+
428
435
$ rm = $ rc ->getMethod ('get ' . ucfirst ($ fieldName ));
429
436
430
437
$ returnType = $ rm ->getReturnType ();
You can’t perform that action at this time.
0 commit comments