From 910ce34bd224172ea5e767fbedff41aa4c5a6b3a Mon Sep 17 00:00:00 2001 From: zds <49744633+zds-s@users.noreply.github.com> Date: Mon, 17 Jun 2024 17:15:33 +0800 Subject: [PATCH 1/2] Added composer.json normalize support --- .github/workflows/pull-request-cs-fixer.yml | 34 ----- .github/workflows/test.yml | 25 ++++ composer.json | 140 ++++++++++---------- src/AppStore/composer.json | 22 +-- src/Crontab/composer.json | 2 +- src/HttpServer/composer.json | 8 +- src/Module/composer.json | 13 +- src/SecurityAccess/composer.json | 8 +- src/SecurityBundle/composer.json | 4 +- src/SecurityHttp/composer.json | 6 +- src/Support/composer.json | 4 +- src/jwt-auth/composer.json | 32 ++--- src/mine-core/composer.json | 43 +++--- src/mine-generator/composer.json | 20 +-- src/mine-helpers/composer.json | 8 +- src/mine-service/composer.json | 16 +-- src/next-core-x/composer.json | 24 ++-- src/office/composer.json | 12 +- src/translatable/composer.json | 41 +++--- 19 files changed, 233 insertions(+), 229 deletions(-) delete mode 100644 .github/workflows/pull-request-cs-fixer.yml diff --git a/.github/workflows/pull-request-cs-fixer.yml b/.github/workflows/pull-request-cs-fixer.yml deleted file mode 100644 index 89d8a1ba..00000000 --- a/.github/workflows/pull-request-cs-fixer.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Pull Request CS Fixer -on: - pull_request: - -jobs: - cs-fix: - runs-on: ubuntu-latest - permissions: - contents: write - strategy: - matrix: - os: [ ubuntu-latest ] - php: [ '8.1' ] - swoole: [ 'swoole' ] - steps: - - uses: actions/checkout@v4 - with: - repository: ${{ github.event.pull_request.head.repo.full_name }} - ref: ${{ github.event.pull_request.head.ref }} - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - extensions: redis,pdo,pdo_mysql,bcmatch,${{ matrix.swoole }} - - name: Setup Packages - run: composer update -oW - - name: Run CS Fix - run: | - vendor/bin/php-cs-fixer fix src - - uses: EndBug/add-and-commit@v9 - with: - add: '-A' - author_name: StyleCI - message: 'Apply CS Fixer' - push: true \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1b0a96e7..e2edafc0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,6 +10,31 @@ on: schedule: - cron: '0 2 * * *' jobs: + cs-fix: + name: PHP CS Fix on PHP${{ matrix.php }} ${{ matrix.swoole }} + runs-on: ubuntu-latest + strategy: + matrix: + os: [ ubuntu-latest ] + php: [ '8.1' ] + swoole: [ 'swoole' ] + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.1' + tools: php-cs-fixer + extensions: redis, pdo, pdo_mysql, bcmath, ${{ matrix.swoole }} + - name: Setup Packages + run: composer update -oW + - name: Check Composer Json + run: | + composer normalize --dry-run --no-update-lock + find ./src -name composer.json -exec composer normalize --dry-run --no-update-lock {} \; + - name: Run CS Fix + run: vendor/bin/php-cs-fixer fix src --dry-run --diff tests: name: Test on PHP${{ matrix.php-version }} Swoole-${{ matrix.sw-version }} runs-on: "${{ matrix.os }}" diff --git a/composer.json b/composer.json index ff63e80d..6c6dac1e 100644 --- a/composer.json +++ b/composer.json @@ -1,54 +1,13 @@ { "name": "xmo/mine", - "license": "Apache-2.0", "description": "mineAdmin核心组件", - "homepage": "http://www.mineadmin.com", + "license": "Apache-2.0", "keywords": [ "MineAdmin", "hyperf", "hyperf-admin", "Admin" ], - "autoload": { - "psr-4": { - "Mine\\": "src/mine-core/src", - "Xmo\\JWTAuth\\": "src/jwt-auth/src", - "Mine\\Office\\": "src/office/src", - "Mine\\Translatable\\": "src/translatable/src", - "Mine\\Helper\\": "src/mine-helpers/src", - "Mine\\Generator\\": "src/mine-generator/src", - "Mine\\AppStore\\": "src/AppStore/src", - "Mine\\AppStoreSdk\\": "src/AppStore/src", - "Mine\\NextCoreX\\": "src/next-core-x/src", - "Mine\\HttpServer\\": "src/HttpServer/src", - "Mine\\Crontab\\": "src/Crontab/src", - "Mine\\Support\\": "src/Support/src", - "Mine\\Module\\": "src/Module/src", - "Mine\\SecurityBundle\\": "src/SecurityBundle/src", - "Mine\\Security\\Http\\": "src/SecurityHttp/src", - "Mine\\Security\\Access\\": "src/SecurityAccess/src" - }, - "files": [ - "src/mine-helpers/src/functions.php", - "src/Support/src/functions.php" - ] - }, - "autoload-dev": { - "psr-4": { - "Mine\\Tests\\": "tests", - "Mine\\AppStore\\Tests\\": "src/AppStore/tests", - "Mine\\AppStoreSdk\\Tests\\": "src/AppStoreSdk/tests", - "Xmo\\MineCore\\Tests\\": "src/mine-core/tests", - "Mine\\NextCoreX\\Tests\\": "src/next-core-x/tests", - "Mine\\HttpServer\\Tests\\": "src/HttpServer/tests", - "Mine\\Crontab\\Tests\\": "src/Crontab/tests", - "Mine\\Support\\Tests\\": "src/Support/tests", - "Mine\\Module\\Tests\\": "src/Module/tests", - "Mine\\SecurityBundle\\Tests\\": "src/SecurityBundle/tests", - "Mine\\Security\\Http\\Tests\\": "src/SecurityHttp/tests", - "Mine\\Security\\Access\\Tests\\": "src/SecurityAccess/tests" - } - }, "authors": [ { "name": "xmo", @@ -61,21 +20,7 @@ "role": "Developer" } ], - "replace": { - "xmo/mine": "*", - "xmo/mine-gateway": "*", - "xmo/jwt-auth": "*", - "xmo/mine-office": "*", - "xmo/mine-translatable": "*", - "xmo/mine-helpers": "*", - "xmo/mine-genertor": "*", - "mineadmin/app-store": "*", - "mine/next-core-x": "*", - "mineadmin/http-server": "*", - "mineadmin/security-bundle": "*", - "mineadmin/security-http": "*", - "mineadmin/module": "*" - }, + "homepage": "http://www.mineadmin.com", "require": { "php": ">=8.1", "ext-gd": "*", @@ -86,10 +31,10 @@ "ext-redis": "*", "ext-swoole": ">=5.0", "ext-zip": "*", - "casbin/casbin": "^v3.21", + "casbin/casbin": "^3.21", "doctrine/dbal": "^3.1", "friendsofhyperf/encryption": "^3.1", - "friendsofhyperf/facade": "^v3.1", + "friendsofhyperf/facade": "^3.1", "hyperf/amqp": "~3.1.0", "hyperf/async-queue": "~3.1.0", "hyperf/cache": "~3.1.0", @@ -134,28 +79,89 @@ "symfony/var-exporter": "*", "tangwei/apidocs": "^3.0", "yurunsoft/phpmailer-swoole": "^1.0", - "zoujingli/ip2region": "2.0.*" + "zoujingli/ip2region": "~2.0.0" }, "require-dev": { + "ergebnis/composer-normalize": "dev-main", "friendsofphp/php-cs-fixer": "^3.0", - "hyperf/testing": "3.1.*", + "hyperf/testing": "~3.1.0", "mockery/mockery": "^1.0", "pestphp/pest": "2.x-dev", "phpstan/phpstan": "^1.0", "swoole/ide-helper": "dev-master" }, + "replace": { + "mine/next-core-x": "*", + "mineadmin/app-store": "*", + "mineadmin/http-server": "*", + "mineadmin/module": "*", + "mineadmin/security-bundle": "*", + "mineadmin/security-http": "*", + "xmo/jwt-auth": "*", + "xmo/mine": "*", + "xmo/mine-gateway": "*", + "xmo/mine-genertor": "*", + "xmo/mine-helpers": "*", + "xmo/mine-office": "*", + "xmo/mine-translatable": "*" + }, "minimum-stability": "dev", + "autoload": { + "psr-4": { + "Mine\\": "src/mine-core/src", + "Mine\\AppStoreSdk\\": "src/AppStore/src", + "Mine\\AppStore\\": "src/AppStore/src", + "Mine\\Crontab\\": "src/Crontab/src", + "Mine\\Generator\\": "src/mine-generator/src", + "Mine\\Helper\\": "src/mine-helpers/src", + "Mine\\HttpServer\\": "src/HttpServer/src", + "Mine\\Module\\": "src/Module/src", + "Mine\\NextCoreX\\": "src/next-core-x/src", + "Mine\\Office\\": "src/office/src", + "Mine\\SecurityBundle\\": "src/SecurityBundle/src", + "Mine\\Security\\Access\\": "src/SecurityAccess/src", + "Mine\\Security\\Http\\": "src/SecurityHttp/src", + "Mine\\Support\\": "src/Support/src", + "Mine\\Translatable\\": "src/translatable/src", + "Xmo\\JWTAuth\\": "src/jwt-auth/src" + }, + "files": [ + "src/mine-helpers/src/functions.php", + "src/Support/src/functions.php" + ] + }, + "autoload-dev": { + "psr-4": { + "Mine\\AppStoreSdk\\Tests\\": "src/AppStoreSdk/tests", + "Mine\\AppStore\\Tests\\": "src/AppStore/tests", + "Mine\\Crontab\\Tests\\": "src/Crontab/tests", + "Mine\\HttpServer\\Tests\\": "src/HttpServer/tests", + "Mine\\Module\\Tests\\": "src/Module/tests", + "Mine\\NextCoreX\\Tests\\": "src/next-core-x/tests", + "Mine\\SecurityBundle\\Tests\\": "src/SecurityBundle/tests", + "Mine\\Security\\Access\\Tests\\": "src/SecurityAccess/tests", + "Mine\\Security\\Http\\Tests\\": "src/SecurityHttp/tests", + "Mine\\Support\\Tests\\": "src/Support/tests", + "Mine\\Tests\\": "tests", + "Xmo\\MineCore\\Tests\\": "src/mine-core/tests" + } + }, "config": { - "optimize-autoloader": true, - "sort-packages": true, "allow-plugins": { + "ergebnis/composer-normalize": true, "pestphp/pest-plugin": true - } + }, + "optimize-autoloader": true, + "sort-packages": true }, "scripts": { - "cs-fix": "php-cs-fixer fix $1", - "test": "pest", + "analyse": "phpstan analyse --memory-limit 1000M -l 0 -c phpstan.neon ./src", "coverage": "pest --coverage --coverage-clover tests/coverage.xml", - "analyse": "phpstan analyse --memory-limit 1000M -l 0 -c phpstan.neon ./src" + "cs-fix": "php-cs-fixer fix $1", + "json-fix": [ + "@composer normalize --no-update-lock", + "find ./src -name composer.json -exec composer normalize --no-update-lock {} \\;" + ], + "test": "pest" } } diff --git a/src/AppStore/composer.json b/src/AppStore/composer.json index 681952fa..e1d06517 100644 --- a/src/AppStore/composer.json +++ b/src/AppStore/composer.json @@ -1,18 +1,8 @@ { "name": "mineadmin/app-store", "description": "Mineadmin 2.0 AppStore Extension", - "type": "library", - "require": { - "hyperf/translation": "~3.1.0", - "nette/utils": "dev-master", - "ext-zip": "*" - }, "license": "MIT", - "autoload": { - "psr-4": { - "Mine\\AppStore\\": "src/" - } - }, + "type": "library", "authors": [ { "name": "xmo", @@ -25,6 +15,16 @@ "role": "Developer" } ], + "require": { + "ext-zip": "*", + "hyperf/translation": "~3.1.0", + "nette/utils": "dev-master" + }, + "autoload": { + "psr-4": { + "Mine\\AppStore\\": "src/" + } + }, "config": { "allow-plugins": { "pestphp/pest-plugin": true diff --git a/src/Crontab/composer.json b/src/Crontab/composer.json index 85ba8752..e21c29ca 100644 --- a/src/Crontab/composer.json +++ b/src/Crontab/composer.json @@ -1,8 +1,8 @@ { "name": "mineadmin/crontab", "description": "加强 Hyperf Crontab", - "type": "library", "license": "MIT", + "type": "library", "authors": [ { "name": "x.mo", diff --git a/src/HttpServer/composer.json b/src/HttpServer/composer.json index 273c8105..4b17a5ea 100644 --- a/src/HttpServer/composer.json +++ b/src/HttpServer/composer.json @@ -1,8 +1,8 @@ { "name": "mineadmin/http-server", "description": "加强 Hyperf 原生 HttpServer", - "type": "library", "license": "MIT", + "type": "library", "authors": [ { "name": "X.mo", @@ -15,11 +15,11 @@ ], "require": { "php": ">=8.1", + "hyperf/http-message": "^3.1", "hyperf/http-server": "^3.1", + "hyperf/translation": "^3.1", "hyperf/validation": "^3.1", - "hyperf/http-message": "^3.1", - "ramsey/uuid": "^4.7", - "hyperf/translation": "^3.1" + "ramsey/uuid": "^4.7" }, "autoload": { "psr-4": { diff --git a/src/Module/composer.json b/src/Module/composer.json index bfa58b13..d35b3473 100644 --- a/src/Module/composer.json +++ b/src/Module/composer.json @@ -1,9 +1,12 @@ { "name": "mineadmin/module", "description": "基于 MineAdmin 的模块化开发组件", - "type": "library", "license": "MIT", - "keywords": ["Hyperf","Module"], + "type": "library", + "keywords": [ + "Hyperf", + "Module" + ], "authors": [ { "name": "xmo", @@ -18,10 +21,10 @@ ], "require": { "php": ">=8.1", - "mineadmin/http-server": "2.0.x-dev", "hyperf/migration-generator": "^3.1", - "symfony/yaml": "*", - "hyperf/validation": "^3.1" + "hyperf/validation": "^3.1", + "mineadmin/http-server": "2.0.x-dev", + "symfony/yaml": "*" }, "autoload": { "psr-4": { diff --git a/src/SecurityAccess/composer.json b/src/SecurityAccess/composer.json index 2a06a921..ca6c9968 100644 --- a/src/SecurityAccess/composer.json +++ b/src/SecurityAccess/composer.json @@ -1,8 +1,8 @@ { "name": "mineadmin/security-access", "description": "Security Access Component", - "type": "library", "license": "MIT", + "type": "library", "authors": [ { "name": "xmo", @@ -17,9 +17,9 @@ ], "require": { "php": ">=8.1", - "mineadmin/security-bundle": "2.0.x-dev", - "casbin/casbin": "^v3.21", - "friendsofhyperf/facade": "^3.1" + "casbin/casbin": "^3.21", + "friendsofhyperf/facade": "^3.1", + "mineadmin/security-bundle": "2.0.x-dev" }, "autoload": { "psr-4": { diff --git a/src/SecurityBundle/composer.json b/src/SecurityBundle/composer.json index 9ab4e3d7..385045ea 100644 --- a/src/SecurityBundle/composer.json +++ b/src/SecurityBundle/composer.json @@ -17,8 +17,8 @@ ], "require": { "php": ">=8.1", - "hyperf/framework": "^3.1", - "friendsofhyperf/encryption": "^3.1" + "friendsofhyperf/encryption": "^3.1", + "hyperf/framework": "^3.1" }, "autoload": { "psr-4": { diff --git a/src/SecurityHttp/composer.json b/src/SecurityHttp/composer.json index f69b748d..3da3e36a 100644 --- a/src/SecurityHttp/composer.json +++ b/src/SecurityHttp/composer.json @@ -1,8 +1,8 @@ { "name": "mineadmin/security-http", "description": "MineAdmin Security http component", - "type": "library", "license": "MIT", + "type": "library", "authors": [ { "name": "xmo", @@ -17,9 +17,9 @@ ], "require": { "php": ">=8.1", + "lcobucci/jwt": "^5.2", "mineadmin/http-server": "2.0.x-dev", - "mineadmin/security-bundle": "2.0.x-dev", - "lcobucci/jwt": "^5.2" + "mineadmin/security-bundle": "2.0.x-dev" }, "autoload": { "psr-4": { diff --git a/src/Support/composer.json b/src/Support/composer.json index e6cac490..d924ef8a 100644 --- a/src/Support/composer.json +++ b/src/Support/composer.json @@ -1,8 +1,8 @@ { "name": "mineadmin/support", "description": "MineAdmin Support component", - "type": "library", "license": "MIT", + "type": "library", "authors": [ { "name": "xmo", @@ -17,7 +17,7 @@ ], "require": { "php": ">=8.1", - "zoujingli/ip2region": "2.0.*" + "zoujingli/ip2region": "~2.0.0" }, "autoload": { "psr-4": { diff --git a/src/jwt-auth/composer.json b/src/jwt-auth/composer.json index bb23e40d..bc7402b6 100644 --- a/src/jwt-auth/composer.json +++ b/src/jwt-auth/composer.json @@ -1,7 +1,8 @@ { "name": "xmo/jwt-auth", - "type": "library", + "description": "jwt-auth Component", "license": "MIT", + "type": "library", "keywords": [ "php", "hyperf" @@ -18,17 +19,6 @@ "role": "Developer" } ], - "description": "jwt-auth Component", - "autoload": { - "psr-4": { - "Xmo\\JWTAuth\\": "src/" - } - }, - "autoload-dev": { - "psr-4": { - "HyperfTest\\": "tests" - } - }, "require": { "php": ">=8.1", "lcobucci/jwt": "~5.2.0", @@ -36,19 +26,29 @@ }, "require-dev": {}, "suggest": { - "hyperf/utils": "required hyperf/utils ~3.1.0", "hyperf/cache": "required hyperf/cache ~3.1.0", "hyperf/command": "required hyperf/command ~3.1.0", "hyperf/config": "required hyperf/config ~3.1.0", - "hyperf/di": "required hyperf/di ~3.1.0" + "hyperf/di": "required hyperf/di ~3.1.0", + "hyperf/utils": "required hyperf/utils ~3.1.0" + }, + "autoload": { + "psr-4": { + "Xmo\\JWTAuth\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "HyperfTest\\": "tests" + } }, "config": { "sort-packages": true }, - "scripts": {}, "extra": { "hyperf": { "config": "Xmo\\JWTAuth\\ConfigProvider" } - } + }, + "scripts": {} } diff --git a/src/mine-core/composer.json b/src/mine-core/composer.json index e39b18d0..3d71ae4b 100644 --- a/src/mine-core/composer.json +++ b/src/mine-core/composer.json @@ -1,7 +1,8 @@ { "name": "xmo/mine-core", - "type": "library", + "description": "mineadmin core package", "license": "Apache-2.0", + "type": "library", "keywords": [ "php", "mineadmin core" @@ -18,40 +19,30 @@ "role": "Developer" } ], - "description": "mineadmin core package", - "autoload": { - "psr-4": { - "Mine\\": "src/" - } - }, - "autoload-dev": { - "psr-4": { - } - }, "require": { "php": ">=8.1", "ext-gd": "*", "ext-json": "*", + "ext-mbstring": "*", "ext-openssl": "*", - "ext-xml": "*", "ext-pdo": "*", "ext-pdo_mysql": "*", - "ext-mbstring": "*", "ext-redis": "*", "ext-swoole": ">=5.0", + "ext-xml": "*", "doctrine/dbal": "^3.1", - "hyperf/di": "^3.1", "hyperf/amqp": "^3.1", "hyperf/async-queue": "^3.1", "hyperf/cache": "^3.1", "hyperf/codec": "^3.1", "hyperf/command": "^3.1", "hyperf/config": "^3.1", + "hyperf/constants": "^3.1", "hyperf/crontab": "^3.1", "hyperf/database": "^3.1", "hyperf/database-pgsql": "^3.1", - "hyperf/constants": "^3.1", "hyperf/db-connection": "^3.1", + "hyperf/di": "^3.1", "hyperf/filesystem": "^3.1", "hyperf/flysystem-oss": "^1.2", "hyperf/framework": "^3.1", @@ -59,6 +50,7 @@ "hyperf/http-server": "^3.1", "hyperf/logger": "^3.1", "hyperf/memory": "^3.1", + "hyperf/migration-generator": "^3.1", "hyperf/model-cache": "^3.1", "hyperf/paginator": "^3.1", "hyperf/pool": "^3.1", @@ -69,34 +61,41 @@ "hyperf/translation": "^3.1", "hyperf/validation": "^3.1", "hyperf/websocket-server": "^3.1", - "hyperf/migration-generator": "^3.1", "overtrue/flysystem-cos": "^5.0", "overtrue/flysystem-qiniu": "^3.0", + "ramsey/uuid": "^4.7", "symfony/property-access": "^6.0", "symfony/serializer": "^6.0", "tangwei/apidocs": "^3.0", "yurunsoft/phpmailer-swoole": "^1.0", - "zoujingli/ip2region": "2.0.*", - "ramsey/uuid": "^4.7" + "zoujingli/ip2region": "~2.0.0" }, "suggest": { - "ext-openssl": "Required to use HTTPS.", "ext-json": "Required to use JSON.", + "ext-openssl": "Required to use HTTPS.", "ext-pdo": "Required to use MySQL Client.", "ext-pdo_mysql": "Required to use MySQL Client.", "ext-redis": "Required to use Redis Client.", "ext-xlswriter": "Required to use xlswriter." }, + "autoload": { + "psr-4": { + "Mine\\": "src/" + } + }, + "autoload-dev": { + "psr-4": {} + }, "config": { "optimize-autoloader": true, "sort-packages": true }, - "scripts": { - "cs-fix": "php-cs-fixer fix $1" - }, "extra": { "hyperf": { "config": "Mine\\ConfigProvider" } + }, + "scripts": { + "cs-fix": "php-cs-fixer fix $1" } } diff --git a/src/mine-generator/composer.json b/src/mine-generator/composer.json index dca7ed27..ef1979e1 100644 --- a/src/mine-generator/composer.json +++ b/src/mine-generator/composer.json @@ -1,10 +1,12 @@ { "name": "xmo/mine-generator", - "type": "library", - "license": "Apache-2.0", "description": "MineAdmin Code Generator", + "license": "Apache-2.0", + "type": "library", "keywords": [ - "MineAdmin","Hyperf","admin", + "MineAdmin", + "Hyperf", + "admin", "generator-code" ], "authors": [ @@ -19,21 +21,21 @@ "role": "Developer" } ], + "require": { + "php": ">=8.1" + }, "autoload": { "psr-4": { "Mine\\Generator\\": "src" } }, - "require": { - "php": ">=8.1" + "config": { + "optimize-autoloader": true, + "sort-packages": true }, "extra": { "hyperf": { "config": "Mine\\Generator\\GeneratorConfigProvider" } - }, - "config": { - "optimize-autoloader": true, - "sort-packages": true } } \ No newline at end of file diff --git a/src/mine-helpers/composer.json b/src/mine-helpers/composer.json index ecf331b1..8bdad608 100644 --- a/src/mine-helpers/composer.json +++ b/src/mine-helpers/composer.json @@ -1,7 +1,7 @@ { "name": "xmo/mine-helpers", - "license": "Apache-2.0", "description": "MineAdmin Helpers Library", + "license": "Apache-2.0", "authors": [ { "name": "xmo", @@ -14,6 +14,9 @@ "role": "Developer" } ], + "require": { + "php": ">=8.1" + }, "autoload": { "psr-4": { "Mine\\Helper\\": "src" @@ -22,9 +25,6 @@ "src/functions.php" ] }, - "require": { - "php": ">=8.1" - }, "config": { "optimize-autoloader": true, "sort-packages": true diff --git a/src/mine-service/composer.json b/src/mine-service/composer.json index e4a4b3e5..b648e8f3 100644 --- a/src/mine-service/composer.json +++ b/src/mine-service/composer.json @@ -1,7 +1,8 @@ { "name": "xmo/mine-service", - "type": "library", + "description": "mineadmin Service package", "license": "Apache-2.0", + "type": "library", "keywords": [ "mineadmin", "service" @@ -18,25 +19,24 @@ "role": "Developer" } ], - "description": "mineadmin Service package", + "require": { + "php": ">=8.1" + }, "autoload": { "psr-4": { "Mine\\": "src/" } }, - "require": { - "php": ">=8.1" - }, "config": { "optimize-autoloader": true, "sort-packages": true }, - "scripts": { - "cs-fix": "php-cs-fixer fix $1" - }, "extra": { "hyperf": { "config": "Mine\\Generator\\GeneratorConfigProvider" } + }, + "scripts": { + "cs-fix": "php-cs-fixer fix $1" } } diff --git a/src/next-core-x/composer.json b/src/next-core-x/composer.json index d1231943..de0241d2 100644 --- a/src/next-core-x/composer.json +++ b/src/next-core-x/composer.json @@ -2,7 +2,10 @@ "name": "mineadmin/next-core-x", "description": "hyperf im basic services, providing the most basic channels and the subscribe publish module.", "keywords": [ - "Hyperf","Library","components","im-server" + "Hyperf", + "Library", + "components", + "im-server" ], "authors": [ { @@ -10,6 +13,15 @@ "role": "Developer" } ], + "require": { + "php": ">=8.1", + "hyperf/di": "^3.1", + "hyperf/framework": "^3.1", + "hyperf/snowflake": "^3.1" + }, + "require-dev": { + "roave/security-advisories": "dev-latest" + }, "autoload": { "psr-4": { "Mine\\NextCoreX": "src" @@ -20,16 +32,6 @@ "Mine\\NextCoreX\\Tests": "tests" } }, - "require": { - "php": ">=8.1", - "hyperf/framework": "^3.1", - "hyperf/di": "^3.1", - "hyperf/snowflake": "^3.1" - } - , - "require-dev": { - "roave/security-advisories": "dev-latest" - }, "extra": { "hyperf": { "config": "Mine\\NextCoreX\\ConfigProvider" diff --git a/src/office/composer.json b/src/office/composer.json index 22c0c6a7..cb7a81c4 100644 --- a/src/office/composer.json +++ b/src/office/composer.json @@ -1,7 +1,8 @@ { "name": "xmo/mine-office", - "type": "library", + "description": "mineadmin office package", "license": "Apache-2.0", + "type": "library", "keywords": [ "mineadmin", "office" @@ -18,7 +19,10 @@ "role": "Developer" } ], - "description": "mineadmin office package", + "require": { + "php": ">=8.1", + "phpoffice/phpspreadsheet": "^1.24" + }, "autoload": { "psr-4": { "Mine\\Office\\": "src/" @@ -29,10 +33,6 @@ "MineTest\\": "tests" } }, - "require": { - "php": ">=8.1", - "phpoffice/phpspreadsheet": "^1.24" - }, "config": { "optimize-autoloader": true, "sort-packages": true diff --git a/src/translatable/composer.json b/src/translatable/composer.json index 3ae8e90e..eabae0bc 100644 --- a/src/translatable/composer.json +++ b/src/translatable/composer.json @@ -1,7 +1,8 @@ { "name": "xmo/mine-translatable", - "type": "library", + "description": "The Hyperf Multilingual Model package.", "license": "MIT", + "type": "library", "keywords": [ "php", "hyperf", @@ -9,7 +10,6 @@ "language", "database" ], - "description": "The Hyperf Multilingual Model package.", "authors": [ { "name": "X.Mo", @@ -30,22 +30,13 @@ "email": "ds@dimsav.com", "homepage": "http://dimsav.com", "role": "Developer" - },{ + }, + { "name": "zds", "email": "2771717608@qq.com", "role": "Developer" } ], - "autoload": { - "psr-4": { - "Mine\\Translatable\\": "src/" - } - }, - "autoload-dev": { - "psr-4": { - "Mine\\Translatable\\": "tests" - } - }, "require": { "php": ">=8.1", "ext-swoole": ">=5.0", @@ -60,21 +51,31 @@ "require-dev": { "friendsofphp/php-cs-fixer": "^3.0", "hyperf/testing": "^3.1", + "mockery/mockery": "^1.0", "phpstan/phpstan": "^1.0", - "swoole/ide-helper": "^5.0", - "mockery/mockery": "^1.0" + "swoole/ide-helper": "^5.0" + }, + "autoload": { + "psr-4": { + "Mine\\Translatable\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Mine\\Translatable\\": "tests" + } }, "config": { "sort-packages": true }, - "scripts": { - "test": "co-phpunit -c phpunit.xml --colors=always", - "analyse": "phpstan analyse --memory-limit 1024M -l 0 ./src", - "cs-fix": "php-cs-fixer fix $1" - }, "extra": { "hyperf": { "config": "Mine\\Translatable\\ConfigProvider" } + }, + "scripts": { + "analyse": "phpstan analyse --memory-limit 1024M -l 0 ./src", + "cs-fix": "php-cs-fixer fix $1", + "test": "co-phpunit -c phpunit.xml --colors=always" } } From 4de59b32fadf1ea430b0cd6b518794c548f46581 Mon Sep 17 00:00:00 2001 From: StyleCI Date: Mon, 17 Jun 2024 09:16:31 +0000 Subject: [PATCH 2/2] Apply CS Fixer --- src/AppStore/src/Command/CreateCommand.php | 6 +++--- src/AppStore/src/Command/InitialCommand.php | 4 ++-- src/Module/src/Command/Creater/CreateModel.php | 2 +- src/SecurityBundle/src/AbstractUserProvider.php | 2 +- src/SecurityHttp/tests/Cases/UserProviderTest.php | 4 ++-- src/mine-core/src/Command/Creater/CreateModel.php | 2 +- src/mine-generator/publish/generator.php | 6 +++--- src/mine-generator/src/ControllerGenerator.php | 4 ++-- src/mine-generator/src/DtoGenerator.php | 2 +- src/mine-generator/src/MapperGenerator.php | 2 +- src/mine-generator/src/ModelGenerator.php | 2 +- src/mine-generator/src/RequestGenerator.php | 2 +- src/mine-generator/src/ServiceGenerator.php | 2 +- src/mine-generator/src/VueIndexGenerator.php | 4 ++-- 14 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/AppStore/src/Command/CreateCommand.php b/src/AppStore/src/Command/CreateCommand.php index 16fc6d57..57261c47 100644 --- a/src/AppStore/src/Command/CreateCommand.php +++ b/src/AppStore/src/Command/CreateCommand.php @@ -84,9 +84,9 @@ public function createMineJson(string $path, string $name, PluginTypeEnum $plugi 'psr-4' => [ $namespace . '\\' => 'src', ], - 'installScript' => $namespace . '\\InstallScript', - 'uninstallScript' => $namespace . '\\UninstallScript', - 'config' => $namespace . '\\ConfigProvider', + 'installScript' => $namespace . '\InstallScript', + 'uninstallScript' => $namespace . '\UninstallScript', + 'config' => $namespace . '\ConfigProvider', ]; } diff --git a/src/AppStore/src/Command/InitialCommand.php b/src/AppStore/src/Command/InitialCommand.php index 210c1d2c..26903f81 100644 --- a/src/AppStore/src/Command/InitialCommand.php +++ b/src/AppStore/src/Command/InitialCommand.php @@ -43,8 +43,8 @@ public function __invoke(): int } $binFile = file_get_contents(BASE_PATH . '/bin/hyperf.php'); if (str_contains($binFile, 'Mine\AppStore\Plugin::init();')) { - $binFile = str_replace('Hyperf\Di\ClassLoader::init();', '\\Mine\\AppStore\\Plugin::init(); - Hyperf\\Di\\ClassLoader::init();', $binFile); + $binFile = str_replace('Hyperf\Di\ClassLoader::init();', '\Mine\AppStore\Plugin::init(); + Hyperf\Di\ClassLoader::init();', $binFile); file_put_contents(BASE_PATH . '/bin/hyperf.php', $binFile); $this->output->success('Plugin initialization code added successfully.'); } diff --git a/src/Module/src/Command/Creater/CreateModel.php b/src/Module/src/Command/Creater/CreateModel.php index 7068d772..12d19d59 100644 --- a/src/Module/src/Command/Creater/CreateModel.php +++ b/src/Module/src/Command/Creater/CreateModel.php @@ -70,7 +70,7 @@ public function handle() if (! empty($prefix) && preg_match(sprintf('/%s_%s[_a-zA-Z0-9]+/i', $prefix, $module), $tmp)) { $tableList[] = $tmp; } - if (preg_match(sprintf('/%s(\\b|_[a-zA-Z0-9]+)/i', $module), $tmp)) { + if (preg_match(sprintf('/%s(\b|_[a-zA-Z0-9]+)/i', $module), $tmp)) { $tableList[] = $tmp; } } diff --git a/src/SecurityBundle/src/AbstractUserProvider.php b/src/SecurityBundle/src/AbstractUserProvider.php index f2de7267..bf9b2311 100644 --- a/src/SecurityBundle/src/AbstractUserProvider.php +++ b/src/SecurityBundle/src/AbstractUserProvider.php @@ -91,7 +91,7 @@ protected function verifyPassword(UserInterface $user, string $password): bool protected function getUserEntity(): UserInterface { - $entityClass = $this->config->get('entity', '\\App\\Model\\User'); + $entityClass = $this->config->get('entity', '\App\Model\User'); if (! class_exists($entityClass)) { new NotFoundUserEntityException(); } diff --git a/src/SecurityHttp/tests/Cases/UserProviderTest.php b/src/SecurityHttp/tests/Cases/UserProviderTest.php index 7fda43da..4721f99b 100644 --- a/src/SecurityHttp/tests/Cases/UserProviderTest.php +++ b/src/SecurityHttp/tests/Cases/UserProviderTest.php @@ -49,7 +49,7 @@ public function testRetrieveByCredentials(): void $event = \Mockery::mock(EventDispatcherInterface::class); $config = \Mockery::mock(Config::class); $config->allows('get') - ->with('entity', '\\App\\Model\\User') + ->with('entity', '\App\Model\User') ->andReturn(UserModel::class); $builder = \Mockery::mock(Builder::class); ApplicationContext::getContainer()->set('mock.builder', $builder); @@ -101,7 +101,7 @@ public function testRetrieveById() $event = \Mockery::mock(EventDispatcherInterface::class); $config = \Mockery::mock(Config::class); $config->allows('get') - ->with('entity', '\\App\\Model\\User') + ->with('entity', '\App\Model\User') ->andReturn(UserModel::class); $builder = \Mockery::mock(Builder::class); ApplicationContext::getContainer()->set('mock.builder', $builder); diff --git a/src/mine-core/src/Command/Creater/CreateModel.php b/src/mine-core/src/Command/Creater/CreateModel.php index f72379aa..4568c903 100644 --- a/src/mine-core/src/Command/Creater/CreateModel.php +++ b/src/mine-core/src/Command/Creater/CreateModel.php @@ -70,7 +70,7 @@ public function handle() if (! empty($prefix) && preg_match(sprintf('/%s_%s[_a-zA-Z0-9]+/i', $prefix, $module), $tmp)) { $tableList[] = $tmp; } - if (preg_match(sprintf('/%s(\\b|_[a-zA-Z0-9]+)/i', $module), $tmp)) { + if (preg_match(sprintf('/%s(\b|_[a-zA-Z0-9]+)/i', $module), $tmp)) { $tableList[] = $tmp; } if ($tmp === $table) { diff --git a/src/mine-generator/publish/generator.php b/src/mine-generator/publish/generator.php index e0f2fd23..86bad309 100644 --- a/src/mine-generator/publish/generator.php +++ b/src/mine-generator/publish/generator.php @@ -11,7 +11,7 @@ */ return [ 'dto' => [ - 'namespace' => 'App\\Dto', + 'namespace' => 'App\Dto', 'path' => BASE_PATH . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'Dto', 'type' => [ 'mapping' => [ @@ -26,11 +26,11 @@ ], ], 'mapper' => [ - 'namespace' => 'App\\Mapper', + 'namespace' => 'App\Mapper', 'path' => BASE_PATH . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'Mapper', ], 'service' => [ - 'namespace' => 'App\\Service', + 'namespace' => 'App\Service', 'path' => BASE_PATH . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'Service', 'impl' => 'Impl', ], diff --git a/src/mine-generator/src/ControllerGenerator.php b/src/mine-generator/src/ControllerGenerator.php index 835db6a7..83d371d3 100644 --- a/src/mine-generator/src/ControllerGenerator.php +++ b/src/mine-generator/src/ControllerGenerator.php @@ -236,7 +236,7 @@ protected function getReplaceContent(): array */ protected function initNamespace(): string { - $namespace = $this->getNamespace() . '\\Controller'; + $namespace = $this->getNamespace() . '\Controller'; if (! empty($this->tablesContract->getPackageName())) { return $namespace . '\\' . Str::title($this->tablesContract->getPackageName()); } @@ -325,7 +325,7 @@ protected function getMethodRoute(string $route): string protected function getDtoClass(): string { return sprintf( - '\\%s\\Dto\\%s::class', + '\%s\Dto\%s::class', $this->tablesContract->getNamespace(), $this->getBusinessName() . 'Dto' ); diff --git a/src/mine-generator/src/DtoGenerator.php b/src/mine-generator/src/DtoGenerator.php index 1b13bf77..6e9f4462 100644 --- a/src/mine-generator/src/DtoGenerator.php +++ b/src/mine-generator/src/DtoGenerator.php @@ -157,7 +157,7 @@ protected function getReplaceContent(): array */ protected function initNamespace(): string { - return $this->getNamespace() . '\\Dto'; + return $this->getNamespace() . '\Dto'; } /** diff --git a/src/mine-generator/src/MapperGenerator.php b/src/mine-generator/src/MapperGenerator.php index 4289bbe3..2f0779d4 100644 --- a/src/mine-generator/src/MapperGenerator.php +++ b/src/mine-generator/src/MapperGenerator.php @@ -195,7 +195,7 @@ protected function getReplaceContent(): array */ protected function initNamespace(): string { - return $this->getNamespace() . '\\Mapper'; + return $this->getNamespace() . '\Mapper'; } /** diff --git a/src/mine-generator/src/ModelGenerator.php b/src/mine-generator/src/ModelGenerator.php index da37db54..b642f852 100644 --- a/src/mine-generator/src/ModelGenerator.php +++ b/src/mine-generator/src/ModelGenerator.php @@ -239,7 +239,7 @@ protected function getReplaceContent(): array */ protected function initNamespace(): string { - return $this->getNamespace() . '\\Model'; + return $this->getNamespace() . '\Model'; } /** diff --git a/src/mine-generator/src/RequestGenerator.php b/src/mine-generator/src/RequestGenerator.php index e6625388..a5223a41 100644 --- a/src/mine-generator/src/RequestGenerator.php +++ b/src/mine-generator/src/RequestGenerator.php @@ -185,7 +185,7 @@ protected function getReplaceContent(): array */ protected function initNamespace(): string { - return $this->getNamespace() . '\\Request'; + return $this->getNamespace() . '\Request'; } /** diff --git a/src/mine-generator/src/ServiceGenerator.php b/src/mine-generator/src/ServiceGenerator.php index 547d24bf..7dbdabaf 100644 --- a/src/mine-generator/src/ServiceGenerator.php +++ b/src/mine-generator/src/ServiceGenerator.php @@ -183,7 +183,7 @@ protected function getReplaceContent(): array */ protected function initNamespace(): string { - return $this->getNamespace() . '\\Service'; + return $this->getNamespace() . '\Service'; } /** diff --git a/src/mine-generator/src/VueIndexGenerator.php b/src/mine-generator/src/VueIndexGenerator.php index 692cf1ae..0fdde264 100644 --- a/src/mine-generator/src/VueIndexGenerator.php +++ b/src/mine-generator/src/VueIndexGenerator.php @@ -455,9 +455,9 @@ protected function jsonFormat(array $data, bool $removeValueQuotes = false): str { $data = str_replace(' ', ' ', json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT)); $data = str_replace(['"true"', '"false"', '\\'], [true, false, ''], $data); - $data = preg_replace('/(\s+)\"(.+)\":/', '\\1\\2:', $data); + $data = preg_replace('/(\s+)\"(.+)\":/', '\1\2:', $data); if ($removeValueQuotes) { - $data = preg_replace('/(:\s)\"(.+)\"/', '\\1\\2', $data); + $data = preg_replace('/(:\s)\"(.+)\"/', '\1\2', $data); } return $data; }