1 | <?php |
||
23 | class SiteAliasFileDiscovery |
||
24 | { |
||
25 | protected $searchLocations = []; |
||
26 | protected $depth = '<= 1'; |
||
27 | |||
28 | /** |
||
29 | * Add a location that alias files may be found. |
||
30 | * |
||
31 | * @param string $path |
||
32 | * @return $this |
||
33 | */ |
||
34 | public function addSearchLocation($path) |
||
41 | |||
42 | /** |
||
43 | * Return all of the paths where alias files may be found. |
||
44 | * @return string[] |
||
45 | */ |
||
46 | public function searchLocations() |
||
50 | |||
51 | |||
52 | /** |
||
53 | * Set the search depth for finding alias files |
||
54 | * |
||
55 | * @param string|int $depth (@see \Symfony\Component\Finder\Finder::depth) |
||
56 | * @return $this |
||
57 | */ |
||
58 | public function depth($depth) |
||
63 | |||
64 | /** |
||
65 | * Find an alias file SITENAME.site.yml in one |
||
66 | * of the specified search locations. |
||
67 | * |
||
68 | * @param string $siteName |
||
69 | * @return string|bool |
||
70 | */ |
||
71 | public function findSingleSiteAliasFile($siteName) |
||
79 | |||
80 | /** |
||
81 | * Return a list of all SITENAME.site.yml files in any of |
||
82 | * the search locations. |
||
83 | * |
||
84 | * @return string[] |
||
85 | */ |
||
86 | public function findAllSingleAliasFiles() |
||
90 | |||
91 | /** |
||
92 | * Return all of the legacy alias files used in previous Drush versions. |
||
93 | * |
||
94 | * @return string[] |
||
95 | */ |
||
96 | public function findAllLegacyAliasFiles() |
||
103 | |||
104 | /** |
||
105 | * Create a Symfony Finder object to search all available search locations |
||
106 | * for the specified search pattern. |
||
107 | * |
||
108 | * @param string $searchPattern |
||
109 | * @return Finder |
||
110 | */ |
||
111 | protected function createFinder($searchPattern) |
||
120 | |||
121 | /** |
||
122 | * Return a list of all alias files matching the provided pattern. |
||
123 | * |
||
124 | * @param string $searchPattern |
||
125 | * @return string[] |
||
126 | */ |
||
127 | protected function searchForAliasFiles($searchPattern) |
||
140 | |||
141 | /** |
||
142 | * Return a list of all alias files with the specified extension. |
||
143 | * |
||
144 | * @param string $filenameExensions |
||
145 | * @return string[] |
||
146 | */ |
||
147 | protected function searchForAliasFilesKeyedByBasenamePrefix($filenameExensions) |
||
162 | |||
163 | // TODO: Seems like this could just be basename() |
||
164 | protected function extractKey($basename, $filenameExensions) |
||
168 | } |
||
169 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.
For example, imagine you have a variable
$accountId
that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theid
property of an instance of theAccount
class. This class holds a proper account, so the id value must no longer be false.Either this assignment is in error or a type check should be added for that assignment.