Skip to content

Commit 2be4827

Browse files
committed
init
1 parent 2777f1d commit 2be4827

6 files changed

Lines changed: 12 additions & 44 deletions

File tree

compose.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ services:
22
morph:
33
platform: linux/amd64
44
container_name: morph-app
5-
image: webdevops/php-dev:8.3
5+
image: devitools/hyperf:8.3-dev
66
working_dir: /opt/www
77
volumes:
88
- ./:/opt/www
99
environment:
10-
- XDEBUG_MODE=coverage
1110
- SONAR_TOKEN=${SONAR_TOKEN:-undefined}
1211
entrypoint: [ 'tail', '-f', '/dev/null' ]
1312
restart: on-failure

src/Support/Reflective/Engine.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Morph\Support\Reflective;
66

7+
use Morph\Type\Collection;
78
use ReflectionClass;
89
use ReflectionException;
910
use ReflectionIntersectionType;

src/Type/Collection/AbstractCollection.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,23 @@ final public function count(): int
4545
return count($this->data);
4646
}
4747

48-
final public function all(): array
48+
final protected function data(): array
4949
{
5050
return $this->data;
5151
}
5252

53-
final public function map(Closure $callback): array
53+
final protected function datum(): mixed
5454
{
55-
return array_map($callback, $this->data());
55+
return $this->data[$this->cursor] ?? null;
5656
}
5757

58-
final protected function data(): array
58+
public function all(): array
5959
{
6060
return $this->data;
6161
}
6262

63-
final protected function datum(): mixed
63+
public function map(Closure $callback): array
6464
{
65-
return $this->data[$this->cursor] ?? null;
65+
return array_map($callback, $this->data());
6666
}
6767
}

tests/Core/Serialize/BuilderTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ public function testMapWithErrors(): void
9999
$messages = [
100100
"The value for 'id' must be of type 'int' and 'string' was given.",
101101
"The value for 'price' is required and was not given.",
102-
"The value for 'more' must be of type 'Serendipity\\Test\\Testing\\Stub\\NoConstructor' and 'DateTime' was given.",
103-
"The value for 'no' must be of type 'Serendipity\\Test\\Testing\\Stub\\NoParameters' and 'string' was given.",
104-
"The value for 'enum' must be of type 'Serendipity\\Test\\Testing\\Stub\\Type\\SingleBacked' and 'bool' was given.",
102+
"The value for 'more' must be of type 'Morph\\Test\\Stub\\NoConstructor' and 'DateTime' was given.",
103+
"The value for 'no' must be of type 'Morph\\Test\\Stub\\NoParameters' and 'string' was given.",
104+
"The value for 'enum' must be of type 'Morph\\Test\\Stub\\Type\\SingleBacked' and 'bool' was given.",
105105
];
106106
foreach ($messages as $message) {
107107
if ($this->hasErrorMessage($errors, $message)) {

tests/Core/Serialize/Resolver/AttributeValueTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
use DateTimeInterface;
99
use Morph\Core\Serialize\Resolver\AttributeValue;
1010
use Morph\Exception\Adapter\NotResolved;
11+
use Morph\Support\Managed;
1112
use Morph\Support\Reflective\Factory\Target;
1213
use Morph\Support\Set;
1314
use Morph\Test\Stub\AttributesVariety;
1415
use PHPUnit\Framework\TestCase;
15-
use Serendipity\Infrastructure\Database\Managed;
1616

1717
use function Morph\Crypt\encrypt;
1818

tests/Core/Serialize/Resolver/CollectionValueTest.php

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,38 +16,6 @@
1616

1717
final class CollectionValueTest extends TestCase
1818
{
19-
public function testShouldResolveSuccessfully(): void
20-
{
21-
// Arrange
22-
$type = $this->createMock(ReflectionNamedType::class);
23-
$type->expects($this->once())
24-
->method('getName')
25-
->willReturn(FeatureCollection::class);
26-
$parameter = $this->createMock(ReflectionParameter::class);
27-
$parameter->expects($this->once())
28-
->method('getType')
29-
->willReturn($type);
30-
$parameter->expects($this->once())
31-
->method('getName')
32-
->willReturn('features');
33-
34-
$faker = $this->faker();
35-
$set = Set::createFrom([
36-
'features' => [
37-
$faker->fake(Feature::class)->toArray(),
38-
$faker->fake(Feature::class)->toArray(),
39-
],
40-
]);
41-
$collectionValue = new CollectionValue();
42-
43-
// Act
44-
$result = $collectionValue->resolve($parameter, $set);
45-
46-
// Assert
47-
$this->assertInstanceOf(FeatureCollection::class, $result->content);
48-
$this->assertCount(2, $result->content);
49-
}
50-
5119
public function testShouldResolveWhenTheValueIsNotValid(): void
5220
{
5321
// Arrange

0 commit comments

Comments
 (0)