diff options
Diffstat (limited to 'includes/venue.php')
-rw-r--r-- | includes/venue.php | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/includes/venue.php b/includes/venue.php index f6f46b2..be61272 100644 --- a/includes/venue.php +++ b/includes/venue.php @@ -28,7 +28,7 @@ if ( !class_exists('GiglogAdmin_Venue') ) { $this->webpage = isset($attrs->wpgvenue_webpage) ? $attrs->wpgvenue_webpage : NULL; } - static function create($name, $city = 'Oslo') + static function create($name, $city = 'Oslo'): self { $venue = new GiglogAdmin_Venue((object) [ 'wpgvenue_name' => $name, @@ -43,7 +43,7 @@ if ( !class_exists('GiglogAdmin_Venue') ) { return $venue; } - static function find_or_create($name, $city = 'Oslo') + static function find_or_create(string $name, string $city = 'Oslo'): self { global $wpdb; $venuesql = 'SELECT * FROM wpg_venues WHERE upper(wpgvenue_name)=upper("' . $name . '")'.' and wpgvenue_city="'.$city.'"'; @@ -61,7 +61,7 @@ if ( !class_exists('GiglogAdmin_Venue') ) { } } - static function all_cities() + static function all_cities(): array { global $wpdb; $results = $wpdb->get_results('select distinct wpgvenue_city from wpg_venues'); @@ -69,7 +69,12 @@ if ( !class_exists('GiglogAdmin_Venue') ) { return array_map(function ($r) { return $r->wpgvenue_city; }, $results); } - static function all_venues() + /** + * @return self[] + * + * @psalm-return array<array-key, self> + */ + static function all_venues(): array { global $wpdb; @@ -79,7 +84,12 @@ if ( !class_exists('GiglogAdmin_Venue') ) { } - static function venues_in_city($city) + /** + * @return self[] + * + * @psalm-return array<array-key, self> + */ + static function venues_in_city(string $city): array { global $wpdb; $q = $wpdb->prepare( @@ -89,7 +99,7 @@ if ( !class_exists('GiglogAdmin_Venue') ) { return array_map(function ($r) { return new GiglogAdmin_Venue($r); }, $results); } - public function save() + public function save(): void { global $wpdb; |