All Projects → phpstan → phpstan-webmozart-assert

phpstan / phpstan-webmozart-assert

Licence: other
PHPStan extension for webmozart/assert

Programming Languages

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

Projects that are alternatives of or similar to phpstan-webmozart-assert

phpstan-nette
Nette Framework class reflection extension for PHPStan & framework-specific rules
Stars: ✭ 87 (-34.09%)
Mutual labels:  static-code-analysis, static-analysis, phpstan
Phpstan
PHP Static Analysis Tool - discover bugs in your code without running it!
Stars: ✭ 10,534 (+7880.3%)
Mutual labels:  static-code-analysis, static-analysis, phpstan
Phpstan Phpunit
PHPUnit extensions and rules for PHPStan
Stars: ✭ 247 (+87.12%)
Mutual labels:  static-code-analysis, static-analysis
tryceratops
A linter to prevent exception handling antipatterns in Python (limited only for those who like dinosaurs).
Stars: ✭ 381 (+188.64%)
Mutual labels:  static-code-analysis, static-analysis
lints
Lint all your JavaScript, CSS, HTML, Markdown and Dockerfiles with a single command
Stars: ✭ 14 (-89.39%)
Mutual labels:  static-code-analysis, static-analysis
Revive
🔥 ~6x faster, stricter, configurable, extensible, and beautiful drop-in replacement for golint
Stars: ✭ 3,139 (+2278.03%)
Mutual labels:  static-code-analysis, static-analysis
Dg
[LLVM Static Slicer] Various program analyses, construction of dependence graphs and program slicing of LLVM bitcode.
Stars: ✭ 242 (+83.33%)
Mutual labels:  static-code-analysis, static-analysis
phpstan-extensions
Extensions for PHPStan
Stars: ✭ 61 (-53.79%)
Mutual labels:  static-analysis, phpstan
Pyt
A Static Analysis Tool for Detecting Security Vulnerabilities in Python Web Applications
Stars: ✭ 2,061 (+1461.36%)
Mutual labels:  static-code-analysis, static-analysis
phpstan-wordpress
WordPress extensions for PHPStan ⛏️
Stars: ✭ 182 (+37.88%)
Mutual labels:  static-analysis, phpstan
klara
Automatic test case generation for python and static analysis library
Stars: ✭ 250 (+89.39%)
Mutual labels:  static-code-analysis, static-analysis
Forbidden Apis
Policeman's Forbidden API Checker
Stars: ✭ 216 (+63.64%)
Mutual labels:  static-code-analysis, static-analysis
Spotbugs
SpotBugs is FindBugs' successor. A tool for static analysis to look for bugs in Java code.
Stars: ✭ 2,569 (+1846.21%)
Mutual labels:  static-code-analysis, static-analysis
Warnings Ng Plugin
Jenkins Warnings Plugin - Next Generation
Stars: ✭ 248 (+87.88%)
Mutual labels:  static-code-analysis, static-analysis
Codeclimate
Code Climate CLI
Stars: ✭ 2,273 (+1621.97%)
Mutual labels:  static-code-analysis, static-analysis
duplex
Duplicate code finder for Elixir
Stars: ✭ 20 (-84.85%)
Mutual labels:  static-code-analysis, static-analysis
phpstan
PHP Static Analysis in Github Actions.
Stars: ✭ 41 (-68.94%)
Mutual labels:  static-analysis, phpstan
Phpstan Deprecation Rules
PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and traits.
Stars: ✭ 160 (+21.21%)
Mutual labels:  static-code-analysis, static-analysis
Infer
A static analyzer for Java, C, C++, and Objective-C
Stars: ✭ 12,823 (+9614.39%)
Mutual labels:  static-code-analysis, static-analysis
phpstan-phpspec
PhpSpec extension for PHPStan
Stars: ✭ 19 (-85.61%)
Mutual labels:  static-analysis, phpstan

PHPStan webmozart/assert extension

Build Latest Stable Version License

Description

The main scope of this extension is to help phpstan to detect the type of object after the Webmozart\Assert validation.

<?php declare(strict_types = 1);

use Webmozart\Assert;

function demo(?int $a) {
	// ...

	Assert::integer($a);
	// phpstan is now aware that $a can no longer be `null` at this point

	return ($a === 10);
}

This extension specifies types of values passed to:

  • Assert::integer
  • Assert::positiveInteger
  • Assert::string
  • Assert::stringNotEmpty
  • Assert::float
  • Assert::numeric
  • Assert::natural
  • Assert::integerish
  • Assert::boolean
  • Assert::scalar
  • Assert::object
  • Assert::resource
  • Assert::isCallable
  • Assert::isArray
  • Assert::isTraversable (deprecated, use isIterable or isInstanceOf instead)
  • Assert::isIterable
  • Assert::isCountable
  • Assert::isInstanceOf
  • Assert::isInstanceOfAny
  • Assert::notInstanceOf
  • Assert::isAOf
  • Assert::isAnyOf
  • Assert::isNotA
  • Assert::subclassOf
  • Assert::true
  • Assert::false
  • Assert::notFalse
  • Assert::null
  • Assert::notNull
  • Assert::isEmpty
  • Assert::notEmpty
  • Assert::eq
  • Assert::notEq
  • Assert::same
  • Assert::notSame
  • Assert::greaterThan
  • Assert::greaterThanEq
  • Assert::lessThan
  • Assert::lessThanEq
  • Assert::range
  • Assert::implementsInterface
  • Assert::classExists
  • Assert::interfaceExists
  • Assert::keyExists
  • Assert::keyNotExists
  • Assert::validArrayKey
  • Assert::count
  • Assert::minCount
  • Assert::maxCount
  • Assert::countBetween
  • Assert::isList
  • Assert::isNonEmptyList
  • Assert::isMap
  • Assert::isNonEmptyMap
  • Assert::inArray
  • Assert::oneOf
  • Assert::methodExists
  • Assert::propertyExists
  • Assert::isArrayAccessible
  • Assert::contains
  • Assert::startsWith
  • Assert::startsWithLetter
  • Assert::endsWith
  • Assert::unicodeLetters
  • Assert::alpha
  • Assert::digits
  • Assert::alnum
  • Assert::lower
  • Assert::upper
  • Assert::length
  • Assert::minLength
  • Assert::maxLength
  • Assert::lengthBetween
  • Assert::uuid
  • Assert::ip
  • Assert::ipv4
  • Assert::ipv6
  • Assert::email
  • Assert::notWhitespaceOnly
  • nullOr*, all* and allNullOr* variants of the above methods

Installation

To use this extension, require it in Composer:

composer require --dev phpstan/phpstan-webmozart-assert

If you also install phpstan/extension-installer then you're all set!

Manual installation

If you don't want to use phpstan/extension-installer, include extension.neon in your project's PHPStan config:

includes:
    - vendor/phpstan/phpstan-webmozart-assert/extension.neon
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].