Skip to content

Commit

Permalink
Fix type issue
Browse files Browse the repository at this point in the history
PharData has PharData<PharFileInfo> "signature"
  • Loading branch information
alies-dev committed Feb 27, 2024
1 parent dfdcdae commit ea77dfb
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/Services/MaxMindDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand All @@ -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
*/
Expand Down Expand Up @@ -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;
}
}
Expand Down

0 comments on commit ea77dfb

Please sign in to comment.