Improved typing and phpdoc type annotations

This commit is contained in:
Jan Böhmer 2023-06-18 15:37:42 +02:00
parent 3817ba774d
commit b7c8ca2a48
39 changed files with 189 additions and 129 deletions

View file

@ -33,8 +33,8 @@ use Symfony\Component\Filesystem\Filesystem;
*/
class AttachmentPathResolver
{
protected ?string $media_path;
protected ?string $footprints_path;
protected string $media_path;
protected string $footprints_path;
protected ?string $models_path;
protected ?string $secure_path;
@ -54,11 +54,11 @@ class AttachmentPathResolver
*/
public function __construct(protected string $project_dir, string $media_path, string $secure_path, ?string $footprints_path, ?string $models_path)
{
//Determine the path for our ressources
$this->media_path = $this->parameterToAbsolutePath($media_path);
$this->footprints_path = $this->parameterToAbsolutePath($footprints_path);
//Determine the path for our resources
$this->media_path = $this->parameterToAbsolutePath($media_path) ?? throw new \InvalidArgumentException('The media path must be set and valid!');
$this->secure_path = $this->parameterToAbsolutePath($secure_path) ?? throw new \InvalidArgumentException('The secure path must be set and valid!');
$this->footprints_path = $this->parameterToAbsolutePath($footprints_path) ;
$this->models_path = $this->parameterToAbsolutePath($models_path);
$this->secure_path = $this->parameterToAbsolutePath($secure_path);
$this->pathes = [$this->media_path, $this->media_path, $this->footprints_path, $this->models_path, $this->secure_path];
//Remove all disabled placeholders
@ -192,7 +192,7 @@ class AttachmentPathResolver
}
/**
* The path where uploaded attachments is stored.
* The path where uploaded attachments is stored.
*
* @return string the absolute path to the media folder
*/
@ -202,8 +202,8 @@ class AttachmentPathResolver
}
/**
* The path where secured attachments are stored. Must not be located in public/ folder, so it can only be accessed
* via the attachment controller.
* The path where secured attachments are stored. Must not be located in public/ folder, so it can only be accessed
* via the attachment controller.
*
* @return string the absolute path to the secure path
*/
@ -215,7 +215,7 @@ class AttachmentPathResolver
/**
* The string where the builtin footprints are stored.
*
* @return string|null The absolute path to the footprints folder. Null if built footprints were disabled.
* @return string|null The absolute path to the footprints' folder. Null if built footprints were disabled.
*/
public function getFootprintsPath(): ?string
{
@ -225,7 +225,7 @@ class AttachmentPathResolver
/**
* The string where the builtin 3D models are stored.
*
* @return string|null The absolute path to the models folder. Null if builtin models were disabled.
* @return string|null The absolute path to the models' folder. Null if builtin models were disabled.
*/
public function getModelsPath(): ?string
{