From 3eaa381e3465f923dfde866149b2c5a628c8f59f Mon Sep 17 00:00:00 2001 From: Oliver Vogel Date: Sat, 4 May 2024 11:16:33 +0200 Subject: [PATCH] Comply with coding standards --- src/AbstractBinaryType.php | 4 ++-- src/AbstractType.php | 14 +++++++------- src/MimeSniffer.php | 12 ++++++------ src/Types/ApplicationOctetStream.php | 3 ++- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/AbstractBinaryType.php b/src/AbstractBinaryType.php index 020c1f7..b71a98c 100644 --- a/src/AbstractBinaryType.php +++ b/src/AbstractBinaryType.php @@ -9,7 +9,7 @@ abstract class AbstractBinaryType extends AbstractType /** * Prepare content (can be extended by child classes) * - * @param string $content + * @param string $content * @return string */ public function prepareContent(string $content): string @@ -20,7 +20,7 @@ public function prepareContent(string $content): string /** * Determine of current type is binary * - * @return boolean + * @return bool */ public function isBinary(): bool { diff --git a/src/AbstractType.php b/src/AbstractType.php index 08787bd..96248fa 100644 --- a/src/AbstractType.php +++ b/src/AbstractType.php @@ -23,7 +23,7 @@ abstract class AbstractType /** * Determine if the given content matches the signature * - * @param string $content + * @param string $content * @return bool */ public function matches(string $content): bool @@ -34,7 +34,7 @@ public function matches(string $content): bool /** * Determine if the detected type is an image * - * @return boolean + * @return bool */ public function isImage(): bool { @@ -44,7 +44,7 @@ public function isImage(): bool /** * Determine if the detected type is an video * - * @return boolean + * @return bool */ public function isVideo(): bool { @@ -54,7 +54,7 @@ public function isVideo(): bool /** * Determine if the detected type is an audio file * - * @return boolean + * @return bool */ public function isAudio(): bool { @@ -64,7 +64,7 @@ public function isAudio(): bool /** * Determine if the detected type is an archive * - * @return boolean + * @return bool */ public function isArchive(): bool { @@ -79,7 +79,7 @@ public function isArchive(): bool /** * Prepare content (can be extended by child classes) * - * @param string $content + * @param string $content * @return string */ public function prepareContent(string $content): string @@ -90,7 +90,7 @@ public function prepareContent(string $content): string /** * Determine of current type is binary * - * @return boolean + * @return bool */ public function isBinary(): bool { diff --git a/src/MimeSniffer.php b/src/MimeSniffer.php index 7b4cf27..b70caa6 100644 --- a/src/MimeSniffer.php +++ b/src/MimeSniffer.php @@ -30,7 +30,7 @@ public function __construct($content = '') * * @return MimeSniffer */ - public static function createFromString(string $content): MimeSniffer + public static function createFromString(string $content): self { return new self($content); } @@ -42,7 +42,7 @@ public static function createFromString(string $content): MimeSniffer * * @return MimeSniffer */ - public function setFromString(string $content): MimeSniffer + public function setFromString(string $content): self { $this->content = strval($content); @@ -56,7 +56,7 @@ public function setFromString(string $content): MimeSniffer * * @return MimeSniffer */ - public static function createFromFilename(string $filename): MimeSniffer + public static function createFromFilename(string $filename): self { return (new self())->setFromFilename($filename); } @@ -68,7 +68,7 @@ public static function createFromFilename(string $filename): MimeSniffer * * @return MimeSniffer */ - public function setFromFilename(string $filename): MimeSniffer + public function setFromFilename(string $filename): self { $fp = fopen($filename, 'r'); $this->setFromString(fread($fp, 1024)); @@ -102,8 +102,8 @@ public function getType(): AbstractType /** * Determine if content matches the given type or any if the given types in array * - * @param AbstractType|string|array $types - * @return boolean + * @param AbstractType|string|array $types + * @return bool */ public function matches(AbstractType|string|array $types): bool { diff --git a/src/Types/ApplicationOctetStream.php b/src/Types/ApplicationOctetStream.php index f856e56..b15b218 100644 --- a/src/Types/ApplicationOctetStream.php +++ b/src/Types/ApplicationOctetStream.php @@ -20,5 +20,6 @@ class ApplicationOctetStream extends AbstractType * * @var string */ - protected $pattern = "/[\x{00}\x{01}\x{03}\x{04}\x{05}\x{06}\x{07}\x{08}\x{0B}\x{0E}\x{0F}\x{10}\x{11}\x{12}\x{13}\x{14}\x{15}\x{16}\x{17}\x{18}\x{19}\x{1A}\x{1C}\x{1D}\x{1E}\x{1F}]/"; + protected $pattern = "/[\x{00}\x{01}\x{03}\x{04}\x{05}\x{06}\x{07}\x{08}\x{0B}\x{0E}\x{0F}" . + "\x{10}\x{11}\x{12}\x{13}\x{14}\x{15}\x{16}\x{17}\x{18}\x{19}\x{1A}\x{1C}\x{1D}\x{1E}\x{1F}]/"; }