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 declare(strict_types=1); /** * This file is part of the Carbon package. * * (c)..
Decoded Output download
<?php
declare(strict_types=1);
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Tests\CarbonImmutable;
use Carbon\CarbonImmutable as Carbon;
use Carbon\Traits\Creator;
use DateTime;
use Tests\AbstractTestCase;
class LastErrorTest extends AbstractTestCase
{
/**
* @var array
*/
protected $lastErrors;
/**
* @var array
*/
protected $noErrors;
protected function setUp(): void
{
parent::setUp();
$this->noErrors = [
'warning_count' => 0,
'warnings' => [],
'error_count' => 0,
'errors' => [],
];
$this->lastErrors = [
'warning_count' => 1,
'warnings' => ['11' => 'The parsed date was invalid'],
'error_count' => 0,
'errors' => [],
];
}
public function testCreateHandlesLastErrors()
{
$carbon = new Carbon('2017-02-30');
$datetime = new DateTime('2017-02-30');
$this->assertSame($this->lastErrors, $carbon->getLastErrors());
$this->assertSame($carbon->getLastErrors(), $datetime->getLastErrors());
$carbon = new Carbon('2017-02-15');
$this->assertSame($this->noErrors, $carbon->getLastErrors());
}
public function testLastErrorsInitialization()
{
$obj = new class() {
use Creator;
/** @phpstan-ignore-next-line */
public function __construct($time = null, $tz = null)
{
}
public function triggerError()
{
self::setLastErrors(false);
}
};
$this->assertFalse($obj::getLastErrors());
$obj->triggerError();
$this->assertSame([
'warning_count' => 0,
'warnings' => [],
'error_count' => 0,
'errors' => [],
], $obj::getLastErrors());
}
}
?>
Did this file decode correctly?
Original Code
<?php
declare(strict_types=1);
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Tests\CarbonImmutable;
use Carbon\CarbonImmutable as Carbon;
use Carbon\Traits\Creator;
use DateTime;
use Tests\AbstractTestCase;
class LastErrorTest extends AbstractTestCase
{
/**
* @var array
*/
protected $lastErrors;
/**
* @var array
*/
protected $noErrors;
protected function setUp(): void
{
parent::setUp();
$this->noErrors = [
'warning_count' => 0,
'warnings' => [],
'error_count' => 0,
'errors' => [],
];
$this->lastErrors = [
'warning_count' => 1,
'warnings' => ['11' => 'The parsed date was invalid'],
'error_count' => 0,
'errors' => [],
];
}
public function testCreateHandlesLastErrors()
{
$carbon = new Carbon('2017-02-30');
$datetime = new DateTime('2017-02-30');
$this->assertSame($this->lastErrors, $carbon->getLastErrors());
$this->assertSame($carbon->getLastErrors(), $datetime->getLastErrors());
$carbon = new Carbon('2017-02-15');
$this->assertSame($this->noErrors, $carbon->getLastErrors());
}
public function testLastErrorsInitialization()
{
$obj = new class() {
use Creator;
/** @phpstan-ignore-next-line */
public function __construct($time = null, $tz = null)
{
}
public function triggerError()
{
self::setLastErrors(false);
}
};
$this->assertFalse($obj::getLastErrors());
$obj->triggerError();
$this->assertSame([
'warning_count' => 0,
'warnings' => [],
'error_count' => 0,
'errors' => [],
], $obj::getLastErrors());
}
}
Function Calls
None |
Stats
MD5 | c8689c4566b161c8fa8058907b0833a2 |
Eval Count | 0 |
Decode Time | 116 ms |