Issues (19)

src/Command/ExpireCommand.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Terox\SubscriptionBundle\Command;
4
5
use Symfony\Component\Console\Input\InputArgument;
6
use Terox\SubscriptionBundle\Model\SubscriptionInterface;
7
use Terox\SubscriptionBundle\TeroxSubscriptionBundle;
8
9
class ExpireCommand extends AbstractCommand
10
{
11
    /**
12
     * {@inheritdoc}
13
     */
14 1
    protected function configure()
15
    {
16 1
        parent::configure();
17
18
        $this
19 1
            ->setName(TeroxSubscriptionBundle::COMMAND_NAMESPACE.':expire')
20 1
            ->setDescription('Expire a subscription')
21 1
            ->addArgument(
22 1
                'reason',
23 1
                InputArgument::OPTIONAL,
24 1
                'Reason of expiration',
25 1
                'expired'
26
            );
27 1
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32 1
    protected function action(SubscriptionInterface $subscription)
33
    {
34 1
        $reason = $this->input->getArgument('reason');
35
36 1
        $this->getManager()->expire($subscription, $reason);
0 ignored issues
show
It seems like $reason can also be of type string[]; however, parameter $reason of Terox\SubscriptionBundle...iptionManager::expire() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

36
        $this->getManager()->expire($subscription, /** @scrutinizer ignore-type */ $reason);
Loading history...
37
38 1
        $this->output->writeln(sprintf('Expired subscription'));
39 1
    }
40
}
41