시니어
2026년 10월 4일

버그를 찾아라: Laravel

코드 한 조각. 버그를 찾거나, 버그가 없음을 증명하세요.

php
1<?php
2
3namespace App\Payments;
4
5interface PaymentGatewayFactoryInterface
6{
7    public function create(): PaymentGatewayInterface;
8}
9
10class StripeGatewayFactory implements PaymentGatewayFactoryInterface
11{
12    public function create(): PaymentGatewayInterface
13    {
14        return new StripeGateway(config('services.stripe.secret'));
15    }
16}
17
18class PaymentService
19{
20    public function __construct(private PaymentGatewayFactoryInterface $factory) {}
21
22    public function charge(int $cents): void
23    {
24        $this->factory->create()->charge($cents);
25    }
26}
27

문제가 되는 줄을 클릭하세요.

당신의 판단

하루 한 번. 제출하면 바로 정답이 표시됩니다.

연속 기록 유지하기

계정을 만들면 연속 기록을 유지하고 진행 상황을 추적할 수 있습니다.

계정 만들기