Static code analysis tool to detect weak assumptions

0.8.0 2019-04-04 07:11 UTC

This package is auto-updated.

Last update: 2021-12-04 13:14:51 UTC


Build Status Scrutinizer Code Quality Code Coverage


$ composer require --dev rskuipers/php-assumptions


PHP Assumptions is the result of a proof of concept inspired by the "From assumptions to assertions" blog post. It's a static code analysis tool doing checks for weak assumptions.

This is an example of an assumption:

if ($user !== null) {

Running bin/phpa on this file would yield the following output:

| file        | line | message               |
| example.php | 3    | if ($user !== null) { |

1 out of 1 boolean expressions are assumptions (100%)

This is an example of an assertion:

if ($user instanceof User) {


This project is built with PHPUnit and Prophecy. In order to run these tests make sure you have dev dependencies installed with composer.

Running PHPUnit:

$ ./vendor/bin/phpunit