trigger error instead of throwing exception
This commit is contained in:
parent
bf1066294a
commit
5bf406e06a
@ -18,9 +18,22 @@ use D3\DIContainerHandler\d3DicHandler;
|
|||||||
use Symfony\Component\DependencyInjection\Container;
|
use Symfony\Component\DependencyInjection\Container;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @return Container
|
||||||
* @throws d3DicException
|
* @throws d3DicException
|
||||||
*/
|
*/
|
||||||
function d3GetOxidDIC(): Container
|
function d3GetOxidDIC_withExceptions(): Container
|
||||||
{
|
{
|
||||||
return d3DicHandler::getInstance();
|
return d3DicHandler::getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Container
|
||||||
|
*/
|
||||||
|
function d3GetOxidDIC(): Container
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
return d3GetOxidDIC_withExceptions();
|
||||||
|
} catch (d3DicException $exception) {
|
||||||
|
trigger_error($exception->getMessage(), E_USER_ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -35,7 +35,7 @@ class d3DicHandler implements d3DicHandlerInterface
|
|||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get instance
|
* @return Container
|
||||||
* @throws d3DicException
|
* @throws d3DicException
|
||||||
*/
|
*/
|
||||||
public static function getInstance(): Container
|
public static function getInstance(): Container
|
||||||
@ -118,6 +118,8 @@ class d3DicHandler implements d3DicHandlerInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param ContainerBuilder $container
|
||||||
|
* @return void
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function loadFiles(ContainerBuilder $container): void
|
public function loadFiles(ContainerBuilder $container): void
|
||||||
@ -144,6 +146,8 @@ class d3DicHandler implements d3DicHandlerInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param bool $compileAndDump
|
||||||
|
* @return Container
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function buildContainer(bool $compileAndDump = true): Container
|
public function buildContainer(bool $compileAndDump = true): Container
|
||||||
|
@ -15,6 +15,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace D3\DIContainerHandler\tests\autoload;
|
namespace D3\DIContainerHandler\tests\autoload;
|
||||||
|
|
||||||
|
use D3\DIContainerHandler\d3DicException;
|
||||||
use D3\TestingTools\Development\CanAccessRestricted;
|
use D3\TestingTools\Development\CanAccessRestricted;
|
||||||
use Exception;
|
use Exception;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
@ -24,6 +25,20 @@ class functions_oxDICTest extends TestCase
|
|||||||
{
|
{
|
||||||
use CanAccessRestricted;
|
use CanAccessRestricted;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @test
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function d3GetOxidDIC_withExceptionsTest(): void
|
||||||
|
{
|
||||||
|
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
|
||||||
|
|
||||||
|
$this->assertInstanceOf(
|
||||||
|
ContainerBuilder::class,
|
||||||
|
d3GetOxidDIC_withExceptions()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
Loading…
Reference in New Issue
Block a user