Senior
4 de octubre de 2026Encuentra el bug: Laravel
Un fragmento de código. Encuentra el bug, o demuestra que no hay ninguno.
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}
27Haz clic en las líneas que causan el problema.
Tu veredicto
Un intento por día. La respuesta aparece justo después.
Mantén tu racha
Crea una cuenta para conservar tu racha y seguir tu progreso.