diff --git a/phar.php b/phar.php index dd2c82a..a54f77b 100644 --- a/phar.php +++ b/phar.php @@ -1,4 +1,4 @@ - */ - private static function extractVersions($release) + private static function extractVersions(?string $release): array { + $release ??= ''; $phar = "madeline-$release.phar"; $packages = ['danog/madelineproto' => 'old']; if (!\file_exists("phar://$phar/vendor/composer/installed.json")) { @@ -111,16 +111,10 @@ class Installer return $packages; } - /** * Report installs to composer. - * - * @param string $local_release - * @param string $remote_release - * - * @return void */ - private static function reportComposer($local_release, $remote_release) + private static function reportComposer(?string $local_release, ?string $remote_release): void { $previous = self::extractVersions($local_release); $current = self::extractVersions($remote_release); @@ -135,11 +129,7 @@ class Installer ]; } - if (\defined('HHVM_VERSION')) { - $phpVersion = 'HHVM '.HHVM_VERSION; - } else { - $phpVersion = 'PHP '.PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION.'.'.PHP_RELEASE_VERSION; - } + $phpVersion = 'PHP '.PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION.'.'.PHP_RELEASE_VERSION; $opts = ['http' => [ 'method' => 'POST', @@ -164,13 +154,13 @@ class Installer /** * Load phar file. - * - * @param string|null $release - * @return mixed */ - private static function load($release) + private static function load(?string $release): mixed { if ($release === null) { + if ((PHP_MAJOR_VERSION === 8 && PHP_MINOR_VERSION < 1) || PHP_MAJOR_VERSION <= 7) { + throw new \Exception('MadelineProto requires at least PHP 8.1.'); + } throw new \Exception('Could not download MadelineProto, please check your internet connection and PHP configuration!'); } $phar = "madeline-$release.phar"; @@ -188,21 +178,16 @@ class Installer /** * Unlock phar. * - * @return void */ - public static function unlock() + public static function unlock(): void { \flock(self::$lock, LOCK_UN); } /** * Lock installer. - * - * @param string $version Version file to lock - * - * @return bool */ - private function lock($version) + private function lock(string $version): bool { if ($this->lockInstaller) { return true; @@ -213,8 +198,6 @@ class Installer /** * Install MadelineProto. - * - * @return mixed */ public function install() { diff --git a/release71 b/release71 index 95c05ac..214854a 100644 --- a/release71 +++ b/release71 @@ -1 +1 @@ -37fdcd57a3e8676f58e327f28acb39b4a127229b-71 \ No newline at end of file +32cf35e179916a63e1cafb45b899584712f00201-71 \ No newline at end of file diff --git a/release72 b/release72 index cb6657c..9ffb2e2 100644 --- a/release72 +++ b/release72 @@ -1 +1 @@ -37fdcd57a3e8676f58e327f28acb39b4a127229b-72 \ No newline at end of file +32cf35e179916a63e1cafb45b899584712f00201-72 \ No newline at end of file diff --git a/release73 b/release73 index 85c1ae6..24d9080 100644 --- a/release73 +++ b/release73 @@ -1 +1 @@ -37fdcd57a3e8676f58e327f28acb39b4a127229b-73 \ No newline at end of file +32cf35e179916a63e1cafb45b899584712f00201-73 \ No newline at end of file diff --git a/release74 b/release74 index f602af1..f3d3d2b 100644 --- a/release74 +++ b/release74 @@ -1 +1 @@ -37fdcd57a3e8676f58e327f28acb39b4a127229b-74 \ No newline at end of file +32cf35e179916a63e1cafb45b899584712f00201-74 \ No newline at end of file diff --git a/release80 b/release80 index b94115a..69cf345 100644 --- a/release80 +++ b/release80 @@ -1 +1 @@ -37fdcd57a3e8676f58e327f28acb39b4a127229b-80 \ No newline at end of file +32cf35e179916a63e1cafb45b899584712f00201-80 \ No newline at end of file diff --git a/release81 b/release81 index a2f8cda..a8cc800 100644 --- a/release81 +++ b/release81 @@ -1 +1 @@ -37fdcd57a3e8676f58e327f28acb39b4a127229b-81 \ No newline at end of file +32cf35e179916a63e1cafb45b899584712f00201-81 \ No newline at end of file