aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-php-rpc/php/stubs/Composer/Repository/FilesystemRepository.php
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe-php-rpc/php/stubs/Composer/Repository/FilesystemRepository.php')
-rw-r--r--crates/shirabe-php-rpc/php/stubs/Composer/Repository/FilesystemRepository.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/crates/shirabe-php-rpc/php/stubs/Composer/Repository/FilesystemRepository.php b/crates/shirabe-php-rpc/php/stubs/Composer/Repository/FilesystemRepository.php
new file mode 100644
index 00000000..00e42ac6
--- /dev/null
+++ b/crates/shirabe-php-rpc/php/stubs/Composer/Repository/FilesystemRepository.php
@@ -0,0 +1,34 @@
+<?php
+
+// Generated by scripts/plugin-stub-generator; do not edit by hand.
+// Proxy stub for Composer\Repository\FilesystemRepository: the public surface forwards to the Rust-side entity over RPC.
+
+namespace Composer\Repository;
+
+use Composer\Pcre\Preg;
+
+class FilesystemRepository extends WritableArrayRepository
+{
+ public static function safelyLoadInstalledVersions(string $path): bool
+ {
+ $installedVersionsData = @file_get_contents($path);
+ $pattern = <<<'REGEX'
+{(?(DEFINE)
+ (?<number> -? \s*+ \d++ (?:\.\d++)? )
+ (?<boolean> true | false | null )
+ (?<strings> (?&string) (?: \s*+ \. \s*+ (?&string))*+ )
+ (?<string> (?: " (?:[^"\\$]*+ | \\ ["\\0] )* " | ' (?:[^'\\]*+ | \\ ['\\] )* ' ) )
+ (?<array> array\( \s*+ (?: (?:(?&number)|(?&strings)) \s*+ => \s*+ (?: (?:__DIR__ \s*+ \. \s*+)? (?&strings) | (?&value) ) \s*+, \s*+ )*+ \s*+ \) )
+ (?<value> (?: (?&number) | (?&boolean) | (?&strings) | (?&array) ) )
+)
+^<\?php\s++return\s++(?&array)\s*+;$}ix
+REGEX;
+ if (is_string($installedVersionsData) && Preg::isMatch($pattern, trim($installedVersionsData))) {
+ \Composer\InstalledVersions::reload(eval('?>'.Preg::replace('{=>\s*+__DIR__\s*+\.\s*+([\'"])}', '=> '.var_export(dirname($path), true).' . $1', $installedVersionsData)));
+
+ return true;
+ }
+
+ return false;
+ }
+}