Giter Site home page Giter Site logo

phpstan-config's Introduction

PHPStan config for AirLST projects

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 $noMixed, bool $narrowParam): 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.

phpstan-config's People

Contributors

orkhanahmadov avatar github-actions[bot] avatar

Watchers

 avatar Michael Thaller avatar

Forkers

bileljellouli

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.