ParameterBagInterface::get() with ServiceSubscriberInterface
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 28/100
Hướng nghiên cứu
Start by reproducing the example around ParameterBagInterface::get(), ContainerInterface::get(), and ServiceSubscriberInterface::getSubscribedServices(). Trace how the Symfony extension infers the service type from the subscription, then verify that the container-provided parameter bag reports the expected string return type for get('kernel.project_dir').
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hello,
Since #192 (fix #191), the return type for ParameterBagInterface::get() works with dependency injection but not with ServiceSubscriberInterface :
namespace App\Issue;
use Psr\Container\ContainerInterface;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Contracts\Service\ServiceSubscriberInterface;
class Issue implements ServiceSubscriberInterface
{
public function __construct(protected ContainerInterface $container, protected ParameterBagInterface $parameterBag)
{
}
public function test(): void
{
$parameterBagFromConstructor = $this->parameterBag;
// Expected: Dumped type: Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface
// Observed: Dumped type: Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface
\PHPStan\dumpType($parameterBagFromConstructor);
$parameterBagFromContainer = $this->container->get(ParameterBagInterface::class);
// Expected: Dumped type: Symfony\Component\DependencyInjection\ParameterBag\ContainerBag
// Observed: Dumped type: Symfony\Component\DependencyInjection\ParameterBag\ContainerBag
\PHPStan\dumpType($parameterBagFromContainer);
$parameterFromConstructor = $parameterBagFromConstructor->get('kernel.project_dir');
// Expected: Dumped type: string
// Observed: Dumped type: string
\PHPStan\dumpType($parameterFromConstructor);
$parameterFromContainer = $parameterBagFromContainer->get('kernel.project_dir');
// Expected: Dumped type: string
// Observed: Dumped type: array|bool|float|int|string|UnitEnum|null
\PHPStan\dumpType($parameterFromContainer);
}
public static function getSubscribedServices(): array
{
return [
ParameterBagInterface::class,
];
}
}
Is there a solution for add the support of ParameterBagInterface::get() with ServiceSubscriberInterface ?
Thanks
- Ngôn ngữ chính
- PHP
- Star
- 806
- Fork
- 105
- Merge trung bình
- 1 giờ 55 phút
- Pull request đã merge (30 ngày)
- 6
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của phpstan/phpstan-symfony
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
phpstan/phpstan-symfony#510 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
phpstan/phpstan-symfony#494 · 5 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
phpstan/phpstan-symfony#268 ·
-
Account for `\ErrorException` from `unserialize()` when Symfony’s PHP error conversion is enabledĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
phpstan/phpstan-symfony#514 · 2 bình luận ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
phpstan/phpstan-symfony#509 · 2 bình luận ·
Tất cả issue của phpstan/phpstan-symfony
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
MagnaCapax/PMSS#1206 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
backdrop-contrib/print#58 ·
-
`openssl_pkcs7_read()` / `openssl_cms_read()`: CRLs overwrite certificates in the output arrayĐang mởBug Status: Needs Triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày