Skip to content

Commit a7616cf

Browse files
committed
PHP 8.1 compatibility
1 parent d5b95f2 commit a7616cf

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "printnode/printnode-php",
33
"description": "Connect any printer to your application with PrintNode Client and easy to use JSON API",
44
"require": {
5-
"php": ">=5.3.2",
5+
"php": ">=7.0",
66
"ext-curl": "*"
77
},
88
"keywords": [

src/PrintNode/Entity.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function mapValuesFromJson($json)
102102
*
103103
* @return string
104104
*/
105-
public function jsonSerialize()
105+
public function jsonSerialize(): mixed
106106
{
107107

108108
$json = array();

src/PrintNode/EntityDynamic.php

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
abstract class EntityDynamic extends Entity
66
{
7-
7+
88
/**
99
* Reference to the client
1010
* @var Client
1111
*/
1212
protected static $protectedProperties = array(
1313
'client',
1414
);
15-
15+
1616
/**
1717
* Set property on entity
1818
* @param mixed $propertyName
@@ -21,15 +21,15 @@ abstract class EntityDynamic extends Entity
2121
*/
2222
public function __set($propertyName, $value)
2323
{
24-
24+
2525
if (\in_array($propertyName, self::$protectedProperties)) {
2626
throw new \PrintNode\Exception\InvalidArgumentException($propertyName . ' is a protected property.');
2727
}
28-
28+
2929
$this->$propertyName = $value;
30-
30+
3131
}
32-
32+
3333
/**
3434
* Maps a json object to this entity
3535
*
@@ -38,41 +38,41 @@ public function __set($propertyName, $value)
3838
*/
3939
public function mapValuesFromJson($json)
4040
{
41-
41+
4242
foreach ($json as $key => $value) {
4343
$this->$key = $value;
4444
}
45-
45+
4646
return true;
47-
47+
4848
}
49-
49+
5050
/**
5151
* Implements the jsonSerialize method
5252
*
5353
* @return string
5454
*/
55-
public function jsonSerialize()
55+
public function jsonSerialize(): mixed
5656
{
57-
57+
5858
$refClass = new \ReflectionClass($this);
59-
59+
6060
$properties = get_object_vars($this);
61-
61+
6262
$json = array();
63-
63+
6464
foreach ($properties as $property => $value) {
65-
65+
6666
if (in_array($property, self::$protectedProperties)) {
6767
continue;
6868
}
69-
69+
7070
$json[$property] = $value;
71-
71+
7272
}
73-
73+
7474
return $json;
75-
75+
7676
}
77-
77+
7878
}

0 commit comments

Comments
 (0)