Otherwise phpstorm doesn't understand the paths correctly. He thinks that this is not a complete application, but a package. And when creating a class, the namespace indicates “app” with a small letter, but should be “App”.
30 lines
630 B
PHP
30 lines
630 B
PHP
<?php declare(strict_types=1);
|
|
|
|
namespace App\Dto\Service\Storage;
|
|
|
|
use App\Contracts\StorageType;
|
|
use App\Dto\Service\Dto;
|
|
use App\Exceptions\Dto\Storage\FileException;
|
|
|
|
final readonly class File extends Dto
|
|
{
|
|
public function __construct(
|
|
private int $id,
|
|
private StorageType $storageType,
|
|
) {
|
|
if ($this->id < 1) {
|
|
throw new FileException('ID cannot be equal to or less than zero: ' . $this->id);
|
|
}
|
|
}
|
|
|
|
public function getId(): int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function getStorageType(): StorageType
|
|
{
|
|
return $this->storageType;
|
|
}
|
|
}
|