承接 airlst/phpstan-config 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

airlst/phpstan-config

最新稳定版本:10.0.2

Composer 安装命令:

composer require airlst/phpstan-config

包简介

PHPStan config for AirLST projects

README 文档

README

Latest Version on Packagist Total Downloads

PHPStan config for AirLST projects.

Installation

You can install the package via Composer:

composer require --dev airlst/phpstan-config

Make sure to allow the phpstan/extension-installer plugin to run in your composer.json:

{
    "config": {
        "allow-plugins": {
            "phpstan/extension-installer": true
        }
    }
}

Usage

Create a phpstan.php in the root of your project with the following contents:

<?php

declare(strict_types=1);

$factory = new Airlst\PhpstanConfig\Factory(['src']);

return $factory
    ->level(8)
    ->create();

The constructor of the Factory class takes an array of paths to be scanned for PHP files and analyzed. You can pass any number of paths to it.

Configuration

You can use following configuration options on the Factory class by chaining them before create() call:

  • level(int $level): Set the level of PHPStan
  • include(string $file): Include additional PHPStan neon file
  • exclude(string $file): Exclude provided PHPStan neon file
  • withBleedingEdge(): Use bleeding edge version of PHPStan
  • useCacheDir(string $cacheDir): Use cache directory for PHPStan
  • typeCoverage(int $return, int $param, int $property, int $constant): Set type coverage percentage, default is 100% for all
  • typePerfect(bool $nullOverFalse, bool $noMixedProperty, bool $noMixedCaller, bool $narrowParam, bool $narrowReturn): Set type perfect configuration, by default all turned on. See rectorphp/type-perfect README for more details.
  • addRule(string $file): Add additional rule to PHPStan
  • ignoreError(string $message, ?string $path, ?int $count, ?bool $reportUnmatched): Ignore provided error message
  • checkMissingIterableValueType(bool $enable = true): Enables/Disables checkMissingIterableValueType rule
  • checkGenericClassInNonGenericObjectType(bool $enable = true): Enables/Disables checkGenericClassInNonGenericObjectType rule
  • strictRules(): Enables/disables strict rules. For available method arguments you can check phpstan/phpstan-strict-rules documentation

Running PHPStan

Run PHPStan with the following command:

./vendor/bin/phpstan analyse -c phpstan.php

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 19.02k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 7
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-02-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固