code-format

pull/1/head
韩天峰 8 months ago
parent a085c33208
commit 3c89f98296
  1. 2
      src/Php/ArgInfo.php
  2. 2
      src/Php/Extractor.php
  3. 14
      src/Php/FileScanner.php
  4. 2
      src/Php/FileSorter.php
  5. 2
      src/Php/FunctionDef.php
  6. 3
      src/Php/RedoException.php
  7. 9
      src/Php/Reflection.php
  8. 3
      src/Php/Unsupported.php

@ -7,4 +7,4 @@ class ArgInfo
public string $name;
public string $type;
public string $default = '';
}
}

@ -611,4 +611,4 @@ class Extractor
return $md;
}
}
}

@ -9,15 +9,15 @@ class FileScanner
private string $directory;
private array $excludePatterns;
const array PHP_EXT = ['php'];
const array CPP_EXT = ['cpp', 'cxx', 'cc'];
public const array PHP_EXT = ['php'];
public const array CPP_EXT = ['cpp', 'cxx', 'cc'];
public function __construct(string $directory)
{
if (!is_dir($directory)) {
throw new \InvalidArgumentException("Directory does not exist: $directory");
}
$this->directory = rtrim($directory, DIRECTORY_SEPARATOR);
$this->excludePatterns = [];
}
@ -32,12 +32,12 @@ class FileScanner
return pathinfo($path, PATHINFO_EXTENSION);
}
static function isPhpFile(string $file): bool
public static function isPhpFile(string $file): bool
{
return in_array(self::getFileExt($file), self::PHP_EXT);
}
static function isCppFile(string $file): bool
public static function isCppFile(string $file): bool
{
return in_array(self::getFileExt($file), self::CPP_EXT);
}
@ -77,7 +77,7 @@ class FileScanner
$iterator = new \RecursiveIteratorIterator(
new \RecursiveDirectoryIterator($this->directory, FilesystemIterator::SKIP_DOTS)
);
foreach ($iterator as $file) {
if ($file->isFile()) {
if (self::isPhpFile($file)) {
@ -99,4 +99,4 @@ class FileScanner
{
return fnmatch($pattern, $path, FNM_PATHNAME);
}
}
}

@ -91,4 +91,4 @@ class FileSorter
return array_unique($files);
}
}
}

@ -9,4 +9,4 @@ class FunctionDef
public string $params;
public string $returnType;
public int $argCountRequired = 0;
}
}

@ -4,5 +4,4 @@ namespace PhpAot\Php;
class RedoException extends \RuntimeException
{
}
}

@ -10,11 +10,12 @@ class Reflection
{
private static array $functions = [];
static function getFunction(string $fn)
public static function getFunction(string $fn)
{
if (!isset(self::$functions[$fn])) {
try {
$ref = new ReflectionFunction($fn);;
$ref = new ReflectionFunction($fn);
;
} catch (\ReflectionException $e) {
return null;
}
@ -23,7 +24,7 @@ class Reflection
return self::$functions[$fn];
}
static function getFunctionReturnType(string $fn): ?string
public static function getFunctionReturnType(string $fn): ?string
{
$func = self::getFunction($fn);
if (!$func) {
@ -51,4 +52,4 @@ class Reflection
}
return $args[$index];
}
}
}

@ -4,5 +4,4 @@ namespace PhpAot\Php;
class Unsupported extends \RuntimeException
{
}
}

Loading…
Cancel
Save