@@ -38,8 +38,10 @@ class RdfResource implements \ArrayAccess
38
38
/**
39
39
* Constructor, creates the RdfResource decorating a freshly created
40
40
* or given EasyRdf\Resource with new resource naming capabilities.
41
+ *
42
+ * @param EasyRdfGraph|RdfGraph|null $graph
41
43
*/
42
- public function __construct (?string $ uri , EasyRdfGraph | RdfGraph | null $ graph = null , ?EasyRdfResource $ resource = null )
44
+ public function __construct (?string $ uri , $ graph = null , ?EasyRdfResource $ resource = null )
43
45
{
44
46
$ graph = ($ graph instanceof RdfGraph) ? $ graph ->getEasyGraph () : $ graph ;
45
47
$ this ->resource = $ resource ?? new EasyRdfResource ($ uri , $ graph );
@@ -281,7 +283,7 @@ public static function fromEasyRdf(EasyRdfResource $resource): self
281
283
* Turns any EasyRdf\Resource, provided by reference, into an RdfResource.
282
284
* Any form of resource is accepted but only EasyRdf\Resources are impacted.
283
285
*
284
- * @param mixed &$resource
286
+ * @param &$resource mixed resource types
285
287
*/
286
288
public static function ensureResourceClass (&$ resource ): void
287
289
{
@@ -294,18 +296,18 @@ public static function ensureResourceClass(&$resource): void
294
296
*/
295
297
public static function ensureResourcesClass (array &$ resources ): void
296
298
{
297
- array_walk ($ resources , ' self::ensureResourceClass ' );
299
+ array_walk ($ resources , self ::class. ' ::ensureResourceClass ' );
298
300
}
299
301
300
302
/**
301
303
* Extends the capabilities of any EasyRdf\Resource provided by turning it
302
304
* into an RdfResource.
303
305
*
304
- * @param mixed $ resource
306
+ * @param $resource mixed resource types
305
307
*
306
- * @return mixed $resource
308
+ * @return $resource mixed but EasyRdf\Resource is wrapped into an RdfResource
307
309
*/
308
- public static function wrapEasyRdfResource ($ resource ): mixed
310
+ public static function wrapEasyRdfResource ($ resource )
309
311
{
310
312
$ resource = ($ resource instanceof EasyRdfResource) ? self ::fromEasyRdf ($ resource ) : $ resource ;
311
313
@@ -318,15 +320,17 @@ public static function wrapEasyRdfResource($resource): mixed
318
320
*/
319
321
public static function wrapEasyRdfResources (array $ resources ): array
320
322
{
321
- array_walk ($ resources , ' self::ensureResourceClass ' );
323
+ array_walk ($ resources , self ::class. ' ::ensureResourceClass ' );
322
324
323
325
return $ resources ;
324
326
}
325
327
326
328
/**
327
329
* Returns the corresponding EasyRdf\Resource for any RdfResource provided.
328
330
*
329
- * @param mixed $resource
331
+ * @param $resource mixed resource types
332
+ *
333
+ * @return $resource mixed but any RdfResource will return its contained EasyRdf\resource
330
334
*/
331
335
public static function fromRdftoEasyRdfResource ($ resource )
332
336
{
@@ -341,7 +345,7 @@ public static function fromRdftoEasyRdfResource($resource)
341
345
*/
342
346
public static function fromRdftoEasyRdfResources (array $ resources ): array
343
347
{
344
- array_walk ($ resources , ' self::ensureEasyResourceClass ' );
348
+ array_walk ($ resources , self ::class. ' ::ensureEasyResourceClass ' );
345
349
346
350
return $ resources ;
347
351
}
@@ -401,7 +405,8 @@ public function offsetExists($offset): bool
401
405
/**
402
406
* Array Access Interface: perform get at using array syntax.
403
407
*/
404
- public function offsetGet ($ offset ): mixed
408
+ #[\ReturnTypeWillChange]
409
+ public function offsetGet ($ offset )
405
410
{
406
411
return $ this ->resource ->offsetGet ($ offset );
407
412
}
0 commit comments