Issues (11)

src/Progress/ProgressHelper.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Tequilarapido\Consolify\Progress;
4
5
use Symfony\Component\Console\Output\OutputInterface;
6
7
class ProgressHelper
8
{
9
    public static function newProgressInstance($max, $uid, OutputInterface $output)
10
    {
11
        if (! class_exists($progressClass = config('consolify.progress.concrete_class'))) {
12
            throw new \LogicException("Cannot find progress class [$progressClass]");
13
        }
14
15
        $progress = (new $progressClass())
16
            ->setProgressBar($output->createProgressBar($max))
0 ignored issues
show
The method createProgressBar() does not exist on Symfony\Component\Console\Output\OutputInterface. It seems like you code against a sub-type of Symfony\Component\Console\Output\OutputInterface such as Symfony\Component\Console\Style\OutputStyle. ( Ignorable by Annotation )

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

16
            ->setProgressBar($output->/** @scrutinizer ignore-call */ createProgressBar($max))
Loading history...
17
            ->setUid($uid);
18
19
        // Reset progress
20
        $progress->deletePersisted();
21
22
        return $progress;
23
    }
24
25
    /** @return Progress */
26
    public static function progressFor($uid)
27
    {
28
        if (! class_exists($progressClass = config('consolify.progress.concrete_class'))) {
29
            throw new \LogicException("Cannot find progress class [$progressClass]");
30
        }
31
32
        return (new $progressClass())->setUid($uid);
33
    }
34
}
35