Skip to content

Commit 29960ff

Browse files
authored
Merge pull request #33 from picamator/development
Release 3.0.1
2 parents b1da9b2 + bcfa755 commit 29960ff

File tree

3 files changed

+29
-29
lines changed

3 files changed

+29
-29
lines changed

composer.lock

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Transfer/AbstractTransfer.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ final public function toArray(): array
101101

102102
foreach (static::META_DATA as $index => $propertyName) {
103103
$data[$propertyName] = isset($attributes[$propertyName])
104-
? $attributes[$propertyName]->toArray($this->{$propertyName})
104+
? $attributes[$propertyName]->toArray($this->_data[$index])
105105
: $this->_data[$index];
106106
}
107107

@@ -118,6 +118,7 @@ final public function fromArray(array $data): static
118118
}
119119

120120
$attributes = $this->getTypeAttributes();
121+
121122
foreach ($data as $propertyName => $value) {
122123
$this->{$propertyName} = isset($attributes[$propertyName])
123124
? $attributes[$propertyName]->fromArray($value)

src/TransferGenerator/Definition/Enum/BuildInTypeEnum.php

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,26 @@ enum BuildInTypeEnum: string
1515
case ARRAY = 'array';
1616
case ARRAY_OBJECT = 'ArrayObject';
1717

18+
private const array IS_ALLOWED = [
19+
self::BOOL,
20+
self::TRUE,
21+
self::FALSE,
22+
self::INT,
23+
self::FLOAT,
24+
self::STRING,
25+
self::ARRAY,
26+
self::ARRAY_OBJECT,
27+
];
28+
1829
case ITERABLE = 'iterable';
1930
case NULL = 'null';
2031
case OBJECT = 'object';
2132
case MIXED = 'mixed';
2233
case CALLABLE = 'callable';
2334

24-
private const array NOT_ALLOWED = [
25-
self::ITERABLE,
26-
self::NULL,
27-
self::OBJECT,
28-
self::MIXED,
29-
self::CALLABLE,
30-
];
31-
3235
public static function getTrueFalse(bool $value): self
3336
{
34-
if ($value === true) {
35-
return self::TRUE;
36-
}
37-
38-
return self::FALSE;
37+
return $value === true ? self::TRUE : self::FALSE;
3938
}
4039

4140
public function isArray(): bool
@@ -50,6 +49,6 @@ public function isArrayObject(): bool
5049

5150
public function isAllowed(): bool
5251
{
53-
return !in_array($this, self::NOT_ALLOWED, true);
52+
return in_array($this, self::IS_ALLOWED, true);
5453
}
5554
}

0 commit comments

Comments
 (0)