diff options
author | AndreaChirulescu <andrea.chirulescu@gmail.com> | 2021-05-09 21:58:23 +0200 |
---|---|---|
committer | AndreaChirulescu <andrea.chirulescu@gmail.com> | 2021-05-09 21:58:23 +0200 |
commit | 11570d3e87707396674bdf5179df48c641bb154d (patch) | |
tree | 5c4677689569dbece70de222d1869b4049698f6d /generate-sample-gig-data.php | |
parent | cfc0341c66e5c24ee4c1b8a8e53afac99587244b (diff) | |
parent | 142ff436282844677b8b4e7d8ececd44440ec96d (diff) | |
download | gigologadmin-11570d3e87707396674bdf5179df48c641bb154d.tar.gz gigologadmin-11570d3e87707396674bdf5179df48c641bb154d.tar.bz2 gigologadmin-11570d3e87707396674bdf5179df48c641bb154d.zip |
Tried to fix the psalm local changes done when I manually installed it
Diffstat (limited to 'generate-sample-gig-data.php')
-rw-r--r-- | generate-sample-gig-data.php | 62 |
1 files changed, 50 insertions, 12 deletions
diff --git a/generate-sample-gig-data.php b/generate-sample-gig-data.php index 26ba0cf..11e9a0a 100644 --- a/generate-sample-gig-data.php +++ b/generate-sample-gig-data.php @@ -7,9 +7,9 @@ abstract class GeneratorBase { - abstract public function get(); + abstract public function get() : string; - function pick($arr) + function pick(array $arr) : string { return $arr[array_rand($arr)]; } @@ -17,13 +17,23 @@ abstract class GeneratorBase class BandNameGenerator extends GeneratorBase { - private $prefixes = array( + /** + * @var string[] + * + * @psalm-var array{0: string, 1: string, 2: string} + */ + private array $prefixes = array( "", "a", "the", ); - private $adverbs = array( + /** + * @var string[] + * + * @psalm-var array{0: string, 1: string, 2: string, 3: string, 4: string, 5: string, 6: string, 7: string} + */ + private array $adverbs = array( "bestial", "dead", "incongruent", @@ -34,7 +44,12 @@ class BandNameGenerator extends GeneratorBase "flamboyant", ); - private $verbs = array( + /** + * @var string[] + * + * @psalm-var array{0: string, 1: string, 2: string, 3: string, 4: string, 5: string, 6: string} + */ + private array $verbs = array( "kill", "regurgitat", "destroy", @@ -44,14 +59,19 @@ class BandNameGenerator extends GeneratorBase "mutilat", ); - private $endings = array( + /** + * @var string[] + * + * @psalm-var array{0: string, 1: string, 2: string, 3: string} + */ + private array $endings = array( "er", "ers", "ing", "ed", ); - public function get() + public function get() : string { $parts = array( $this->pick($this->prefixes), @@ -64,7 +84,12 @@ class BandNameGenerator extends GeneratorBase class VenueGenerator extends GeneratorBase { - private $prefix1 = array( + /** + * @var string[] + * + * @psalm-var array{0: string, 1: string, 2: string, 3: string, 4: string} + */ + private array $prefix1 = array( "", "royal", "shabby", @@ -72,7 +97,12 @@ class VenueGenerator extends GeneratorBase "drunken", ); - private $prefix2 = array( + /** + * @var string[] + * + * @psalm-var array{0: string, 1: string, 2: string, 3: string, 4: string, 5: string} + */ + private array $prefix2 = array( "", "music", "fiddler", @@ -81,7 +111,12 @@ class VenueGenerator extends GeneratorBase "mental", ); - private $type = array( + /** + * @var string[] + * + * @psalm-var array{0: string, 1: string, 2: string, 3: string, 4: string, 5: string, 6: string} + */ + private array $type = array( "hall", "museum", "asylum", @@ -91,7 +126,7 @@ class VenueGenerator extends GeneratorBase "lighthouse" ); - public function get() + public function get() : string { $parts = array( $this->pick($this->prefix1), @@ -104,7 +139,10 @@ class VenueGenerator extends GeneratorBase class LinkGenerator extends GeneratorBase { - public function get() + /** + * @return string + */ + public function get() : string { return 'https://example.com/' . bin2hex(random_bytes(8)); } |