Completed
Push — master ( 116d3d...93ea91 )
by Andrii
02:46
created

BumpController::actionMake()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
/*
4
 * Task runner, code generator and build tool for easier continuos integration
5
 *
6
 * @link      https://github.com/hiqdev/hidev
7
 * @package   hidev
8
 * @license   BSD-3-Clause
9
 * @copyright Copyright (c) 2014-2016, HiQDev (http://hiqdev.com/)
10
 */
11
12
namespace hidev\controllers;
13
14
/**
15
 * Controller for version bump.
16
 */
17
class BumpController extends AbstractController
18
{
19
    protected $_before = ['commits'];
20
21
    public $version;
22
23
    public function actionPerform($version = null)
24
    {
25
        $this->version = $version;
26
        return $this->runActions(['before', 'make', 'after']);
27
    }
28
29
    public function actionMake()
30
    {
31
        return $this->runRequests(['commits/bump', 'CHANGELOG.md']);
0 ignored issues
show
Bug Compatibility introduced by
The expression $this->runRequests(array...ump', 'CHANGELOG.md')); of type integer|hidev\controllers\Response adds the type hidev\controllers\Response to the return on line 31 which is incompatible with the return type of the parent method hidev\controllers\AbstractController::actionMake of type null|integer.
Loading history...
32
    }
33
34
    public function actionCommit($version)
35
    {
36
        $message = "version bump to $version";
37
        $this->passthru('git', ['commit', '-am', $message]);
0 ignored issues
show
Documentation introduced by
array('commit', '-am', $message) is of type array<integer,?,{"0":"st...,"1":"string","2":"?"}>, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
38
    }
39
}
40