Skip to content

Commit 8a18b4c

Browse files
committed
Add mixed as parameter type and return type
1 parent 0e3919d commit 8a18b4c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+100
-303
lines changed

src/Helper/AccessableTrait.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,8 @@ trait AccessableTrait
2525

2626
/**
2727
* Set a value
28-
*
29-
* @param mixed $value The Value
3028
*/
31-
final protected function set(string $key, $value): void
29+
final protected function set(string $key, mixed $value): void
3230
{
3331
// Allow non-associative array for collections
3432
if ($key === '') {
@@ -93,10 +91,8 @@ final public function has($key): bool
9391
* Get a value by a key
9492
*
9593
* @param int|string|AccessKey<string> $key The key
96-
*
97-
* @return mixed
9894
*/
99-
public function get($key)
95+
public function get($key): mixed
10096
{
10197
if (!is_int($key) && !is_string($key) && (!is_object($key) || !$key instanceof AccessKey)) {
10298
trigger_error(sprintf(
@@ -131,10 +127,8 @@ public function get($key)
131127
* Get a value by the key
132128
*
133129
* @throws AccessException
134-
*
135-
* @return mixed The value
136130
*/
137-
private function getValue(string $key)
131+
private function getValue(string $key): mixed
138132
{
139133
if (array_key_exists($key, $this->data)) {
140134
return $this->data[$key];

src/Input/StringInputTrait.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,8 @@ final public function prepareString($string): string
4141
* Decodes a json string
4242
*
4343
* @throws InputException if something went wrong with the input
44-
*
45-
* @return mixed
4644
*/
47-
final protected function decodeJson(string $jsonString)
45+
final protected function decodeJson(string $jsonString): mixed
4846
{
4947
$jsonErrors = [
5048
\JSON_ERROR_DEPTH => 'JSON_ERROR_DEPTH - Maximum stack depth exceeded',

src/Manager/ErrorAbortManager.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,8 @@ public function getFactory(): Factory
7878

7979
/**
8080
* Get a param by key
81-
*
82-
* @param mixed $default
83-
*
84-
* @return mixed
8581
*/
86-
public function getParam(string $key, $default)
82+
public function getParam(string $key, mixed $default): mixed
8783
{
8884
if (array_key_exists($key, $this->config)) {
8985
return $this->config[$key];

src/Serializer/ArraySerializer.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,8 @@ public function serialize(Accessable $data): ?array
6262

6363
/**
6464
* Transforms objects to arrays
65-
*
66-
* @param mixed $val
67-
*
68-
* @return mixed
6965
*/
70-
private function objectTransform($val)
66+
private function objectTransform(mixed $val): mixed
7167
{
7268
if (!is_object($val)) {
7369
return $val;

src/V1/Attributes.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,9 @@ final class Attributes extends AbstractElement
2323
/**
2424
* Parses the data for this element
2525
*
26-
* @param mixed $object The data
27-
*
2826
* @throws ValidationException
2927
*/
30-
protected function parse($object): void
28+
protected function parse(mixed $object): void
3129
{
3230
if (!is_object($object)) {
3331
throw new ValidationException('Attributes has to be an object, "' . gettype($object) . '" given.');
@@ -52,10 +50,8 @@ protected function parse($object): void
5250
* Get a value by the key of this object
5351
*
5452
* @param int|string|AccessKey<string> $key The key of the value
55-
*
56-
* @return mixed The value
5753
*/
58-
public function get($key)
54+
public function get($key): mixed
5955
{
6056
try {
6157
return parent::get($key);

src/V1/Document.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,9 @@ final class Document extends AbstractElement
2424
/**
2525
* Parses the data for this element
2626
*
27-
* @param mixed $object The data
28-
*
2927
* @throws ValidationException
3028
*/
31-
protected function parse($object): void
29+
protected function parse(mixed $object): void
3230
{
3331
if (!is_object($object)) {
3432
throw new ValidationException('Document has to be an object, "' . gettype($object) . '" given.');
@@ -75,10 +73,8 @@ protected function parse($object): void
7573
* Get a value by the key of this object
7674
*
7775
* @param int|string|AccessKey<string> $key The key of the value
78-
*
79-
* @return mixed The value
8076
*/
81-
public function get($key)
77+
public function get($key): mixed
8278
{
8379
try {
8480
return parent::get($key);

src/V1/DocumentLink.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,9 @@ final class DocumentLink extends AbstractElement
2828
/**
2929
* Parses the data for this element
3030
*
31-
* @param mixed $object The data
32-
*
3331
* @throws ValidationException
3432
*/
35-
protected function parse($object): void
33+
protected function parse(mixed $object): void
3634
{
3735
if (!is_object($object)) {
3836
throw new ValidationException(
@@ -105,10 +103,8 @@ protected function parse($object): void
105103
* Get a value by the key of this object
106104
*
107105
* @param int|string|AccessKey<string> $key The key of the value
108-
*
109-
* @return mixed The value
110106
*/
111-
public function get($key)
107+
public function get($key): mixed
112108
{
113109
try {
114110
return parent::get($key);

src/V1/Error.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,9 @@ final class Error extends AbstractElement
2323
/**
2424
* Parses the data for this element
2525
*
26-
* @param mixed $object The data
27-
*
2826
* @throws ValidationException
2927
*/
30-
protected function parse($object): void
28+
protected function parse(mixed $object): void
3129
{
3230
if (!is_object($object)) {
3331
throw new ValidationException(
@@ -107,10 +105,8 @@ protected function parse($object): void
107105
* Get a value by the key of this object
108106
*
109107
* @param int|string|AccessKey<string> $key The key of the value
110-
*
111-
* @return mixed The value
112108
*/
113-
public function get($key)
109+
public function get($key): mixed
114110
{
115111
try {
116112
return parent::get($key);

src/V1/ErrorCollection.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,9 @@ final class ErrorCollection extends AbstractElement
2323
/**
2424
* Parses the data for this element
2525
*
26-
* @param mixed $object The data
27-
*
2826
* @throws ValidationException
2927
*/
30-
protected function parse($object): void
28+
protected function parse(mixed $object): void
3129
{
3230
if (!is_array($object)) {
3331
throw new ValidationException('Errors for a collection has to be in an array, "' . gettype($object) . '" given.');
@@ -46,10 +44,8 @@ protected function parse($object): void
4644
* Get a value by the key of this document
4745
*
4846
* @param int|string|AccessKey<string> $key The key of the value
49-
*
50-
* @return mixed The value
5147
*/
52-
public function get($key)
48+
public function get($key): mixed
5349
{
5450
try {
5551
return parent::get($key);

src/V1/ErrorLink.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,9 @@ final class ErrorLink extends AbstractElement
2727
/**
2828
* Parses the data for this element
2929
*
30-
* @param mixed $object The data
31-
*
3230
* @throws ValidationException
3331
*/
34-
protected function parse($object): void
32+
protected function parse(mixed $object): void
3533
{
3634
if (!is_object($object)) {
3735
throw new ValidationException('Link has to be an object, "' . gettype($object) . '" given.');
@@ -65,10 +63,8 @@ protected function parse($object): void
6563
* Get a value by the key of this object
6664
*
6765
* @param int|string|AccessKey<string> $key The key of the value
68-
*
69-
* @return mixed The value
7066
*/
71-
public function get($key)
67+
public function get($key): mixed
7268
{
7369
try {
7470
return parent::get($key);

0 commit comments

Comments
 (0)