Skip to content

Commit ef69cfd

Browse files
Require league/uri-components ^7.6, migrate from deprecated Modifier::from() to wrap() (#143)
Modifier::wrap()/unwrap() were added in league/uri-components 7.6.0, replacing the deprecated Modifier::from()/getUri(). The ^7 constraint allowed resolving to pre-7.6 versions where wrap() doesn't exist, causing runtime errors. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
1 parent afaec23 commit ef69cfd

4 files changed

Lines changed: 11 additions & 11 deletions

File tree

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"craftcms/cms": "^4.6 || ^5",
1010
"craftcms/flysystem": "^1.0.0 || ^2.0.0",
1111
"league/flysystem-aws-s3-v3": "^3.15",
12-
"league/uri": "^7",
13-
"league/uri-components": "^7",
12+
"league/uri": "^7.6",
13+
"league/uri-components": "^7.6",
1414
"yiisoft/yii2-redis": "^2.0",
1515
"yiisoft/yii2-queue": "^2.3.7",
1616
"phlak/semver": "^4.1",

src/UrlSigner.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ public function sign(string $url): string
1919
$data = $this->getSigningData($url);
2020
$signature = hash_hmac('sha256', $data, $this->signingKey);
2121

22-
return Modifier::from($url)->appendQueryParameters([
22+
return Modifier::wrap($url)->appendQueryParameters([
2323
$this->signatureParameter => $signature,
2424
]);
2525
}
2626

2727
private function getSigningData(string $url): string
2828
{
29-
return Modifier::from($url)
29+
return Modifier::wrap($url)
3030
->removeQueryParameters($this->signatureParameter)
3131
->sortQuery();
3232
}

src/fs/Fs.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,22 +93,22 @@ public function getRootUrl(): ?string
9393
public function createUrl(string $path = ''): UriInterface
9494
{
9595
if ($this->useLocalFs) {
96-
return Modifier::from($this->getLocalFs()->getRootUrl() ?? '/')
96+
return Modifier::wrap($this->getLocalFs()->getRootUrl() ?? '/')
9797
->appendSegment($this->createPath($path))
98-
->getUri();
98+
->unwrap();
9999
}
100100

101101
$baseUrl = App::parseEnv($this->baseUrl);
102102

103103
if ($baseUrl) {
104-
return Modifier::from($baseUrl)
104+
return Modifier::wrap($baseUrl)
105105
->appendSegment($this->createPath($path))
106-
->getUri();
106+
->unwrap();
107107
}
108108

109-
return Modifier::from(Module::getInstance()->getConfig()->cdnBaseUrl)
109+
return Modifier::wrap(Module::getInstance()->getConfig()->cdnBaseUrl)
110110
->appendSegment($this->createBucketPath($path))
111-
->getUri();
111+
->unwrap();
112112
}
113113

114114
/**

src/web/AssetManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ protected function preparePaths(): void
3434
FileHelper::createDirectory($this->basePath);
3535
}
3636

37-
$this->baseUrl = Modifier::from((new CpResourcesFs())->createUrl())->removeTrailingSlash();
37+
$this->baseUrl = Modifier::wrap((new CpResourcesFs())->createUrl())->removeTrailingSlash();
3838
}
3939

4040
protected function hash($path): string

0 commit comments

Comments
 (0)