Skip to content

Commit 473d727

Browse files
committed
fix: restore static used outside
1 parent 33539d9 commit 473d727

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/ClassMapGenerator.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public function scanPaths($path, ?string $excluded = null, string $autoloadType
147147
}
148148
}
149149

150-
$cwd = realpath($this->getCwd());
150+
$cwd = realpath(self::getCwd());
151151

152152
foreach ($path as $file) {
153153
$filePath = $file->getPathname();
@@ -156,9 +156,9 @@ public function scanPaths($path, ?string $excluded = null, string $autoloadType
156156
}
157157

158158
$isStreamWrapperPath = Preg::isMatch($this->streamWrappersRegex, $filePath);
159-
if (!$this->isAbsolutePath($filePath) && !$isStreamWrapperPath) {
159+
if (!self::isAbsolutePath($filePath) && !$isStreamWrapperPath) {
160160
$filePath = $cwd . '/' . $filePath;
161-
$filePath = $this->normalizePath($filePath);
161+
$filePath = self::normalizePath($filePath);
162162
} else {
163163
$filePath = Preg::replace('{(?<!:)[\\\\/]{2,}}', '/', $filePath);
164164
}
@@ -264,14 +264,14 @@ private function filterByNamespace(array $classes, string $filePath, string $bas
264264

265265
// warn only if no valid classes, else silently skip invalid
266266
if ($validClasses === []) {
267-
$cwd = realpath($this->getCwd());
267+
$cwd = realpath(self::getCwd());
268268
if ($cwd === false) {
269-
$cwd = $this->getCwd();
269+
$cwd = self::getCwd();
270270
}
271271

272-
$cwd = $this->normalizePath($cwd);
273-
$shortPath = Preg::replace('{^'.preg_quote($cwd).'}', '.', $this->normalizePath($filePath), 1);
274-
$shortBasePath = Preg::replace('{^'.preg_quote($cwd).'}', '.', $this->normalizePath($basePath), 1);
272+
$cwd = self::normalizePath($cwd);
273+
$shortPath = Preg::replace('{^'.preg_quote($cwd).'}', '.', self::normalizePath($filePath), 1);
274+
$shortBasePath = Preg::replace('{^'.preg_quote($cwd).'}', '.', self::normalizePath($basePath), 1);
275275

276276
foreach ($rejectedClasses as $class) {
277277
$this->classMap->addPsrViolation(sprintf('Class %s located in %s does not comply with %s autoloading standard (rule: %s => %s). Skipping.', $class, $shortPath, $namespaceType, $baseNamespace, $shortBasePath), $class, $filePath);
@@ -288,7 +288,7 @@ private function filterByNamespace(array $classes, string $filePath, string $bas
288288
*
289289
* @see Composer\Util\Filesystem::isAbsolutePath
290290
*/
291-
private function isAbsolutePath(string $path): bool
291+
private static function isAbsolutePath(string $path): bool
292292
{
293293
return strpos($path, '/') === 0 || substr($path, 1, 1) === ':' || strpos($path, '\\\\') === 0;
294294
}
@@ -301,7 +301,7 @@ private function isAbsolutePath(string $path): bool
301301
*
302302
* @param string $path Path to the file or directory
303303
*/
304-
private function normalizePath(string $path): string
304+
private static function normalizePath(string $path): string
305305
{
306306
$parts = [];
307307
$path = strtr($path, '\\', '/');
@@ -345,7 +345,7 @@ private function normalizePath(string $path): string
345345
/**
346346
* @see Composer\Util\Platform::getCwd
347347
*/
348-
private function getCwd(): string
348+
private static function getCwd(): string
349349
{
350350
$cwd = getcwd();
351351

0 commit comments

Comments
 (0)