PHP7 type annotations

This commit is contained in:
Shish
2017-09-19 18:55:43 +01:00
parent c7ca2f4154
commit 977c3db1e3
98 changed files with 624 additions and 1986 deletions

View File

@@ -16,11 +16,7 @@ class AddAliasEvent extends Event {
/** @var string */
public $newtag;
/**
* @param string $oldtag
* @param string $newtag
*/
public function __construct($oldtag, $newtag) {
public function __construct(string $oldtag, string $newtag) {
$this->oldtag = trim($oldtag);
$this->newtag = trim($newtag);
}
@@ -131,11 +127,7 @@ class AliasEditor extends Extension {
}
}
/**
* @param Database $database
* @return string
*/
private function get_alias_csv(Database $database) {
private function get_alias_csv(Database $database): string {
$csv = "";
$aliases = $database->get_pairs("SELECT oldtag, newtag FROM aliases ORDER BY newtag");
foreach($aliases as $old => $new) {
@@ -144,11 +136,7 @@ class AliasEditor extends Extension {
return $csv;
}
/**
* @param Database $database
* @param string $csv
*/
private function add_alias_csv(Database $database, /*string*/ $csv) {
private function add_alias_csv(Database $database, string $csv) {
$csv = str_replace("\r", "\n", $csv);
foreach(explode("\n", $csv) as $line) {
$parts = str_getcsv($line);
@@ -170,9 +158,8 @@ class AliasEditor extends Extension {
* Add alias *after* mass tag editing, else the MTE will
* search for the images and be redirected to the alias,
* missing out the images tagged with the old tag.
*
* @return int
*/
public function get_priority() {return 60;}
public function get_priority(): int {return 60;}
}