|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Automation tool mixed with code generator for easier continuous development |
|
4
|
|
|
* |
|
5
|
|
|
* @link https://github.com/hiqdev/hidev |
|
6
|
|
|
* @package hidev |
|
7
|
|
|
* @license BSD-3-Clause |
|
8
|
|
|
* @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/) |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace hidev\controllers; |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* Controller for Git. |
|
15
|
|
|
*/ |
|
16
|
|
|
class GitController extends VcsController |
|
17
|
|
|
{ |
|
18
|
|
|
protected $_before = ['.gitignore']; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* @var string current tag |
|
22
|
|
|
*/ |
|
23
|
|
|
protected $tag; |
|
24
|
|
|
|
|
25
|
|
|
public function actionRelease($version = null) |
|
26
|
|
|
{ |
|
27
|
|
|
$version = $this->takeGoal('version')->getVersion($version); |
|
28
|
|
|
$message = "version bump to $version"; |
|
29
|
|
|
$this->actionCommit($message); |
|
30
|
|
|
$this->actionTag($version); |
|
31
|
|
|
|
|
32
|
|
|
return $this->actionPush(); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
public function actionCommit($message) |
|
36
|
|
|
{ |
|
37
|
|
|
return $this->passthru('git', ['commit', '-am', $message]); |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
public function actionTag($tag) |
|
41
|
|
|
{ |
|
42
|
|
|
return $this->passthru('git', ['tag', $tag]); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
public function actionPush() |
|
46
|
|
|
{ |
|
47
|
|
|
return $this->passthru('git', 'push', '--tags'); |
|
|
|
|
|
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
public function getUserName() |
|
51
|
|
|
{ |
|
52
|
|
|
return trim(`git config --get user.name`); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
public function getUserEmail() |
|
56
|
|
|
{ |
|
57
|
|
|
return trim(`git config --get user.email`); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
public function getYear() |
|
61
|
|
|
{ |
|
62
|
|
|
$date = `git log --reverse --pretty=%ai | head -n 1`; |
|
63
|
|
|
$year = $date ? date('Y', strtotime($date)) : ''; |
|
64
|
|
|
|
|
65
|
|
|
return $year; |
|
66
|
|
|
} |
|
67
|
|
|
} |
|
68
|
|
|
|
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignorePhpDoc annotation to the duplicate definition and it will be ignored.