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 1515
1616namespace FastyBird \JsonApi \Builder ;
1717
18- use DivisionByZeroError ;
1918use FastyBird \JsonApi \JsonApi ;
2019use InvalidArgumentException ;
2120use Neomerx ;
@@ -77,7 +76,6 @@ public function __construct(
7776 * @param object|Array<object>|null $entity
7877 * @param callable(string): bool $linkValidator
7978 *
80- * @throws DivisionByZeroError
8179 * @throws InvalidArgumentException
8280 * @throws RuntimeException
8381 */
@@ -113,7 +111,7 @@ public function build(
113111 $ pageLimit = null ;
114112 }
115113
116- if ($ pageOffset !== null && $ pageLimit !== null ) {
114+ if ($ pageOffset !== null && $ pageLimit !== null && $ pageLimit > 0 ) {
117115 $ lastPage = (int ) round ($ totalCount / $ pageLimit ) * $ pageLimit ;
118116
119117 if ($ lastPage === $ totalCount ) {
Original file line number Diff line number Diff line change @@ -425,6 +425,13 @@ protected function mapEntity(string $entityClassName): array
425425 $ varAnnotation = $ this ->parseAnnotation ($ rp , 'var ' );
426426
427427 try {
428+ $ propertyType = $ rp ->getType ();
429+
430+ if ($ propertyType instanceof ReflectionNamedType) {
431+ $ varAnnotation = ($ varAnnotation === null ? '' : $ varAnnotation . '| ' )
432+ . $ propertyType ->getName () . ($ propertyType ->allowsNull () ? '|null ' : '' );
433+ }
434+
428435 $ rm = $ rc ->getMethod ('get ' . ucfirst ($ fieldName ));
429436
430437 $ returnType = $ rm ->getReturnType ();
You can’t perform that action at this time.
0 commit comments