Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit594cdf6

Browse files
committed
1 parent4981859 commit594cdf6

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

‎src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckTypeDeclarationsPassTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
useSymfony\Component\DependencyInjection\Definition;
2121
useSymfony\Component\DependencyInjection\Exception\InvalidArgumentException;
2222
useSymfony\Component\DependencyInjection\Exception\InvalidParameterTypeException;
23+
useSymfony\Component\DependencyInjection\Parameter;
2324
useSymfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag;
2425
useSymfony\Component\DependencyInjection\Reference;
2526
useSymfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\Bar;
@@ -28,6 +29,8 @@
2829
useSymfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\BarOptionalArgument;
2930
useSymfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\BarOptionalArgumentNotNull;
3031
useSymfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\Deprecated;
32+
useSymfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\ExpectsIntegerArgument;
33+
useSymfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\ExpectsIntegerArgumentWrapper;
3134
useSymfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\Foo;
3235
useSymfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\FooObject;
3336
useSymfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\IntersectionConstructor;
@@ -642,6 +645,27 @@ public function testProcessSuccessWhenExpressionReturnsObject()
642645
$this->addToAssertionCount(1);
643646
}
644647

648+
publicfunctiontestErrorOnEvaluatingExpressionDoesNotStopTheProcess()
649+
{
650+
$container =newContainerBuilder(newEnvPlaceholderParameterBag([
651+
'some_int' =>'%env(SOME_INT)%',
652+
]));
653+
654+
$container
655+
->register('eia', ExpectsIntegerArgument::class)
656+
->setPublic(true)
657+
->setShared(false)
658+
->setFactory([ExpectsIntegerArgument::class,'create'])
659+
->addArgument(newParameter('some_int'));
660+
$container
661+
->register('eia_wrapper', ExpectsIntegerArgumentWrapper::class)
662+
->addArgument(newExpression('service("eia").instance()'));
663+
664+
(newCheckTypeDeclarationsPass(true))->process($container);
665+
666+
$this->addToAssertionCount(1);
667+
}
668+
645669
publicfunctiontestProcessHandleMixedEnvPlaceholder()
646670
{
647671
$container =newContainerBuilder(newEnvPlaceholderParameterBag([
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespaceSymfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass;
6+
7+
finalreadonlyclass ExpectsIntegerArgument
8+
{
9+
publicfunction__construct(publicint$foo) {}
10+
11+
publicstaticfunctioncreate(int$foo):self
12+
{
13+
returnnewself($foo);
14+
}
15+
16+
publicfunctioninstance():self {
17+
return$this;
18+
}
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespaceSymfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass;
6+
7+
finalreadonlyclass ExpectsIntegerArgumentWrapper
8+
{
9+
publicfunction__construct(publicExpectsIntegerArgument$b) {}
10+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp