All Projects → Slamdunk → phpstan-extensions

Slamdunk / phpstan-extensions

Licence: MIT license
Extensions for PHPStan

Programming Languages

PHP
23972 projects - #3 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to phpstan-extensions

phpstan
PHP Static Analysis in Github Actions.
Stars: ✭ 41 (-32.79%)
Mutual labels:  static-analysis, phpstan
vim-phpstan
A Vim plugin for PHPStan - https://github.com/phpstan/phpstan. It calls `phpstan` to do static analysis of your PHP code and displays the errors in Vim's quickfix list.
Stars: ✭ 26 (-57.38%)
Mutual labels:  static-analysis, phpstan
phpstan-phpspec
PhpSpec extension for PHPStan
Stars: ✭ 19 (-68.85%)
Mutual labels:  static-analysis, phpstan
phpstan-symfony
*DEPRECATED* Symfony extension for PHPStan
Stars: ✭ 42 (-31.15%)
Mutual labels:  static-analysis, phpstan
phpstan-dba
PHPStan based SQL static analysis and type inference for the database access layer
Stars: ✭ 163 (+167.21%)
Mutual labels:  static-analysis, phpstan
phpstan-nette
Nette Framework class reflection extension for PHPStan & framework-specific rules
Stars: ✭ 87 (+42.62%)
Mutual labels:  static-analysis, phpstan
phpstan-wordpress
WordPress extensions for PHPStan ⛏️
Stars: ✭ 182 (+198.36%)
Mutual labels:  static-analysis, phpstan
phpstan-webmozart-assert
PHPStan extension for webmozart/assert
Stars: ✭ 132 (+116.39%)
Mutual labels:  static-analysis, phpstan
woocommerce-stubs
WooCommerce function and class declaration stubs for static analysis.
Stars: ✭ 49 (-19.67%)
Mutual labels:  static-analysis, phpstan
Phpstan
PHP Static Analysis Tool - discover bugs in your code without running it!
Stars: ✭ 10,534 (+17168.85%)
Mutual labels:  static-analysis, phpstan
install
basic script for project installation
Stars: ✭ 17 (-72.13%)
Mutual labels:  yii2
yii2-lets-talk
With this extension you can open chat with someone in popular messengers using the link on your website.
Stars: ✭ 15 (-75.41%)
Mutual labels:  yii2
duplex
Duplicate code finder for Elixir
Stars: ✭ 20 (-67.21%)
Mutual labels:  static-analysis
yii2-mailqueue
Yii2 mail queue component for yii2-swiftmailer.
Stars: ✭ 15 (-75.41%)
Mutual labels:  yii2
Yii2 Usuario
Highly customizable and extensible user management, authentication, and authorization Yii2 extension
Stars: ✭ 251 (+311.48%)
Mutual labels:  yii2
code-review
Automated static analysis & linting bot for Mozilla repositories
Stars: ✭ 51 (-16.39%)
Mutual labels:  static-analysis
Yii2 Imperavi Widget
Imperavi Redactor widget for Yii 2
Stars: ✭ 250 (+309.84%)
Mutual labels:  yii2
Yii2 Apidoc
Yii 2 apidoc extension.
Stars: ✭ 236 (+286.89%)
Mutual labels:  yii2
Cms
Craft is a flexible, user-friendly CMS for creating custom digital experiences on the web and beyond.
Stars: ✭ 2,713 (+4347.54%)
Mutual labels:  yii2
yii2-translatable
Translatable behavior aggregates logic of linking translations to the primary model
Stars: ✭ 15 (-75.41%)
Mutual labels:  yii2

Slam PHPStan extensions

Latest Stable Version Downloads Integrate Code Coverage

Extensions for PHPStan

Installation

To use this extension, require it in Composer:

composer require --dev slam/phpstan-extensions

Usage

When you are using phpstan/extension-installer, conf/slam-rules.neon will be automatically included.

Otherwise you need to include conf/slam-rules.neon in your phpstan.neon:

includes:
    - vendor/slam/phpstan-extensions/conf/slam-rules.neon

Rules

  1. SlamPhpStan\UnusedVariableRule: check for variable inside functions never used after initial assignment
  2. SlamPhpStan\MissingClosureParameterTypehintRule: requires parameter typehints for closures; WARNING: no PhpDoc allowed, see phpstan/phpstan-strict-rules#87
  3. SlamPhpStan\StringToClassRule: requires strings that refer to classes to be expressed with ::class notation
  4. SlamPhpStan\GotoRule: no goto allowed
  5. SlamPhpStan\ClassNotationRule:
    1. Interfaces must end with "Interface"
    2. Traits must end with "Trait"
    3. Abstract classes must start with "Abstract"
    4. Exceptions must end with "Exception"
  6. SlamPhpStan\PhpUnitFqcnAnnotationRule: classes found in following PHPUnit annotations must exist:
    1. @expectedException
    2. @covers
    3. @coversDefaultClass
    4. @uses
  7. SlamPhpStan\AccessGlobalVariableWithinContextRule: inhibit the access to globals within classes that extend or implement a certain class/interface
  8. SlamPhpStan\AccessStaticPropertyWithinModelContextRule: inhibit the access to static attributes of a class within classes that extend or implement a certain class/interface, useful to prohibit usage of singletons in models

Not-NOW config

A not-now-rules.neon config is present for forbidding raw date system calls:

includes:
    - vendor/slam/phpstan-extensions/conf/not-now-rules.neon

These rules forbid:

  1. new DateTimeImmutable()
  2. new DateTime('yesterday')
  3. date('Y-m-d')
  4. time()
  5. strtotime('noon')

You should instead rely on a clock abstraction like lcobucci/clock.

WARNING: the rules are not perfect, a user can tricks them easily; they are meant only to help the transition to a proper clock abstraction.

Symfony-specific config

A symfony-rules.neon config is present for Symfony projects:

includes:
    - vendor/slam/phpstan-extensions/conf/symfony-rules.neon

With the following configurations:

  1. SlamPhpStan\SymfonyFilesystemRule: forbid calls to raw filesystem functions well wrapped by symfony/filesystem component
  2. SlamPhpStan\SymfonyProcessRule: forbid calls to raw system functions well wrapped by symfony/process component

Yii-specific config

A yii-rules.neon config is present for Yii projects:

includes:
    - vendor/slam/phpstan-extensions/conf/yii-rules.neon

With the following configurations:

  1. SlamPhpStan\AccessGlobalVariableWithinContextRule to deny the usage of $_GET, $_POST and other global variables in models implementing yii\db\ActiveRecordInterface: accessing to singletons in models is considered an anti-pattern
  2. SlamPhpStan\AccessStaticPropertyWithinModelContextRule to deny the usage of yii\BaseYii static variables like $app in models implementing yii\db\ActiveRecordInterface: accessing to singletons in models is considered an anti-pattern
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].