1 | <?php |
||
19 | class CheckComposerUpdatesTask extends BuildTask |
||
|
|||
20 | { |
||
21 | /** |
||
22 | * @var string |
||
23 | */ |
||
24 | protected $title = 'Composer update checker'; |
||
25 | |||
26 | /** |
||
27 | * @var string |
||
28 | */ |
||
29 | protected $description = 'Checks if any composer dependencies can be updated.'; |
||
30 | |||
31 | private static $dependencies = [ |
||
32 | 'ComposerLoader' => '%$BringYourOwnIdeas\\Maintenance\\Util\\ComposerLoader', |
||
33 | 'UpdateChecker' => '%$BringYourOwnIdeas\\UpdateChecker\\UpdateChecker', |
||
34 | ]; |
||
35 | |||
36 | /** |
||
37 | * The "types" of composer libraries that will be processed. Anything without these types will be ignored. |
||
38 | * |
||
39 | * @config |
||
40 | * @var array |
||
41 | */ |
||
42 | private static $allowed_types = [ |
||
43 | 'silverstripe-module', |
||
44 | 'silverstripe-vendormodule', |
||
45 | 'silverstripe-theme', |
||
46 | ]; |
||
47 | |||
48 | /** |
||
49 | * @var ComposerLoader |
||
50 | */ |
||
51 | protected $composerLoader; |
||
52 | |||
53 | /** |
||
54 | * @var UpdateChecker |
||
55 | */ |
||
56 | protected $updateChecker; |
||
57 | |||
58 | /** |
||
59 | * Runs the actual steps to verify if there are updates available |
||
60 | * |
||
61 | * @param SS_HTTPRequest $request |
||
62 | */ |
||
63 | public function run($request) |
||
77 | |||
78 | /** |
||
79 | * Retrieve an array of primary composer dependencies from composer.json. |
||
80 | * |
||
81 | * Packages are filtered by allowed type. |
||
82 | * |
||
83 | * @return array[] |
||
84 | */ |
||
85 | protected function getPackages() |
||
112 | |||
113 | /** |
||
114 | * Find all dependency constraints for the given package in the current repository and return the strictest one |
||
115 | * |
||
116 | * @param BaseRepository $repository |
||
117 | * @param string $packageName |
||
118 | * @return string |
||
119 | */ |
||
120 | protected function getInstalledConstraint(BaseRepository $repository, $packageName) |
||
133 | |||
134 | /** |
||
135 | * Check whether the package type is "allowed", which will include it in reports. If the type is not allowed |
||
136 | * then the package will be skipped. |
||
137 | * |
||
138 | * @param string $type |
||
139 | * @return bool |
||
140 | */ |
||
141 | protected function isAllowedType($type) |
||
147 | |||
148 | /** |
||
149 | * prints a message during the run of the task |
||
150 | * |
||
151 | * @param string $text |
||
152 | */ |
||
153 | protected function message($text) |
||
161 | |||
162 | /** |
||
163 | * @param ComposerLoader $composerLoader |
||
164 | * @return $this |
||
165 | */ |
||
166 | public function setComposerLoader(ComposerLoader $composerLoader) |
||
171 | |||
172 | /** |
||
173 | * @return ComposerLoader |
||
174 | */ |
||
175 | public function getComposerLoader() |
||
179 | |||
180 | /** |
||
181 | * @param UpdateChecker $updateChecker |
||
182 | * @return $this |
||
183 | */ |
||
184 | public function setUpdateChecker(UpdateChecker $updateChecker) |
||
189 | |||
190 | /** |
||
191 | * @return UpdateChecker |
||
192 | */ |
||
193 | public function getUpdateChecker() |
||
197 | } |
||
198 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.