From ea77dfbefbb25a50e87ff7cdb19b678e04ba14b3 Mon Sep 17 00:00:00 2001 From: Alies Lapatsin Date: Tue, 27 Feb 2024 09:22:28 +0530 Subject: [PATCH] Fix type issue PharData has PharData "signature" --- src/Services/MaxMindDatabase.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Services/MaxMindDatabase.php b/src/Services/MaxMindDatabase.php index 3649c6d..0f05c1d 100644 --- a/src/Services/MaxMindDatabase.php +++ b/src/Services/MaxMindDatabase.php @@ -74,7 +74,7 @@ public function update() throw new \Exception('Database path not set in config file.'); } - $this->withTemporaryDirectory(function ($directory) { + $this->withTemporaryDirectory(function ($directory): void { $tarFile = sprintf('%s/maxmind.tar.gz', $directory); file_put_contents($tarFile, fopen($this->config('update_url'), 'rb')); @@ -97,7 +97,7 @@ public function update() * Provide a temporary directory to perform operations in * and ensure it is removed afterward. * - * @param callable $callback + * @param callable(string):void $callback * * @return void */ @@ -125,17 +125,18 @@ protected function withTemporaryDirectory(callable $callback) * * @param \PharData $archive * - * @return mixed + * @return \PharFileInfo * @throws \Exception */ - protected function findDatabaseFile($archive) + protected function findDatabaseFile(\PharData $archive) { + /** @var \PharFileInfo $file */ foreach ($archive as $file) { if ($file->isDir()) { return $this->findDatabaseFile(new \PharData($file->getPathName())); } - if (pathinfo($file, \PATHINFO_EXTENSION) === 'mmdb') { + if (pathinfo($file->getPathName(), \PATHINFO_EXTENSION) === 'mmdb') { return $file; } }