1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Robo\Task\Development; |
4
|
|
|
|
5
|
|
|
trait loadTasks |
6
|
|
|
{ |
7
|
|
|
/** |
8
|
|
|
* @param string $filename |
9
|
|
|
* |
10
|
|
|
* @return \Robo\Task\Development\Changelog|\Robo\Collection\CollectionBuilder |
11
|
|
|
*/ |
12
|
|
|
protected function taskChangelog($filename = 'CHANGELOG.md') |
13
|
|
|
{ |
14
|
|
|
return $this->task(Changelog::class, $filename); |
|
|
|
|
15
|
|
|
} |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @param string $filename |
19
|
|
|
* |
20
|
|
|
* @return \Robo\Task\Development\GenerateMarkdownDoc|\Robo\Collection\CollectionBuilder |
21
|
|
|
*/ |
22
|
|
|
protected function taskGenDoc($filename) |
23
|
|
|
{ |
24
|
|
|
return $this->task(GenerateMarkdownDoc::class, $filename); |
|
|
|
|
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @param string $className |
29
|
|
|
* @param string $wrapperClassName |
30
|
|
|
* |
31
|
|
|
* @return \Robo\Task\Development\GenerateTask|\Robo\Collection\CollectionBuilder |
32
|
|
|
*/ |
33
|
|
|
protected function taskGenTask($className, $wrapperClassName = '') |
34
|
|
|
{ |
35
|
|
|
return $this->task(GenerateTask::class, $className, $wrapperClassName); |
|
|
|
|
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @param string $pathToSemVer |
40
|
|
|
* |
41
|
|
|
* @return \Robo\Task\Development\SemVer|\Robo\Collection\CollectionBuilder |
42
|
|
|
*/ |
43
|
|
|
protected function taskSemVer($pathToSemVer = '.semver') |
44
|
|
|
{ |
45
|
|
|
return $this->task(SemVer::class, $pathToSemVer); |
|
|
|
|
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @param int $port |
50
|
|
|
* |
51
|
|
|
* @return \Robo\Task\Development\PhpServer|\Robo\Collection\CollectionBuilder |
52
|
|
|
*/ |
53
|
|
|
protected function taskServer($port = 8000) |
54
|
|
|
{ |
55
|
|
|
return $this->task(PhpServer::class, $port); |
|
|
|
|
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @param string $filename |
60
|
|
|
* |
61
|
|
|
* @return \Robo\Task\Development\PackPhar|\Robo\Collection\CollectionBuilder |
62
|
|
|
*/ |
63
|
|
|
protected function taskPackPhar($filename) |
64
|
|
|
{ |
65
|
|
|
return $this->task(PackPhar::class, $filename); |
|
|
|
|
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @param string $tag |
70
|
|
|
* |
71
|
|
|
* @return \Robo\Task\Development\GitHubRelease|\Robo\Collection\CollectionBuilder |
72
|
|
|
*/ |
73
|
|
|
protected function taskGitHubRelease($tag) |
74
|
|
|
{ |
75
|
|
|
return $this->task(GitHubRelease::class, $tag); |
|
|
|
|
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @param string|array $url |
80
|
|
|
* |
81
|
|
|
* @return \Robo\Task\Development\OpenBrowser|\Robo\Collection\CollectionBuilder |
82
|
|
|
*/ |
83
|
|
|
protected function taskOpenBrowser($url) |
84
|
|
|
{ |
85
|
|
|
return $this->task(OpenBrowser::class, $url); |
|
|
|
|
86
|
|
|
} |
87
|
|
|
} |
88
|
|
|
|
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idable
provides a methodequalsId
that in turn relies on the methodgetId()
. If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()
as an abstract method to the trait will make sure it is available.