Completed
Push — master ( 15a780...6b8730 )
by Dmitri
01:57
created

src/Application/Dto/Assembler.php (2 issues)

1
<?php
2
3
declare(strict_types=1);
4
5
namespace Damax\Media\Application\Dto;
6
7
use Damax\Media\Domain\Model\Media;
8
9
final class Assembler
10
{
11
    public function toMediaDto(Media $media): MediaDto
12
    {
13
        $dto = new MediaDto();
14
15
        $dto->id = (string) $media->id();
16
        $dto->status = $media->status();
17
        $dto->type = $media->type();
18
        $dto->name = $media->name();
19
        $dto->mimeType = $media->info()->mimeType();
20
        $dto->fileSize = $media->info()->fileSize();
21
        $dto->createdAt = $media->createdAt();
0 ignored issues
show
Documentation Bug introduced by
It seems like $media->createdAt() of type DateTimeImmutable is incompatible with the declared type DateTime of property $createdAt.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
22
        $dto->updatedAt = $media->updatedAt();
0 ignored issues
show
Documentation Bug introduced by
It seems like $media->updatedAt() of type DateTimeImmutable is incompatible with the declared type DateTime of property $updatedAt.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
23
        $dto->metadata = $media->metadata()->all();
24
25
        return $dto;
26
    }
27
}
28