Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/App/PlatformRepository.php')
-rw-r--r--lib/private/App/PlatformRepository.php23
1 files changed, 8 insertions, 15 deletions
diff --git a/lib/private/App/PlatformRepository.php b/lib/private/App/PlatformRepository.php
index 94fac5260e1..4166c2ead03 100644
--- a/lib/private/App/PlatformRepository.php
+++ b/lib/private/App/PlatformRepository.php
@@ -31,11 +31,13 @@ namespace OC\App;
* @package OC\App
*/
class PlatformRepository {
+ private array $packages;
+
public function __construct() {
$this->packages = $this->initialize();
}
- protected function initialize() {
+ protected function initialize(): array {
$loadedExtensions = get_loaded_extensions();
$packages = [];
@@ -121,15 +123,11 @@ class PlatformRepository {
return $packages;
}
- private function buildPackageName($name) {
+ private function buildPackageName(string $name): string {
return str_replace(' ', '-', $name);
}
- /**
- * @param $name
- * @return string
- */
- public function findLibrary($name) {
+ public function findLibrary(string $name): ?string {
$extName = $this->buildPackageName($name);
if (isset($this->packages[$extName])) {
return $this->packages[$extName];
@@ -137,19 +135,17 @@ class PlatformRepository {
return null;
}
- private static $modifierRegex = '[._-]?(?:(stable|beta|b|RC|alpha|a|patch|pl|p)(?:[.-]?(\d+))?)?([.-]?dev)?';
+ private static string $modifierRegex = '[._-]?(?:(stable|beta|b|RC|alpha|a|patch|pl|p)(?:[.-]?(\d+))?)?([.-]?dev)?';
/**
* Normalizes a version string to be able to perform comparisons on it
*
* https://github.com/composer/composer/blob/master/src/Composer/Package/Version/VersionParser.php#L94
*
- * @param string $version
* @param string $fullVersion optional complete version string to give more context
* @throws \UnexpectedValueException
- * @return string
*/
- public function normalizeVersion($version, $fullVersion = null) {
+ public function normalizeVersion(string $version, ?string $fullVersion = null): string {
$version = trim($version);
if (null === $fullVersion) {
$fullVersion = $version;
@@ -204,10 +200,7 @@ class PlatformRepository {
throw new \UnexpectedValueException('Invalid version string "' . $version . '"' . $extraMessage);
}
- /**
- * @param string $stability
- */
- private function expandStability($stability) {
+ private function expandStability(string $stability): string {
$stability = strtolower($stability);
switch ($stability) {
case 'a':