Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php namespace AbortTests; use function PHPStan\Testing\assertType; use function PHPSta..

Decoded Output download

<?php

namespace AbortTests;

use function PHPStan\TestingssertType;
use function PHPStan\TestingssertVariableCertainty;

function test(?int $foo): void
{
    if ($foo > 0) {
        $operator = '+';
    } elseif ($value < 0) {
        $operator = '-';
    } else {
        abort(422);
    }

    // Should not complain about $operator possibly not being defined
    assertVariableCertainty(
        \PHPStan\TrinaryLogic::createYes(),
        $operator
    );

    abort_if(! $foo, 500);
    assertType('int<min, -1>|int<1, max>', $foo);

    /** @var int|string $foo */
    abort_if(is_string($foo), 500);
    assertType('int', $foo);

    /** @var ?int $foo */
    abort_unless(! is_null($foo), 500);
    assertType('int', $foo);

    /** @var int|string $foo */
    abort_unless(! is_string($foo), 500);
    assertType('int', $foo);
}
 ?>

Did this file decode correctly?

Original Code

<?php

namespace AbortTests;

use function PHPStan\Testing\assertType;
use function PHPStan\Testing\assertVariableCertainty;

function test(?int $foo): void
{
    if ($foo > 0) {
        $operator = '+';
    } elseif ($value < 0) {
        $operator = '-';
    } else {
        abort(422);
    }

    // Should not complain about $operator possibly not being defined
    assertVariableCertainty(
        \PHPStan\TrinaryLogic::createYes(),
        $operator
    );

    abort_if(! $foo, 500);
    assertType('int<min, -1>|int<1, max>', $foo);

    /** @var int|string $foo */
    abort_if(is_string($foo), 500);
    assertType('int', $foo);

    /** @var ?int $foo */
    abort_unless(! is_null($foo), 500);
    assertType('int', $foo);

    /** @var int|string $foo */
    abort_unless(! is_string($foo), 500);
    assertType('int', $foo);
}

Function Calls

None

Variables

None

Stats

MD5 61a4ecfc77bd1c3b8ead462d89cc6bf8
Eval Count 0
Decode Time 86 ms