Skip to content

Commit

Permalink
chore: Update php-cs-fixer.php, SoarBench.php, composer-fixer, compos…
Browse files Browse the repository at this point in the history
…er.json, HasOptions.php, HasSoarPath.php, HasSudoPassword.php, WithRunable.php, OS.php

- Update php-cs-fixer.php
- Update SoarBench.php
- Update composer-fixer
- Update composer.json
- Update HasOptions.php
- Update HasSoarPath.php
- Update HasSudoPassword.php
- Update WithRunable.php
- Update OS.php
  • Loading branch information
guanguans committed Jan 15, 2024
1 parent 1178f5c commit 6c21d58
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 174 deletions.
222 changes: 99 additions & 123 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
* This source file is subject to the MIT license that is bundled.
*/

use PhpCsFixer\Config;
use PhpCsFixer\Finder;

$header = <<<'HEADER'
This file is part of the guanguans/soar-php.
Expand All @@ -21,7 +18,7 @@
This source file is subject to the MIT license that is bundled.
HEADER;

$finder = Finder::create()
$finder = PhpCsFixer\Finder::create()
->in([
__DIR__.'/benchmarks',
__DIR__.'/examples',
Expand Down Expand Up @@ -53,13 +50,12 @@
->ignoreDotFiles(true)
->ignoreVCS(true);

return (new Config())
return (new PhpCsFixer\Config())
->setFinder($finder)
->setRiskyAllowed(true)
->setUsingCache(true)
->setCacheFile(__DIR__.'/.php-cs-fixer.cache')
// ->registerCustomFixers(new PhpCsFixerCustomFixers\Fixers())
// ->registerCustomFixers(new PedroTroller\CS\Fixer\Fixers())
->registerCustomFixers(new PhpCsFixerCustomFixers\Fixers())
->setRules([
'@PHP70Migration' => true,
'@PHP70Migration:risky' => true,
Expand All @@ -74,15 +70,15 @@
// '@PHP82Migration' => true,

// '@PHPUnit75Migration:risky' => true,
'@PHPUnit84Migration:risky' => true,
// '@PHPUnit84Migration:risky' => true,
// '@PHPUnit100Migration:risky' => true,

// '@DoctrineAnnotation' => true,
'@PhpCsFixer' => true,
'@PhpCsFixer:risky' => true,

// alias
// 'mb_str_functions' => true,
'mb_str_functions' => false,

// array_notation

Expand All @@ -106,27 +102,27 @@
'final_internal_class' => false,
'final_public_method_for_abstract_class' => true,
'ordered_class_elements' => [
'order' => [
'use_trait',
// 'case',

'constant_public',
'constant_protected',
'constant_private',

'property_public',
'property_protected',
'property_private',

'construct',
'destruct',
'magic',
'phpunit',

'method_public',
'method_protected',
'method_private',
],
// 'order' => [
// 'use_trait',
// 'case',
//
// 'constant_public',
// 'constant_protected',
// 'constant_private',
//
// 'property_public',
// 'property_protected',
// 'property_private',
//
// 'construct',
// 'destruct',
// 'magic',
// 'phpunit',
//
// 'method_public',
// 'method_protected',
// 'method_private',
// ],
'sort_algorithm' => 'none',
],
'ordered_interfaces' => [
Expand Down Expand Up @@ -267,7 +263,7 @@
'include',
'include_once',
// 'phpdoc',
'require',
// 'require',
'require_once',
'return',
'switch',
Expand All @@ -279,98 +275,78 @@
],
// 'statement_indentation' => true,

// // https://github.com/kubawerlos/php-cs-fixer-custom-fixers
// PhpCsFixerCustomFixers\Fixer\CommentSurroundedBySpacesFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\CommentedOutFunctionFixer::name() => [
// 'functions' => ['print_r', 'var_dump', 'var_export', 'dump', 'dd'],
// ],
// // PhpCsFixerCustomFixers\Fixer\ConstructorEmptyBracesFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\DataProviderNameFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\DataProviderReturnTypeFixer::name() => true,
// // PhpCsFixerCustomFixers\Fixer\DeclareAfterOpeningTagFixer::name() => true,
// // PhpCsFixerCustomFixers\Fixer\EmptyFunctionBodyFixer::name() => true,
// // PhpCsFixerCustomFixers\Fixer\IssetToArrayKeyExistsFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\MultilineCommentOpeningClosingAloneFixer::name() => true,
// // PhpCsFixerCustomFixers\Fixer\MultilinePromotedPropertiesFixer::name() => [
// // 'minimum_number_of_parameters' => 5,
// // 'keep_blank_lines' => false,
// // ],
// // PhpCsFixerCustomFixers\Fixer\NoCommentedOutCodeFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\NoDoctrineMigrationsGeneratedCommentFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\NoDuplicatedArrayKeyFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\NoDuplicatedImportsFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\NoImportFromGlobalNamespaceFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\NoLeadingSlashInGlobalNamespaceFixer::name() => true,
// // PhpCsFixerCustomFixers\Fixer\NoNullableBooleanTypeFixer::name() => false,
// PhpCsFixerCustomFixers\Fixer\NoPhpStormGeneratedCommentFixer::name() => true,
// // PhpCsFixerCustomFixers\Fixer\NoReferenceInFunctionDefinitionFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\NoSuperfluousConcatenationFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\NoTrailingCommaInSinglelineFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\NoUselessCommentFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\NoUselessDirnameCallFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\NoUselessDoctrineRepositoryCommentFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\NoUselessParenthesisFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\NoUselessStrlenFixer::name() => true,
// // PhpCsFixerCustomFixers\Fixer\NumericLiteralSeparatorFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\PhpUnitAssertArgumentsOrderFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\PhpUnitDedicatedAssertFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\PhpUnitNoUselessReturnFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\PhpdocArrayStyleFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\PhpdocNoIncorrectVarAnnotationFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\PhpdocNoSuperfluousParamFixer::name() => true,
// // PhpCsFixerCustomFixers\Fixer\PhpdocOnlyAllowedAnnotationsFixer::name() => [
// // 'elements' => [
// // 'covers',
// // 'coversNothing',
// // 'dataProvider',
// // 'deprecated',
// // 'implements',
// // 'internal',
// // 'method',
// // 'noinspection',
// // 'param',
// // 'property',
// // 'requires',
// // 'return',
// // 'runInSeparateProcess',
// // 'see',
// // 'var',
// // ],
// // ],
// PhpCsFixerCustomFixers\Fixer\PhpdocParamOrderFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\PhpdocParamTypeFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\PhpdocSelfAccessorFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\PhpdocSingleLineVarFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\PhpdocTypesCommaSpacesFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\PhpdocTypesTrimFixer::name() => true,
// // PhpCsFixerCustomFixers\Fixer\PhpdocVarAnnotationToAssertFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\PromotedConstructorPropertyFixer::name() => [
// 'promote_only_existing_properties' => false,
// ],
// // PhpCsFixerCustomFixers\Fixer\ReadonlyPromotedPropertiesFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\SingleSpaceAfterStatementFixer::name() => [
// 'allow_linebreak' => false,
// ],
// PhpCsFixerCustomFixers\Fixer\SingleSpaceBeforeStatementFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\StringableInterfaceFixer::name() => true,
//
// // https://github.com/PedroTroller/PhpCSFixer-Custom-Fixers
// // 'PedroTroller/order_behat_steps' => ['instanceof' => ['Behat\Behat\Context\Context']],
// 'PedroTroller/ordered_with_getter_and_setter_first' => true,
// 'PedroTroller/exceptions_punctuation' => true,
// 'PedroTroller/forbidden_functions' => [
// 'comment' => '@TODO remove this line',
// 'functions' => ['var_dump', 'dump', 'die'],
// https://github.com/kubawerlos/php-cs-fixer-custom-fixers
PhpCsFixerCustomFixers\Fixer\CommentSurroundedBySpacesFixer::name() => true,
PhpCsFixerCustomFixers\Fixer\CommentedOutFunctionFixer::name() => [
'functions' => ['print_r', 'var_dump', 'var_export'],
],
// PhpCsFixerCustomFixers\Fixer\ConstructorEmptyBracesFixer::name() => true,
PhpCsFixerCustomFixers\Fixer\DataProviderNameFixer::name() => true,
PhpCsFixerCustomFixers\Fixer\DataProviderReturnTypeFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\DeclareAfterOpeningTagFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\EmptyFunctionBodyFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\IssetToArrayKeyExistsFixer::name() => true,
PhpCsFixerCustomFixers\Fixer\MultilineCommentOpeningClosingAloneFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\MultilinePromotedPropertiesFixer::name() => [
// 'minimum_number_of_parameters' => 5,
// 'keep_blank_lines' => false,
// ],
// 'PedroTroller/line_break_between_method_arguments' => [
// 'max-args' => 5,
// 'max-length' => 120,
// // 'automatic-argument-merge' => true,
// // 'inline-attributes' => false,
// PhpCsFixerCustomFixers\Fixer\NoCommentedOutCodeFixer::name() => true,
PhpCsFixerCustomFixers\Fixer\NoDoctrineMigrationsGeneratedCommentFixer::name() => true,
PhpCsFixerCustomFixers\Fixer\NoDuplicatedArrayKeyFixer::name() => true,
PhpCsFixerCustomFixers\Fixer\NoDuplicatedImportsFixer::name() => true,
PhpCsFixerCustomFixers\Fixer\NoImportFromGlobalNamespaceFixer::name() => true,
PhpCsFixerCustomFixers\Fixer\NoLeadingSlashInGlobalNamespaceFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\NoNullableBooleanTypeFixer::name() => false,
PhpCsFixerCustomFixers\Fixer\NoPhpStormGeneratedCommentFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\NoReferenceInFunctionDefinitionFixer::name() => true,
PhpCsFixerCustomFixers\Fixer\NoSuperfluousConcatenationFixer::name() => true,
PhpCsFixerCustomFixers\Fixer\NoTrailingCommaInSinglelineFixer::name() => true,
PhpCsFixerCustomFixers\Fixer\NoUselessCommentFixer::name() => true,
PhpCsFixerCustomFixers\Fixer\NoUselessDirnameCallFixer::name() => true,
PhpCsFixerCustomFixers\Fixer\NoUselessDoctrineRepositoryCommentFixer::name() => true,
PhpCsFixerCustomFixers\Fixer\NoUselessParenthesisFixer::name() => true,
PhpCsFixerCustomFixers\Fixer\NoUselessStrlenFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\NumericLiteralSeparatorFixer::name() => true,
PhpCsFixerCustomFixers\Fixer\PhpUnitAssertArgumentsOrderFixer::name() => true,
PhpCsFixerCustomFixers\Fixer\PhpUnitDedicatedAssertFixer::name() => true,
PhpCsFixerCustomFixers\Fixer\PhpUnitNoUselessReturnFixer::name() => true,
PhpCsFixerCustomFixers\Fixer\PhpdocArrayStyleFixer::name() => true,
PhpCsFixerCustomFixers\Fixer\PhpdocNoIncorrectVarAnnotationFixer::name() => true,
PhpCsFixerCustomFixers\Fixer\PhpdocNoSuperfluousParamFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\PhpdocOnlyAllowedAnnotationsFixer::name() => [
// 'elements' => [
// 'covers',
// 'coversNothing',
// 'dataProvider',
// 'deprecated',
// 'implements',
// 'internal',
// 'method',
// 'noinspection',
// 'param',
// 'property',
// 'requires',
// 'return',
// 'runInSeparateProcess',
// 'see',
// 'var',
// ],
// ],
// 'PedroTroller/line_break_between_statements' => true,
// 'PedroTroller/comment_line_to_phpdoc_block' => true,
// 'PedroTroller/useless_code_after_return' => true,
// // 'PedroTroller/doctrine_migrations' => ['instanceof' => ['Doctrine\Migrations\AbstractMigration']],
// // 'PedroTroller/phpspec' => ['instanceof' => ['PhpSpec\ObjectBehavior']],
PhpCsFixerCustomFixers\Fixer\PhpdocParamOrderFixer::name() => true,
PhpCsFixerCustomFixers\Fixer\PhpdocParamTypeFixer::name() => true,
PhpCsFixerCustomFixers\Fixer\PhpdocSelfAccessorFixer::name() => true,
PhpCsFixerCustomFixers\Fixer\PhpdocSingleLineVarFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\PhpdocTypesCommaSpacesFixer::name() => true,
PhpCsFixerCustomFixers\Fixer\PhpdocTypesTrimFixer::name() => true,
// PhpCsFixerCustomFixers\Fixer\PhpdocVarAnnotationToAssertFixer::name() => true,
PhpCsFixerCustomFixers\Fixer\PromotedConstructorPropertyFixer::name() => [
'promote_only_existing_properties' => false,
],
// PhpCsFixerCustomFixers\Fixer\ReadonlyPromotedPropertiesFixer::name() => true,
PhpCsFixerCustomFixers\Fixer\SingleSpaceAfterStatementFixer::name() => [
'allow_linebreak' => false,
],
PhpCsFixerCustomFixers\Fixer\SingleSpaceBeforeStatementFixer::name() => true,
PhpCsFixerCustomFixers\Fixer\StringableInterfaceFixer::name() => true,
]);
4 changes: 1 addition & 3 deletions benchmarks/SoarBench.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
*/
final class SoarBench
{
/**
* @var null|\Guanguans\SoarPHP\Soar
*/
/** @var null|\Guanguans\SoarPHP\Soar */
private $soar;

public function setUp(): void
Expand Down
8 changes: 2 additions & 6 deletions composer-fixer
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,10 @@ use Symfony\Component\Process\Process;
require __DIR__.'/vendor/autoload.php';

(new class() {
/**
* @var string
*/
/** @var string */
private $composerJsonFile = __DIR__.'/composer.json';

/**
* @var SymfonyStyle
*/
/** @var SymfonyStyle */
private $symfonyStyle;

public function __construct()
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"guanguans/monorepo-builder-worker": "^1.4",
"jetbrains/phpstorm-attributes": "^1.0",
"johnkary/phpunit-speedtrap": "^4.0",
"kubawerlos/php-cs-fixer-custom-fixers": "^3.7",
"mockery/mockery": "^1.6",
"php-mock/php-mock-phpunit": "^2.9",
"phpbench/phpbench": "^1.2",
Expand Down
4 changes: 1 addition & 3 deletions src/Concerns/HasOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1389,9 +1389,7 @@
*/
trait HasOptions
{
/**
* @var array
*/
/** @var array */
protected $options = [];

/**
Expand Down
4 changes: 1 addition & 3 deletions src/Concerns/HasSoarPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
*/
trait HasSoarPath
{
/**
* @var string
*/
/** @var string */
protected $soarPath;

public function getSoarPath(): string
Expand Down
4 changes: 1 addition & 3 deletions src/Concerns/HasSudoPassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
*/
trait HasSudoPassword
{
/**
* @var null|string
*/
/** @var null|string */
protected $sudoPassword;

public function getSudoPassword(): ?string
Expand Down
4 changes: 1 addition & 3 deletions src/Concerns/WithRunable.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
*/
trait WithRunable
{
/**
* @var null|callable
*/
/** @var null|callable */
protected $processTapper;

public function setProcessTapper(?callable $processTapper): self
Expand Down
Loading

0 comments on commit 6c21d58

Please sign in to comment.