Skip to content

Commit

Permalink
#2283 - Apply CS fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeckerson committed Oct 3, 2021
1 parent 7f20e4b commit c260d04
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 125 deletions.
2 changes: 2 additions & 0 deletions Library/CompilerFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ public function genIR(Compiler $compiler): array
* Compiles the class/interface contained in the file.
*
* @param CompilationContext $compilationContext
*
* @throws Exception
* @throws ReflectionException
*/
Expand Down Expand Up @@ -651,6 +652,7 @@ public function getCompiledFile(): string
* Check dependencies.
*
* @param Compiler $compiler
*
* @throws ReflectionException
*/
public function checkDependencies(Compiler $compiler)
Expand Down
4 changes: 2 additions & 2 deletions Library/CompilerFileAnonymous.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ final class CompilerFileAnonymous implements FileInterface
/**
* CompilerFileAnonymous constructor.
*
* @param ClassDefinition $classDefinition
* @param Config $config
* @param ClassDefinition $classDefinition
* @param Config $config
* @param CompilationContext|null $context
*/
public function __construct(ClassDefinition $classDefinition, Config $config, ?CompilationContext $context = null)
Expand Down
35 changes: 21 additions & 14 deletions Library/FileSystem/HardDisk.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public function initialize()

/**
* @param string $path
*
* @return bool
*/
public function exists(string $path): bool
Expand All @@ -106,11 +107,12 @@ public function exists(string $path): bool
$path = "{$this->localPath}/{$path}";
}

return is_file($this->basePath . DIRECTORY_SEPARATOR . $path);
return is_file($this->basePath.DIRECTORY_SEPARATOR.$path);
}

/**
* @param string $path
*
* @return bool
*/
public function makeDirectory(string $path): bool
Expand All @@ -121,54 +123,57 @@ public function makeDirectory(string $path): bool
$path = "{$this->localPath}/{$path}";
}

$dir = $this->basePath . DIRECTORY_SEPARATOR . $path;
$dir = $this->basePath.DIRECTORY_SEPARATOR.$path;

if (is_dir($dir)) {
chmod($dir, 0755);

return true;
}

mkdir($this->basePath . DIRECTORY_SEPARATOR . $path, 0755, true);
mkdir($this->basePath.DIRECTORY_SEPARATOR.$path, 0755, true);

return is_dir($path);
}

/**
* @param string $path
*
* @return array
*/
public function file(string $path): array
{
$contents = file_get_contents($this->basePath . DIRECTORY_SEPARATOR . $this->localPath."/{$path}");
$contents = file_get_contents($this->basePath.DIRECTORY_SEPARATOR.$this->localPath."/{$path}");

return preg_split("/\r\n|\n|\r/", $contents);
}

/**
* @param string $path
*
* @return int
*/
public function modificationTime(string $path): int
{
return filemtime($this->basePath . DIRECTORY_SEPARATOR . $this->localPath."/{$path}");
return filemtime($this->basePath.DIRECTORY_SEPARATOR.$this->localPath."/{$path}");
}

/**
* @param string $path
*
* @return string
*/
public function read(string $path): string
{
return file_get_contents($this->basePath . DIRECTORY_SEPARATOR . $this->localPath."/{$path}");
return file_get_contents($this->basePath.DIRECTORY_SEPARATOR.$this->localPath."/{$path}");
}

/**
* @param string $path
*/
public function delete(string $path)
{
unlink($this->basePath . DIRECTORY_SEPARATOR . $this->localPath."/{$path}");
unlink($this->basePath.DIRECTORY_SEPARATOR.$this->localPath."/{$path}");
}

/**
Expand All @@ -177,7 +182,7 @@ public function delete(string $path)
*/
public function write(string $path, string $data)
{
file_put_contents($this->basePath . DIRECTORY_SEPARATOR . $this->localPath."/{$path}", $data);
file_put_contents($this->basePath.DIRECTORY_SEPARATOR.$this->localPath."/{$path}", $data);
}

/**
Expand Down Expand Up @@ -206,6 +211,7 @@ public function system(string $command, string $descriptor, string $destination)

/**
* @param string $path
*
* @return mixed
*/
public function requireFile(string $path)
Expand All @@ -214,7 +220,7 @@ public function requireFile(string $path)
return require "{$this->basePath}/{$this->localPath}/{$path}";
}

$code = file_get_contents($this->basePath . DIRECTORY_SEPARATOR . $this->localPath."/{$path}");
$code = file_get_contents($this->basePath.DIRECTORY_SEPARATOR.$this->localPath."/{$path}");

return eval(str_replace('<?php ', '', $code));
}
Expand All @@ -224,11 +230,11 @@ public function requireFile(string $path)
*/
public function clean(): void
{
if (!is_dir($this->basePath . DIRECTORY_SEPARATOR . $this->localPath)) {
if (!is_dir($this->basePath.DIRECTORY_SEPARATOR.$this->localPath)) {
return;
}

$contents = $this->listDirectoryRecursively($this->basePath . DIRECTORY_SEPARATOR . $this->localPath, RecursiveIteratorIterator::CHILD_FIRST);
$contents = $this->listDirectoryRecursively($this->basePath.DIRECTORY_SEPARATOR.$this->localPath, RecursiveIteratorIterator::CHILD_FIRST);

/** @var SplFileInfo $file */
foreach ($contents as $file) {
Expand All @@ -237,7 +243,7 @@ public function clean(): void

unset($contents);

rmdir($this->basePath . DIRECTORY_SEPARATOR . $this->localPath);
rmdir($this->basePath.DIRECTORY_SEPARATOR.$this->localPath);
}

/**
Expand Down Expand Up @@ -283,6 +289,7 @@ public function getHashFile(string $algorithm, string $sourceFile, bool $useCach

/**
* @param string $path
*
* @return string
*/
public function normalizePath(string $path): string
Expand All @@ -294,11 +301,11 @@ protected function deleteFileInfoObject(SplFileInfo $file): bool
{
switch ($file->getType()) {
case 'dir':
return @rmdir((string)$file->getRealPath());
return @rmdir((string) $file->getRealPath());
case 'link':
return @unlink($file->getPathname());
default:
return @unlink((string)$file->getRealPath());
return @unlink((string) $file->getRealPath());
}
}

Expand Down
Loading

0 comments on commit c260d04

Please sign in to comment.