From 99fff0fffaafdee77d3cb6987513342a77da6cbc Mon Sep 17 00:00:00 2001 From: Shine Date: Tue, 19 May 2026 13:15:59 +0800 Subject: [PATCH 1/3] =?UTF-8?q?Revert=20"revert:=20=E6=92=A4=E5=9B=9E?= =?UTF-8?q?=E7=9B=B4=E6=8E=A5=E6=8E=A8=E9=80=81=E5=88=B0=202.0=20=E7=9A=84?= =?UTF-8?q?=20PHPStan=20=E5=B7=A5=E4=BD=9C=E6=B5=81=EF=BC=8C=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=20PR=20=E6=8F=90=E4=BA=A4"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 5c550ac888b996b780925dc6757a719ac5f8023e. --- .github/workflows/dusk.yml | 238 ------------- .github/workflows/phpstan.yml | 30 ++ phpstan-baseline.neon | 631 ++++++++++++++++++++++++++++++++++ phpstan.neon | 11 + 4 files changed, 672 insertions(+), 238 deletions(-) delete mode 100644 .github/workflows/dusk.yml create mode 100644 .github/workflows/phpstan.yml create mode 100644 phpstan-baseline.neon create mode 100644 phpstan.neon diff --git a/.github/workflows/dusk.yml b/.github/workflows/dusk.yml deleted file mode 100644 index 561d4a652..000000000 --- a/.github/workflows/dusk.yml +++ /dev/null @@ -1,238 +0,0 @@ -name: Laravel Dusk - -on: - push: - branches: [ 2.0 ] - pull_request: - branches: [ 2.0 ] - -jobs: - laravel5: - runs-on: ubuntu-latest - - steps: - - uses: shivammathur/setup-php@b7d1d9c9a92d8d8463ce36d7f60da34d461724f8 - with: - php-version: '7.2' - - - uses: actions/checkout@v2 - - - name: Composer Update - run: composer self-update --2 - - - name: Setup MySQL - # You may pin to the exact commit or the version. - # uses: mirromutth/mysql-action@de1fba8b3f90ce8db80f663a7043be3cf3231248 - uses: mirromutth/mysql-action@v1.1 - with: - # Version of MySQL to use - mysql version: 5.7 - # MYSQL_ROOT_PASSWORD - root superuser password - mysql root password: 123456 - # MYSQL_DATABASE - name for the default database that is created - mysql database: laravel - # MYSQL_USER - create the specified user with superuser power for created database - mysql user: root - # MYSQL_PASSWORD - specified superuser password which user is power for created database - mysql password: 123456 - - - name: Install Dependencies - run: | - composer create-project --prefer-dist laravel/laravel laravel-tests 5.* - sh ./tests/bin/install-dep.sh - - - name: Install Admin - run: sh ./tests/bin/install-admin.sh - -# - name: Install Xvfb -# run: sudo apt-get install xvfb - - - name: Start Server - run: sh ./tests/bin/start.sh - - - name: Run test suite - run: cd ./laravel-tests && php artisan dusk - - laravel6: - runs-on: ubuntu-latest - - steps: - - uses: shivammathur/setup-php@b7d1d9c9a92d8d8463ce36d7f60da34d461724f8 - with: - php-version: '7.3' - - - uses: actions/checkout@v2 - - - name: Composer Update - run: composer self-update --2 - - - name: Setup MySQL - # You may pin to the exact commit or the version. - # uses: mirromutth/mysql-action@de1fba8b3f90ce8db80f663a7043be3cf3231248 - uses: mirromutth/mysql-action@v1.1 - with: - # Version of MySQL to use - mysql version: 5.7 - # MYSQL_ROOT_PASSWORD - root superuser password - mysql root password: 123456 - # MYSQL_DATABASE - name for the default database that is created - mysql database: laravel - # MYSQL_USER - create the specified user with superuser power for created database - mysql user: root - # MYSQL_PASSWORD - specified superuser password which user is power for created database - mysql password: 123456 - - - name: Install Dependencies - run: | - composer create-project --prefer-dist laravel/laravel laravel-tests 6.* - sh ./tests/bin/install-dep.sh - - - name: Install Admin - run: sh ./tests/bin/install-admin.sh - -# - name: Install Xvfb -# run: sudo apt-get install xvfb - - - name: Start Server - run: sh ./tests/bin/start.sh - - - name: Run test suite - run: cd ./laravel-tests && php artisan dusk - - laravel7: - runs-on: ubuntu-latest - - steps: - - uses: shivammathur/setup-php@b7d1d9c9a92d8d8463ce36d7f60da34d461724f8 - with: - php-version: '7.3' - - - uses: actions/checkout@v2 - - - name: Composer Update - run: composer self-update --2 - - - name: Setup MySQL - # You may pin to the exact commit or the version. - # uses: mirromutth/mysql-action@de1fba8b3f90ce8db80f663a7043be3cf3231248 - uses: mirromutth/mysql-action@v1.1 - with: - # Version of MySQL to use - mysql version: 5.7 - # MYSQL_ROOT_PASSWORD - root superuser password - mysql root password: 123456 - # MYSQL_DATABASE - name for the default database that is created - mysql database: laravel - # MYSQL_USER - create the specified user with superuser power for created database - mysql user: root - # MYSQL_PASSWORD - specified superuser password which user is power for created database - mysql password: 123456 - - - name: Install Dependencies - run: | - composer create-project --prefer-dist laravel/laravel laravel-tests 7.* - sh ./tests/bin/install-dep.sh - - - name: Install Admin - run: sh ./tests/bin/install-admin.sh - -# - name: Install Xvfb -# run: sudo apt-get install xvfb - - - name: Start Server - run: sh ./tests/bin/start.sh - - - name: Run test suite - run: cd ./laravel-tests && php artisan dusk - - laravel8: - runs-on: ubuntu-latest - - steps: - - uses: shivammathur/setup-php@b7d1d9c9a92d8d8463ce36d7f60da34d461724f8 - with: - php-version: '8.0' - - - uses: actions/checkout@v2 - - - name: Composer Update - run: composer self-update --2 - - - name: Setup MySQL - # You may pin to the exact commit or the version. - # uses: mirromutth/mysql-action@de1fba8b3f90ce8db80f663a7043be3cf3231248 - uses: mirromutth/mysql-action@v1.1 - with: - # Version of MySQL to use - mysql version: 5.7 - # MYSQL_ROOT_PASSWORD - root superuser password - mysql root password: 123456 - # MYSQL_DATABASE - name for the default database that is created - mysql database: laravel - # MYSQL_USER - create the specified user with superuser power for created database - mysql user: root - # MYSQL_PASSWORD - specified superuser password which user is power for created database - mysql password: 123456 - - - name: Install Dependencies - run: | - composer create-project --prefer-dist laravel/laravel laravel-tests 8.* - sh ./tests/bin/install-dep.sh - - - name: Install Admin - run: sh ./tests/bin/install-admin.sh - - - name: Install Xvfb - run: sudo apt-get install xvfb - - - name: Start Server - run: sh ./tests/bin/start.sh - - - name: Run test suite - run: cd ./laravel-tests && php artisan dusk - - laravel9: - runs-on: ubuntu-latest - - steps: - - uses: shivammathur/setup-php@b7d1d9c9a92d8d8463ce36d7f60da34d461724f8 - with: - php-version: '8.0' - - - uses: actions/checkout@v2 - - - name: Composer Update - run: composer self-update --2 - - - name: Setup MySQL - # You may pin to the exact commit or the version. - # uses: mirromutth/mysql-action@de1fba8b3f90ce8db80f663a7043be3cf3231248 - uses: mirromutth/mysql-action@v1.1 - with: - # Version of MySQL to use - mysql version: 5.7 - # MYSQL_ROOT_PASSWORD - root superuser password - mysql root password: 123456 - # MYSQL_DATABASE - name for the default database that is created - mysql database: laravel - # MYSQL_USER - create the specified user with superuser power for created database - mysql user: root - # MYSQL_PASSWORD - specified superuser password which user is power for created database - mysql password: 123456 - - - name: Install Dependencies - run: | - composer create-project --prefer-dist laravel/laravel laravel-tests 9.* - sh ./tests/bin/install-dep.sh - - - name: Install Admin - run: sh ./tests/bin/install-admin.sh - - - name: Install Xvfb - run: sudo apt-get install xvfb - - - name: Start Server - run: sh ./tests/bin/start.sh - - - name: Run test suite - run: cd ./laravel-tests && php artisan dusk diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml new file mode 100644 index 000000000..644e43378 --- /dev/null +++ b/.github/workflows/phpstan.yml @@ -0,0 +1,30 @@ +name: PHPStan + +on: + push: + branches: ['2.0'] + pull_request: + branches: ['2.0'] + +jobs: + phpstan: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + php: ['8.1', '8.2', '8.3', '8.4', '8.5'] + + name: PHP ${{ matrix.php }} + + steps: + - uses: actions/checkout@v4 + + - uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + + - run: composer install --no-interaction --prefer-dist --ignore-platform-req=php + + - run: vendor/bin/phpstan analyse --no-progress --memory-limit=512M --error-format=github diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 000000000..2c5ccbd12 --- /dev/null +++ b/phpstan-baseline.neon @@ -0,0 +1,631 @@ +parameters: + ignoreErrors: + - + message: '#^Unsafe usage of new static\(\)\.$#' + identifier: new.static + count: 1 + path: src/Actions/Action.php + + - + message: '#^Result of static method Dcat\\Admin\\Admin\:\:script\(\) \(void\) is used\.$#' + identifier: staticMethod.void + count: 1 + path: src/Admin.php + + - + message: '#^Call to static method forceScheme\(\) on an unknown class URL\.$#' + identifier: class.notFound + count: 1 + path: src/AdminServiceProvider.php + + - + message: '#^Call to static method getSchemaBuilder\(\) on an unknown class DB\.$#' + identifier: class.notFound + count: 1 + path: src/Console/ExportSeedCommand.php + + - + message: '#^Call to static method table\(\) on an unknown class DB\.$#' + identifier: class.notFound + count: 1 + path: src/Console/ExportSeedCommand.php + + - + message: '#^Result of method Illuminate\\Console\\Command\:\:error\(\) \(void\) is used\.$#' + identifier: method.void + count: 1 + path: src/Console/ExtensionDiableCommand.php + + - + message: '#^Result of method Illuminate\\Console\\Command\:\:error\(\) \(void\) is used\.$#' + identifier: method.void + count: 1 + path: src/Console/ExtensionEnableCommand.php + + - + message: '#^Call to sprintf contains 0 placeholders, 1 value given\.$#' + identifier: argument.sprintf + count: 1 + path: src/Console/ExtensionInstallCommand.php + + - + message: '#^Result of method Illuminate\\Console\\Command\:\:error\(\) \(void\) is used\.$#' + identifier: method.void + count: 1 + path: src/Console/ExtensionMakeCommand.php + + - + message: '#^Call to an undefined method Dcat\\Admin\\Console\\GeneratorCommand\:\:addTestOptions\(\)\.$#' + identifier: method.notFound + count: 1 + path: src/Console/GeneratorCommand.php + + - + message: '#^Call to an undefined method Dcat\\Admin\\Console\\GeneratorCommand\:\:handleTestCreation\(\)\.$#' + identifier: method.notFound + count: 1 + path: src/Console/GeneratorCommand.php + + - + message: '#^Call to static method getRoutes\(\) on an unknown class Route\.$#' + identifier: class.notFound + count: 1 + path: src/Console/IdeHelperCommand.php + + - + message: '#^Instantiated class League\\Flysystem\\Adapter\\Local not found\.$#' + identifier: class.notFound + count: 2 + path: src/Console/PublishCommand.php + + - + message: '#^Call to an undefined static method Dcat\\Admin\\Models\\Extension\:\:where\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: src/Extend/Manager.php + + - + message: '#^Method Dcat\\Admin\\Extend\\ServiceProvider\:\:getLogoBase64\(\) should return string but return statement is missing\.$#' + identifier: return.missing + count: 1 + path: src/Extend/ServiceProvider.php + + - + message: '#^Method Dcat\\Admin\\Extend\\Setting\:\:title\(\) should return string but return statement is missing\.$#' + identifier: return.missing + count: 1 + path: src/Extend/Setting.php + + - + message: '#^Method Dcat\\Admin\\Form\:\:deleteFileWhenCreating\(\) should return Illuminate\\Http\\JsonResponse but return statement is missing\.$#' + identifier: return.missing + count: 1 + path: src/Form.php + + - + message: '#^Method Dcat\\Admin\\Form\:\:handleOrderable\(\) should return Symfony\\Component\\HttpFoundation\\Response but return statement is missing\.$#' + identifier: return.missing + count: 1 + path: src/Form.php + + - + message: '#^Unsafe usage of new static\(\)\.$#' + identifier: new.static + count: 1 + path: src/Form.php + + - + message: '#^Method Dcat\\Admin\\Form\\Builder\:\:pushField\(\) should return Illuminate\\Support\\Collection but return statement is missing\.$#' + identifier: return.missing + count: 1 + path: src/Form/Builder.php + + - + message: '#^Function captcha_src not found\.$#' + identifier: function.notFound + count: 1 + path: src/Form/Field/Captcha.php + + - + message: '#^Method Dcat\\Admin\\Form\\Field\\File\:\:deleteFile\(\) invoked with 2 parameters, 1 required\.$#' + identifier: arguments.count + count: 1 + path: src/Form/Field/File.php + + - + message: '#^Method Dcat\\Admin\\Form\\Field\\File\:\:getValidationErrors\(\) should return bool\|Illuminate\\Support\\MessageBag but return statement is missing\.$#' + identifier: return.missing + count: 1 + path: src/Form/Field/File.php + + - + message: '#^Call to static method make\(\) on an unknown class Intervention\\Image\\Facades\\Image\.$#' + identifier: class.notFound + count: 1 + path: src/Form/Field/Image.php + + - + message: '#^Call to static method make\(\) on an unknown class Intervention\\Image\\ImageManagerStatic\.$#' + identifier: class.notFound + count: 1 + path: src/Form/Field/Image.php + + - + message: '#^Parameter \$constraint of anonymous function has invalid type Intervention\\Image\\Constraint\.$#' + identifier: class.notFound + count: 1 + path: src/Form/Field/Image.php + + - + message: '#^Method Dcat\\Admin\\Form\\Field\\Nullable\:\:render\(\) should return Illuminate\\Contracts\\View\\Factory\|Illuminate\\View\\View\|string but return statement is missing\.$#' + identifier: return.missing + count: 1 + path: src/Form/Field/Nullable.php + + - + message: '#^Class Dcat\\Admin\\Form\\Field\\Model not found\.$#' + identifier: class.notFound + count: 1 + path: src/Form/Field/Select.php + + - + message: '#^Variable \$tools in empty\(\) always exists and is not falsy\.$#' + identifier: empty.variable + count: 1 + path: src/Form/Tools.php + + - + message: '#^Unsafe usage of new static\(\)\.$#' + identifier: new.static + count: 1 + path: src/Grid.php + + - + message: '#^Variable \$scope might not be defined\.$#' + identifier: variable.undefined + count: 2 + path: src/Grid.php + + - + message: '#^Class StringBackedEnum not found\.$#' + identifier: class.notFound + count: 1 + path: src/Grid/Column.php + + - + message: '#^Method Dcat\\Admin\\Grid\\Column\\Filter\:\:render\(\) should return string but return statement is missing\.$#' + identifier: return.missing + count: 1 + path: src/Grid/Column/Filter.php + + - + message: '#^Unsafe usage of new static\(\)\.$#' + identifier: new.static + count: 1 + path: src/Grid/Column/Filter.php + + - + message: '#^Method Dcat\\Admin\\Grid\\Displayers\\DropdownActions\:\:getDeleteLabel\(\) should return string but return statement is missing\.$#' + identifier: return.missing + count: 1 + path: src/Grid/Displayers/DropdownActions.php + + - + message: '#^Method Dcat\\Admin\\Grid\\Displayers\\DropdownActions\:\:getEditLabel\(\) should return string but return statement is missing\.$#' + identifier: return.missing + count: 1 + path: src/Grid/Displayers/DropdownActions.php + + - + message: '#^Method Dcat\\Admin\\Grid\\Displayers\\DropdownActions\:\:getQuickEditLabel\(\) should return string but return statement is missing\.$#' + identifier: return.missing + count: 1 + path: src/Grid/Displayers/DropdownActions.php + + - + message: '#^Method Dcat\\Admin\\Grid\\Displayers\\DropdownActions\:\:getViewLabel\(\) should return string but return statement is missing\.$#' + identifier: return.missing + count: 1 + path: src/Grid/Displayers/DropdownActions.php + + - + message: '#^Access to an undefined property Dcat\\Admin\\Grid\\Exporters\\AbstractExporter\:\:\$modelQueries\.$#' + identifier: property.notFound + count: 1 + path: src/Grid/Exporters/AbstractExporter.php + + - + message: '#^Unsafe usage of new static\(\)\.$#' + identifier: new.static + count: 1 + path: src/Grid/Exporters/AbstractExporter.php + + - + message: '#^Call to static method urlWithQuery\(\) on an unknown class Dcat\\Admin\\Grid\\Filter\\Presenter\\Helper\.$#' + identifier: class.notFound + count: 1 + path: src/Grid/Filter/Presenter/Select.php + + - + message: '#^Class Dcat\\Admin\\Grid\\Filter\\Presenter\\Arrayable not found\.$#' + identifier: class.notFound + count: 1 + path: src/Grid/Filter/Presenter/Select.php + + - + message: '#^Method Dcat\\Admin\\Grid\\FixColumns\:\:apply\(\) should return Closure but return statement is missing\.$#' + identifier: return.missing + count: 1 + path: src/Grid/FixColumns.php + + - + message: '#^Access to an undefined property Dcat\\Admin\\Grid\\LazyRenderable\:\:\$_simple_\.$#' + identifier: property.notFound + count: 1 + path: src/Grid/LazyRenderable.php + + - + message: '#^Access to an undefined property Dcat\\Admin\\Grid\\Model\:\:\$model\.$#' + identifier: property.notFound + count: 1 + path: src/Grid/Model.php + + - + message: '#^Call to an undefined method Dcat\\Admin\\Http\\Controllers\\AdminController\:\:detail\(\)\.$#' + identifier: method.notFound + count: 1 + path: src/Http/Controllers/AdminController.php + + - + message: '#^Call to an undefined method Dcat\\Admin\\Http\\Controllers\\AdminController\:\:form\(\)\.$#' + identifier: method.notFound + count: 5 + path: src/Http/Controllers/AdminController.php + + - + message: '#^Call to an undefined method Dcat\\Admin\\Http\\Controllers\\AdminController\:\:grid\(\)\.$#' + identifier: method.notFound + count: 1 + path: src/Http/Controllers/AdminController.php + + - + message: '#^Access to an undefined property Dcat\\Admin\\Http\\Controllers\\AuthController\:\:\$password\.$#' + identifier: property.notFound + count: 1 + path: src/Http/Controllers/AuthController.php + + - + message: '#^Access to undefined constant static\(Dcat\\Admin\\Http\\Controllers\\AuthController\)\:\:CURRENT_URL_NAME\.$#' + identifier: classConstant.notFound + count: 1 + path: src/Http/Controllers/AuthController.php + + - + message: '#^Method Dcat\\Admin\\Http\\Controllers\\HandleFormController\:\:getField\(\) should return Dcat\\Admin\\Form\\Field\\File but return statement is missing\.$#' + identifier: return.missing + count: 1 + path: src/Http/Controllers/HandleFormController.php + + - + message: '#^Access to an undefined property Dcat\\Admin\\Http\\Controllers\\UserController\:\:\$roles\.$#' + identifier: property.notFound + count: 3 + path: src/Http/Controllers/UserController.php + + - + message: '#^Unsafe usage of new static\(\)\.$#' + identifier: new.static + count: 1 + path: src/Http/JsonResponse.php + + - + message: '#^Method Dcat\\Admin\\Http\\Repositories\\Extension\:\:delete\(\) should return bool\|Dcat\\Admin\\Http\\JsonResponse\|int but return statement is missing\.$#' + identifier: return.missing + count: 1 + path: src/Http/Repositories/Extension.php + + - + message: '#^Method Dcat\\Admin\\Http\\Repositories\\Extension\:\:store\(\) should return bool\|Dcat\\Admin\\Http\\JsonResponse\|int but return statement is missing\.$#' + identifier: return.missing + count: 1 + path: src/Http/Repositories/Extension.php + + - + message: '#^Unsafe usage of new static\(\)\.$#' + identifier: new.static + count: 1 + path: src/Layout/Content.php + + - + message: '#^Call to an undefined static method Dcat\\Admin\\Models\\Administrator\:\:create\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: src/Models/AdminTablesSeeder.php + + - + message: '#^Call to an undefined static method Dcat\\Admin\\Models\\Administrator\:\:first\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: src/Models/AdminTablesSeeder.php + + - + message: '#^Call to an undefined static method Dcat\\Admin\\Models\\Administrator\:\:truncate\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: src/Models/AdminTablesSeeder.php + + - + message: '#^Call to an undefined static method Dcat\\Admin\\Models\\Menu\:\:insert\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: src/Models/AdminTablesSeeder.php + + - + message: '#^Call to an undefined static method Dcat\\Admin\\Models\\Menu\:\:truncate\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: src/Models/AdminTablesSeeder.php + + - + message: '#^Call to an undefined static method Dcat\\Admin\\Models\\Permission\:\:insert\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: src/Models/AdminTablesSeeder.php + + - + message: '#^Call to an undefined static method Dcat\\Admin\\Models\\Permission\:\:truncate\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: src/Models/AdminTablesSeeder.php + + - + message: '#^Call to an undefined static method Dcat\\Admin\\Models\\Role\:\:create\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: src/Models/AdminTablesSeeder.php + + - + message: '#^Call to an undefined static method Dcat\\Admin\\Models\\Role\:\:first\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: src/Models/AdminTablesSeeder.php + + - + message: '#^Call to an undefined static method Dcat\\Admin\\Models\\Role\:\:truncate\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: src/Models/AdminTablesSeeder.php + + - + message: '#^Access to an undefined property Dcat\\Admin\\Models\\Administrator\:\:\$avatar\.$#' + identifier: property.notFound + count: 1 + path: src/Models/Administrator.php + + - + message: '#^Call to an undefined static method Dcat\\Admin\\Models\\Menu\:\:find\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: src/Models/Menu.php + + - + message: '#^Call to an undefined static method Illuminate\\Support\\Facades\\Request\:\:offsetUnset\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: src/Models/Menu.php + + - + message: '#^Unsafe usage of new static\(\)\.$#' + identifier: new.static + count: 3 + path: src/Models/Menu.php + + - + message: '#^Access to an undefined property Dcat\\Admin\\Models\\Permission\:\:\$http_method\.$#' + identifier: property.notFound + count: 1 + path: src/Models/Permission.php + + - + message: '#^Access to an undefined property Dcat\\Admin\\Models\\Permission\:\:\$http_path\.$#' + identifier: property.notFound + count: 1 + path: src/Models/Permission.php + + - + message: '#^Access to an undefined property Dcat\\Admin\\Models\\Permission\:\:\$id\.$#' + identifier: property.notFound + count: 2 + path: src/Models/Permission.php + + - + message: '#^Call to an undefined static method Dcat\\Admin\\Models\\Permission\:\:find\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: src/Models/Permission.php + + - + message: '#^Call to an undefined static method Illuminate\\Support\\Facades\\Request\:\:offsetUnset\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: src/Models/Permission.php + + - + message: '#^Unsafe usage of new static\(\)\.$#' + identifier: new.static + count: 3 + path: src/Models/Permission.php + + - + message: '#^Unsafe usage of new static\(\)\.$#' + identifier: new.static + count: 1 + path: src/Models/Role.php + + - + message: '#^Class Dcat\\Laravel\\Database\\SoftDeletes not found\.$#' + identifier: class.notFound + count: 1 + path: src/Repositories/EloquentRepository.php + + - + message: '#^Method Dcat\\Admin\\Repositories\\EloquentRepository\:\:getOrderColumn\(\) should return string but return statement is missing\.$#' + identifier: return.missing + count: 1 + path: src/Repositories/EloquentRepository.php + + - + message: '#^Method Dcat\\Admin\\Repositories\\EloquentRepository\:\:getParentColumn\(\) should return string but return statement is missing\.$#' + identifier: return.missing + count: 1 + path: src/Repositories/EloquentRepository.php + + - + message: '#^Method Dcat\\Admin\\Repositories\\EloquentRepository\:\:getTitleColumn\(\) should return string but return statement is missing\.$#' + identifier: return.missing + count: 1 + path: src/Repositories/EloquentRepository.php + + - + message: '#^Unsafe usage of new static\(\)\.$#' + identifier: new.static + count: 1 + path: src/Repositories/EloquentRepository.php + + - + message: '#^Unsafe usage of new static\(\)\.$#' + identifier: new.static + count: 1 + path: src/Repositories/Repository.php + + - + message: '#^Method Dcat\\Admin\\Scaffold\\LangCreator\:\:create\(\) should return string but return statement is missing\.$#' + identifier: return.missing + count: 1 + path: src/Scaffold/LangCreator.php + + - + message: '#^Unsafe usage of new static\(\)\.$#' + identifier: new.static + count: 1 + path: src/Show.php + + - + message: '#^Unsafe usage of new static\(\)\.$#' + identifier: new.static + count: 2 + path: src/Support/ComposerProperty.php + + - + message: '#^Method Dcat\\Admin\\Support\\DatabaseUpdater\:\:resolve\(\) should return object but return statement is missing\.$#' + identifier: return.missing + count: 1 + path: src/Support/DatabaseUpdater.php + + - + message: '#^Variable \$item on left side of \?\? always exists and is not nullable\.$#' + identifier: nullCoalesce.variable + count: 1 + path: src/Support/Helper.php + + - + message: '#^Variable \$methods in empty\(\) always exists and is not falsy\.$#' + identifier: empty.variable + count: 1 + path: src/Support/Helper.php + + - + message: '#^Unsafe usage of new static\(\)\.$#' + identifier: new.static + count: 1 + path: src/Support/JavaScript.php + + - + message: '#^Unsafe usage of new static\(\)\.$#' + identifier: new.static + count: 1 + path: src/Support/LazyRenderable.php + + - + message: '#^Call to an undefined static method Dcat\\Admin\\Models\\Setting\:\:pluck\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: src/Support/Setting.php + + - + message: '#^Unsafe usage of new static\(\)\.$#' + identifier: new.static + count: 1 + path: src/Support/Setting.php + + - + message: '#^Variable \$folders might not be defined\.$#' + identifier: variable.undefined + count: 1 + path: src/Support/Zip.php + + - + message: '#^Result of method Dcat\\Admin\\Tree\:\:disableCreateButton\(\) \(void\) is used\.$#' + identifier: method.void + count: 1 + path: src/Tree.php + + - + message: '#^Result of method Dcat\\Admin\\Tree\:\:disableRefreshButton\(\) \(void\) is used\.$#' + identifier: method.void + count: 1 + path: src/Tree.php + + - + message: '#^Result of method Dcat\\Admin\\Tree\:\:disableSaveButton\(\) \(void\) is used\.$#' + identifier: method.void + count: 1 + path: src/Tree.php + + - + message: '#^Unsafe usage of new static\(\)\.$#' + identifier: new.static + count: 1 + path: src/Tree.php + + - + message: '#^Access to an undefined property Dcat\\Admin\\Widgets\\Box\:\:\$class\.$#' + identifier: property.notFound + count: 2 + path: src/Widgets/Box.php + + - + message: '#^Method Dcat\\Admin\\Widgets\\DialogForm\:\:render\(\) should return string but return statement is missing\.$#' + identifier: return.missing + count: 1 + path: src/Widgets/DialogForm.php + + - + message: '#^Call to an undefined method \$this\(Dcat\\Admin\\Widgets\\Form\)&Dcat\\Admin\\Contracts\\LazyRenderable\:\:payload\(\)\.$#' + identifier: method.notFound + count: 1 + path: src/Widgets/Form.php + + - + message: '#^Call to an undefined method Dcat\\Admin\\Widgets\\Form\:\:payload\(\)\.$#' + identifier: method.notFound + count: 1 + path: src/Widgets/Form.php + + - + message: '#^Unsafe usage of new static\(\)\.$#' + identifier: new.static + count: 1 + path: src/Widgets/Form.php + + - + message: '#^Method Dcat\\Admin\\Widgets\\Tooltip\:\:render\(\) should return string but return statement is missing\.$#' + identifier: return.missing + count: 1 + path: src/Widgets/Tooltip.php + + - + message: '#^Unsafe usage of new static\(\)\.$#' + identifier: new.static + count: 1 + path: src/Widgets/Widget.php diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 000000000..8128e1d4a --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,11 @@ +includes: + - phpstan-baseline.neon + +parameters: + level: 1 + phpVersion: 80100 + paths: + - src + ignoreErrors: + # class_alias 中使用的 Facade 类名 + - '#Class Admin not found#' From eb7fb25d114665dd6ccd5dceafe64da1dba33045 Mon Sep 17 00:00:00 2001 From: Shine Date: Tue, 19 May 2026 13:20:08 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20phpunit=20=E6=94=AF=E6=8C=81=20PHP?= =?UTF-8?q?=208.1-8.5=EF=BC=8C=E7=A7=BB=E9=99=A4=20--ignore-platform-req?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit phpunit/phpunit 改为 ^10.0 || ^11.0 || ^12.0,Composer 会根据 PHP 版本自动选择合适的版本。 --- .github/workflows/phpstan.yml | 2 +- composer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 644e43378..90a4e0b4c 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -25,6 +25,6 @@ jobs: php-version: ${{ matrix.php }} coverage: none - - run: composer install --no-interaction --prefer-dist --ignore-platform-req=php + - run: composer install --no-interaction --prefer-dist - run: vendor/bin/phpstan analyse --no-progress --memory-limit=512M --error-format=github diff --git a/composer.json b/composer.json index d09addd34..6642eb3b3 100755 --- a/composer.json +++ b/composer.json @@ -36,7 +36,7 @@ "require-dev": { "laravel/dusk": "^8.3", "phpstan/phpstan": "^2.1", - "phpunit/phpunit": "^12.0", + "phpunit/phpunit": "^10.0 || ^11.0 || ^12.0", "fakerphp/faker": "^1.24", "mockery/mockery": "^1.6" }, From d227d7d440ff1d71c2e0326cd438d5007e67ecea Mon Sep 17 00:00:00 2001 From: Shine Date: Tue, 19 May 2026 13:25:52 +0800 Subject: [PATCH 3/3] =?UTF-8?q?ci:=20=E6=B7=BB=E5=8A=A0=20Composer=20?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/phpstan.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 90a4e0b4c..c63f65a95 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -25,6 +25,14 @@ jobs: php-version: ${{ matrix.php }} coverage: none + - name: Cache Composer dependencies + uses: actions/cache@v4 + with: + path: vendor + key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} + restore-keys: | + ${{ runner.os }}-php-${{ matrix.php }}-composer- + - run: composer install --no-interaction --prefer-dist - run: vendor/bin/phpstan analyse --no-progress --memory-limit=512M --error-format=github