code-format

pull/1/head
韩天峰 8 months ago
parent a085c33208
commit 3c89f98296
  1. 8
      src/Php/FileScanner.php
  2. 1
      src/Php/RedoException.php
  3. 7
      src/Php/Reflection.php
  4. 1
      src/Php/Unsupported.php

@ -9,8 +9,8 @@ class FileScanner
private string $directory; private string $directory;
private array $excludePatterns; private array $excludePatterns;
const array PHP_EXT = ['php']; public const array PHP_EXT = ['php'];
const array CPP_EXT = ['cpp', 'cxx', 'cc']; public const array CPP_EXT = ['cpp', 'cxx', 'cc'];
public function __construct(string $directory) public function __construct(string $directory)
{ {
@ -32,12 +32,12 @@ class FileScanner
return pathinfo($path, PATHINFO_EXTENSION); 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); 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); return in_array(self::getFileExt($file), self::CPP_EXT);
} }

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

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

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