PHPackages                             mehr-als-nix/preconditions - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mehr-als-nix/preconditions

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mehr-als-nix/preconditions
==========================

Preconditions for PHP

v0.0.3(10y ago)123MITPHPPHP &gt;=5.6

Since Oct 31Pushed 10y ago2 watchersCompare

[ Source](https://github.com/MehrAlsNix/Preconditions)[ Packagist](https://packagist.org/packages/mehr-als-nix/preconditions)[ Docs](http://mehralsnix.github.io/Preconditions/)[ RSS](/packages/mehr-als-nix-preconditions/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (5)Used By (0)

Preconditions
=============

[](#preconditions)

[![Build Status](https://camo.githubusercontent.com/3188e7d7e3c806d0a14553fc1751b5bae9524e60059802676fd62f6c217df8af/68747470733a2f2f7472617669732d63692e6f72672f4d656872416c734e69782f507265636f6e646974696f6e732e7376673f6272616e63683d646576656c6f70)](https://travis-ci.org/MehrAlsNix/Preconditions)

Preconditions are meant to be an alternative way to ensure that a precondition for a specific method is given.

Available checks
----------------

[](#available-checks)

- checkArgument()
- checkArgNotNull()
- checkNotNull()
- checkElementIndex()
- checkPositionIndex()
- checkPositionIndexes()
- checkState()
- checkValue()

Additional exceptions
---------------------

[](#additional-exceptions)

- IndexOutOfBoundsException
- NullPointerException
- IllegalStateException

Example
-------

[](#example)

Instead of writing

```
    if ($count
