Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Support for DI config in PHP file format

Đang mở
#303 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
php
Lĩnh vực
backend, devtools

Hướng nghiên cứu

Start from the PHP configuration examples in the issue, including ContainerConfigurator services, service arguments, factories, parameters, named arguments, and expr() expressions. Done means the plugin can verify these definitions and warn about missing constructor arguments or invalid factory services and methods.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Symfony supports PHP format for configuration (it's even default one now), so it would be great if this plugin could help with verifying DI configs. Assume we have:

class Foo
{
    public function __construct(Bar $bar, Baz $baz)
    {
    }
}
return static function (ContainerConfigurator $containerConfigurator): void {
    $services = $containerConfigurator->services();

    $services->set(Foo::class)
        ->public()
        ->args([Bar::class]);
});

Plugin should warn that Baz $baz argument is missing in the Foo service definition.

Similarly it should support:

  • factories like ->factory([service(FooFactory::class), 'create'])
    • if factory's service exists
    • if factory's class has such method
  • fetching parameters (like ->args(['%foo%']))
  • named args (like ->arg('$bar', service(Bar::class))
  • expressions (using expr())

That would really help with keeping quality in DI definitions with PHP format 🙂

Ngôn ngữ chính
PHP
Star
806
Fork
104
Merge trung bình
2 giờ 52 phút
Pull request đã merge (30 ngày)
4

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

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của phpstan/phpstan-symfony

Tất cả issue của phpstan/phpstan-symfony

Issue tương tự

Thêm issue về PHP

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.