From 242fbb4a9cbc8cc171aa1263aaa854524b91524f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20FIDRY?= Date: Sun, 19 Mar 2023 21:23:44 +0100 Subject: [PATCH] refactor: Do not allow to pass an alias to Pharaoh --- src/Pharaoh/Pharaoh.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Pharaoh/Pharaoh.php b/src/Pharaoh/Pharaoh.php index aff3d54b4..5e6a77216 100644 --- a/src/Pharaoh/Pharaoh.php +++ b/src/Pharaoh/Pharaoh.php @@ -69,7 +69,7 @@ final class Pharaoh private ?PharInfo $pharInfo = null; private ?string $path = null; - public function __construct(string $file, ?string $alias = null) + public function __construct(string $file) { Assert::readable($file); Assert::false( @@ -83,7 +83,7 @@ public function __construct(string $file, ?string $alias = null) } // We have to give every one a different alias, or it pukes. - $alias ??= (Hex::encode(random_bytes(16)).'.phar'); + $alias = (Hex::encode(random_bytes(16)).'.phar'); $tmpFile = sys_get_temp_dir().DIRECTORY_SEPARATOR.$alias; copy($file, $tmpFile);