diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2021-05-08 21:03:29 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2021-05-08 21:03:29 +0200 |
commit | 7d17f220e52d683f849a1854278a9bd47af17dd2 (patch) | |
tree | 3fed3ff2c6ab28c397a929a02e56d238ca40ed6d /includes/public | |
parent | ee9bef751805ac3f3c9572d1620f2221092b3094 (diff) | |
parent | 30f12e61317d9b181efb46382a4db98d73f65954 (diff) | |
download | gigologadmin-7d17f220e52d683f849a1854278a9bd47af17dd2.tar.gz gigologadmin-7d17f220e52d683f849a1854278a9bd47af17dd2.tar.bz2 gigologadmin-7d17f220e52d683f849a1854278a9bd47af17dd2.zip |
Merge branch 'psalm' into dev
This brings another tool in to help us keep the code in order - Psalm.
(I thought the name was fitting! :)
This will do fairly simple static analysis of the code, and report
problems and suggest fixes. It can help fix some issues itself, but
please double check that it does the right thing.
More info: https://psalm.dev
This merge also brings in fixes that was suggested by Paslm. Mostly this
is typa annotations for functions, but also some bugfixes discovered by
the tool.
Diffstat (limited to 'includes/public')
4 files changed, 17 insertions, 11 deletions
diff --git a/includes/public/shortcodes/giglog_bands.php b/includes/public/shortcodes/giglog_bands.php index 78fd72b..e4fe71d 100644 --- a/includes/public/shortcodes/giglog_bands.php +++ b/includes/public/shortcodes/giglog_bands.php @@ -10,7 +10,7 @@ * builds the table with concerts */ -function giglogadmin_getfilters() +function giglogadmin_getfilters(): string { global $wpdb; @@ -59,7 +59,7 @@ function giglogadmin_getfilters() } -function giglogadmin_getconcerts() +function giglogadmin_getconcerts(): string { global $wpdb; // Shortcodes RETURN content, so store in a variable to return diff --git a/includes/public/shortcodes/giglog_display_unprocessed.php b/includes/public/shortcodes/giglog_display_unprocessed.php index aa3596c..90ef69f 100644 --- a/includes/public/shortcodes/giglog_display_unprocessed.php +++ b/includes/public/shortcodes/giglog_display_unprocessed.php @@ -16,7 +16,7 @@ * gone through the processing process - aka fetching each line and * transforming it into a concert line */ -function giglogadmin_getunprocessed() +function giglogadmin_getunprocessed(): string { global $wpdb; @@ -42,7 +42,7 @@ function giglogadmin_getunprocessed() * venue exists. If they don't, they get created, if they do, their ID from * their table is fetchd and used in concerts table */ -function giglogadmin_insertconcerts() +function giglogadmin_insertconcerts(): string { global $wpdb; $concertlist = '<p>Inserted the following:</p>'; @@ -128,7 +128,7 @@ function giglogadmin_insertconcerts() return $concertlist; } -function giglogadmin_display_unprocessed() { +function giglogadmin_display_unprocessed(): string { $output = giglogadmin_getunprocessed(); $output .= '<form method="POST" action=""><input type="submit" name="ProcessConcerts" value="ProcessConcerts"/></form>'; diff --git a/includes/public/shortcodes/giglog_photographers.php b/includes/public/shortcodes/giglog_photographers.php index 500445a..829c53e 100644 --- a/includes/public/shortcodes/giglog_photographers.php +++ b/includes/public/shortcodes/giglog_photographers.php @@ -10,7 +10,7 @@ * Admin users also control concert statuses here */ -function giglogadmin_assignconcert($p1, $c) +function giglogadmin_assignconcert($p1, $c): void { global $wpdb; @@ -40,7 +40,7 @@ function giglogadmin_assignconcert($p1, $c) } -function giglogadmin_unassignconcert($p1, $c) +function giglogadmin_unassignconcert($p1, $c): void { global $wpdb; @@ -71,6 +71,9 @@ function giglogadmin_unassignconcert($p1, $c) } +/** + * @return null|string + */ function giglogadmin_getpublishstatus ($c) { global $wpdb; @@ -88,6 +91,9 @@ function giglogadmin_getpublishstatus ($c) } +/** + * @return null|string + */ function giglogadmin_returnuser($p1, $c) { global $wpdb; @@ -164,7 +170,7 @@ function giglogadmin_returnuser($p1, $c) } -function giglogadmin_getfiltersphotog() { +function giglogadmin_getfiltersphotog(): string { global $wpdb; //echo (var_dump($_POST["selectvenue"])); @@ -211,7 +217,7 @@ function giglogadmin_getfiltersphotog() { } -function giglogadmin_getconcertsphotog ( ) { +function giglogadmin_getconcertsphotog ( ): string { $hf_user = wp_get_current_user(); $hf_username = $hf_user->user_login; $roles = ( array ) $hf_user->roles; @@ -370,7 +376,7 @@ function giglogadmin_getconcertsphotog ( ) { return $content; } -function giglogadmin_photographers() +function giglogadmin_photographers(): string { $output = giglogadmin_getfiltersphotog(); $output .= giglogadmin_getconcertsphotog(); diff --git a/includes/public/shortcodes/giglog_process_files.php b/includes/public/shortcodes/giglog_process_files.php index 9dc2ec0..9443cda 100644 --- a/includes/public/shortcodes/giglog_process_files.php +++ b/includes/public/shortcodes/giglog_process_files.php @@ -9,7 +9,7 @@ * Band Venue Date TicketLink Eventlink. The form is at the end of this snippet */ -function giglogadmin_upload_files() { +function giglogadmin_upload_files(): string { global $wpdb; $output = ""; $dir = wp_upload_dir()['basedir'].'/concertlists/'; //the basedir is from file uploader plugin, namely the uploads folder in which I created a concertlist folder |