style(coding-standard): 移除严格类型声明并调整代码格式

- 将 .php-cs-fixer.dist.php 中的 declare_strict_types 设置为 false
- 从所有 PHP 类文件中移除 declare(strict_types=1) 声明
- 在 CompilerBase.php 中添加缺失的空行以改善代码可读性
- 恢复 Translator.php 中关于 noLiteralStrings 的原始配置逻辑
pull/1/head
韩天峰 7 months ago
parent 0e4a332519
commit 2c90437a99
  1. 2
      .php-cs-fixer.dist.php
  2. 2
      src/Php/ArgInfo.php
  3. 2
      src/Php/AstNodeType.php
  4. 2
      src/Php/ClassDef.php
  5. 2
      src/Php/ClassLikeDef.php
  6. 5
      src/Php/CompilerBase.php
  7. 2
      src/Php/ConstantDef.php
  8. 2
      src/Php/Constants.php
  9. 2
      src/Php/Encryptor.php
  10. 2
      src/Php/Extractor.php
  11. 2
      src/Php/FileScanner.php
  12. 2
      src/Php/FileSorter.php
  13. 2
      src/Php/FuncCallOptimizer.php
  14. 2
      src/Php/FunctionDef.php
  15. 2
      src/Php/InterfaceDef.php
  16. 2
      src/Php/MagicMethodDetector.php
  17. 2
      src/Php/MethodDef.php
  18. 2
      src/Php/Preprocessor.php
  19. 2
      src/Php/PropertyDef.php
  20. 2
      src/Php/RedoException.php
  21. 2
      src/Php/Reflection.php
  22. 2
      src/Php/SyntaxError.php
  23. 5
      src/Php/Translator.php
  24. 2
      src/Php/Unsupported.php
  25. 2
      src/Php/Visitor.php

@ -23,7 +23,7 @@ return (new PhpCsFixer\Config())
'concat_space' => ['spacing' => 'one'],
'constant_case' => ['case' => 'lower'],
'combine_consecutive_unsets' => true,
'declare_strict_types' => true,
'declare_strict_types' => false,
'fully_qualified_strict_types' => ['phpdoc_tags' => []],
'general_phpdoc_annotation_remove' => ['annotations' => ['author']],
'header_comment' => ['comment_type' => 'PHPDoc', 'header' => $header, 'location' => 'after_open', 'separate' => 'bottom'],

@ -6,8 +6,6 @@
* @contact service@swoole.com
*/
declare(strict_types=1);
namespace PhpAot\Php;
class ArgInfo

@ -6,8 +6,6 @@
* @contact service@swoole.com
*/
declare(strict_types=1);
namespace PhpAot\Php;
use PhpParser\Node;

@ -6,8 +6,6 @@
* @contact service@swoole.com
*/
declare(strict_types=1);
namespace PhpAot\Php;
class ClassDef extends ClassLikeDef

@ -6,8 +6,6 @@
* @contact service@swoole.com
*/
declare(strict_types=1);
namespace PhpAot\Php;
class ClassLikeDef

@ -6,8 +6,6 @@
* @contact service@swoole.com
*/
declare(strict_types=1);
namespace PhpAot\Php;
use League\CLImate\CLImate;
@ -54,6 +52,7 @@ class CompilerBase extends \PhpAot\Core\Translator
public const string LITERAL_STRINGS = '_literal_strings';
public const string CLASS_ENTRY_MAP = 'class_entry_map';
public const string FUNC_MAP = 'func_map';
public const string EXPR_VARIABLE = 'Expr_Variable';
@ -86,7 +85,9 @@ class CompilerBase extends \PhpAot\Core\Translator
* @var array<string, int>
*/
protected array $classMap = [];
protected int $funcIndex = 0;
protected array $funcMap = [];
protected array $zendTypeMap = [

@ -6,8 +6,6 @@
* @contact service@swoole.com
*/
declare(strict_types=1);
namespace PhpAot\Php;
class ConstantDef

@ -6,8 +6,6 @@
* @contact service@swoole.com
*/
declare(strict_types=1);
namespace PhpAot\Php;
class Constants

@ -6,8 +6,6 @@
* @contact service@swoole.com
*/
declare(strict_types=1);
namespace PhpAot\Php;
use PhpParser\PrettyPrinter\Standard;

@ -6,8 +6,6 @@
* @contact service@swoole.com
*/
declare(strict_types=1);
namespace PhpAot\Php;
class Extractor

@ -6,8 +6,6 @@
* @contact service@swoole.com
*/
declare(strict_types=1);
namespace PhpAot\Php;
class FileScanner

@ -6,8 +6,6 @@
* @contact service@swoole.com
*/
declare(strict_types=1);
namespace PhpAot\Php;
class FileSorter

@ -6,8 +6,6 @@
* @contact service@swoole.com
*/
declare(strict_types=1);
namespace PhpAot\Php;
use PhpParser\Node;

@ -6,8 +6,6 @@
* @contact service@swoole.com
*/
declare(strict_types=1);
namespace PhpAot\Php;
class FunctionDef

@ -6,8 +6,6 @@
* @contact service@swoole.com
*/
declare(strict_types=1);
namespace PhpAot\Php;
class InterfaceDef extends ClassLikeDef

@ -6,8 +6,6 @@
* @contact service@swoole.com
*/
declare(strict_types=1);
namespace PhpAot\Php;
use PhpParser\NodeAbstract;

@ -6,8 +6,6 @@
* @contact service@swoole.com
*/
declare(strict_types=1);
namespace PhpAot\Php;
class MethodDef

@ -6,8 +6,6 @@
* @contact service@swoole.com
*/
declare(strict_types=1);
namespace PhpAot\Php;
use PhpParser\Node;

@ -6,8 +6,6 @@
* @contact service@swoole.com
*/
declare(strict_types=1);
namespace PhpAot\Php;
use PhpParser\Modifiers;

@ -6,8 +6,6 @@
* @contact service@swoole.com
*/
declare(strict_types=1);
namespace PhpAot\Php;
class RedoException extends \RuntimeException

@ -6,8 +6,6 @@
* @contact service@swoole.com
*/
declare(strict_types=1);
namespace PhpAot\Php;
class Reflection

@ -6,8 +6,6 @@
* @contact service@swoole.com
*/
declare(strict_types=1);
namespace PhpAot\Php;
class SyntaxError extends \RuntimeException

@ -6,8 +6,6 @@
* @contact service@swoole.com
*/
declare(strict_types=1);
namespace PhpAot\Php;
use MJS\TopSort\Implementations\StringSort;
@ -47,8 +45,7 @@ class Translator extends Preprocessor
$this->optimizeLevel = $this->climate->arguments->get('optimize');
$this->buildMode = $this->climate->arguments->get('mode');
$this->debugLine = intval($this->climate->arguments->get('debug-line'));
// $this->noLiteralStrings = $this->climate->arguments->get('noLiteralStrings');
$this->noLiteralStrings = true;
$this->noLiteralStrings = $this->climate->arguments->get('noLiteralStrings');
$this->enableProfiler = $this->climate->arguments->defined('profile');
$this->internalFunctions = array_flip(get_defined_functions()['internal']);
if ($this->climate->arguments->defined('help')) {

@ -6,8 +6,6 @@
* @contact service@swoole.com
*/
declare(strict_types=1);
namespace PhpAot\Php;
class Unsupported extends \RuntimeException

@ -6,8 +6,6 @@
* @contact service@swoole.com
*/
declare(strict_types=1);
namespace PhpAot\Php;
use PhpParser\NodeVisitorAbstract;

Loading…
Cancel
Save