@@ -30,12 +30,12 @@ class ElementResource extends BaseObject implements ResourceAdapterInterface
3030 /**
3131 * @var string The element type class name
3232 */
33- public $ elementType ;
33+ public string $ elementType ;
3434
3535 /**
3636 * @var array The element criteria params that should be used to filter the matching elements
3737 */
38- public $ criteria = [];
38+ public array $ criteria = [];
3939
4040 /**
4141 * @var callable|string|array|TransformerAbstract The transformer config, or an actual transformer object
@@ -45,34 +45,34 @@ class ElementResource extends BaseObject implements ResourceAdapterInterface
4545 /**
4646 * @var bool Whether to only return one result
4747 */
48- public $ one = false ;
48+ public bool $ one = false ;
4949
5050 /**
5151 * @var bool Whether to paginate the results
5252 */
53- public $ paginate = true ;
53+ public bool $ paginate = true ;
5454
5555 /**
5656 * @var int The number of elements to include per page
5757 * @see paginate
5858 */
59- public $ elementsPerPage = 100 ;
59+ public int $ elementsPerPage = 100 ;
6060
6161 /**
6262 * @var string The query string param name that should be used to specify the page number
6363 * @see paginate
6464 */
65- public $ pageParam = 'page ' ;
65+ public string $ pageParam = 'page ' ;
6666
6767 /**
6868 * @var string|null The resource key that should be set on the resource
6969 */
70- public $ resourceKey ;
70+ public ? string $ resourceKey = ' data ' ;
7171
7272 /**
7373 * @var array|null Custom meta values
7474 */
75- public $ meta ;
75+ public ? array $ meta = null ;
7676
7777 /**
7878 * @inheritdoc
@@ -91,9 +91,9 @@ public function __construct(array $config = [])
9191 * @inheritdoc
9292 * @throws InvalidConfigException
9393 */
94- public function init ()
94+ public function init (): void
9595 {
96- if ($ this ->elementType === null || !is_subclass_of ($ this ->elementType , ElementInterface::class)) {
96+ if (! isset ( $ this ->elementType ) || !is_subclass_of ($ this ->elementType , ElementInterface::class)) {
9797 throw new InvalidConfigException ('Endpoint has an invalid elementType ' );
9898 }
9999
0 commit comments