2017 © Pedro Peláez
 

library assert

Assert helper.

image

czproject/assert

Assert helper.

  • Sunday, June 24, 2018
  • by janpecha
  • Repository
  • 1 Watchers
  • 0 Stars
  • 163 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 20 % Grown

The README.md

CzProject\Assert

Build Status Downloads this Month Latest Stable Version License, (*1)

Assert helper, throws exceptions., (*2)

Donate, (*3)

Installation

Download a latest package or use Composer:, (*4)

composer require czproject/assert

CzProject\Assert requires PHP 8.0 or later., (*5)

Usage

``` php use CzProject\Assert\Assert;, (*6)

function add($a, $b) { Assert::int($a); Assert::int($b); return $a + $b; }, (*7)


* `assert($value, $msg = NULL)` - checks if value is `TRUE` * `bool($value, $msg = NULL)` - checks if value is `bool` * `int($value, $msg = NULL)` - checks if value is `int` * `intOrNull($value, $msg = NULL)` - checks if value is `int|NULL` * `float($value, $msg = NULL)` - checks if value is `float` * `floatOrNull($value, $msg = NULL)` - checks if value is `float|NULL` * `number($value, $msg = NULL)` - checks if value is `float|int` * `numberOrNull($value, $msg = NULL)` - checks if value is `float|int|NULL` * `string($value, $msg = NULL)` - checks if value is `string` * `stringOrNull($value, $msg = NULL)` - checks if value is `string|NULL` * `type($value, $type, $msg = NULL)` - checks if value is instance of given type * `typeOrNull($value, $type, $msg = NULL)` - checks if value is instance of given type or `NULL` * `null($value, $msg = NULL)` - checks if value is `NULL` * `in($value, $arr, $msg = NULL)` - checks if value is in array * `inArray($value, $arr, $msg = NULL)` - alias for `Assert::in()` ## PhpStan extension ```neon services: - class: CzProject\Assert\Bridges\PhpStan\StaticMethodTypeSpecifyingExtension tags: - phpstan.typeSpecifier.staticMethodTypeSpecifyingExtension

License: New BSD License
Author: Jan Pecha, https://www.janpecha.cz/, (*8)

The Versions

24/06 2018

dev-master

9999999-dev

Assert helper.

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.4.0

 

The Development Requires

24/06 2018

v1.2.0

1.2.0.0

Assert helper.

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.4.0

 

The Development Requires

21/03 2018

v1.1.0

1.1.0.0

Assert helper.

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.4.0

 

The Development Requires

09/09 2017

v1.0.0

1.0.0.0

Assert helper.

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.4.0

 

The Development Requires