new php-cs-fixer, new opinions about what is today's preferred format...

This commit is contained in:
Shish 2022-10-27 17:21:46 +01:00
parent ebc78f8996
commit 4ff93c63c3
25 changed files with 659 additions and 979 deletions

View file

@ -53,7 +53,7 @@
"require-dev" : {
"phpunit/phpunit" : "^9.0",
"friendsofphp/php-cs-fixer" : "^3.4"
"friendsofphp/php-cs-fixer" : "^3.12"
},
"suggest": {
"ext-memcache": "memcache caching",

976
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -529,7 +529,8 @@ function parse_shorthand_int(string $limit): int
// no break
case 'm': $value *= 1024; // fall through
// no break
case 'k': $value *= 1024; break;
case 'k': $value *= 1024;
break;
default: $value = -1;
}
}

View file

@ -2,6 +2,7 @@
declare(strict_types=1);
use MicroHTML\HTMLElement;
use function MicroHTML\emptyHTML;
use function MicroHTML\rawHTML;
use function MicroHTML\FORM;

View file

@ -171,11 +171,16 @@ class CommentList extends Extension
{
if ($event->page_matches("comment")) {
switch ($event->get_arg(0)) {
case "add": $this->onPageRequest_add(); break;
case "delete": $this->onPageRequest_delete($event); break;
case "bulk_delete": $this->onPageRequest_bulk_delete(); break;
case "list": $this->onPageRequest_list($event); break;
case "beta-search": $this->onPageRequest_beta_search($event); break;
case "add": $this->onPageRequest_add();
break;
case "delete": $this->onPageRequest_delete($event);
break;
case "bulk_delete": $this->onPageRequest_bulk_delete();
break;
case "list": $this->onPageRequest_list($event);
break;
case "beta-search": $this->onPageRequest_beta_search($event);
break;
}
}
}

View file

@ -2,6 +2,7 @@
declare(strict_types=1);
use MicroHTML\HTMLElement;
use function MicroHTML\INPUT;
class FavoritesTheme extends Themelet

View file

@ -8,6 +8,7 @@ use MicroCRUD\Column;
use MicroCRUD\DateTimeColumn;
use MicroCRUD\TextColumn;
use MicroCRUD\Table;
use function MicroHTML\A;
use function MicroHTML\SPAN;
use function MicroHTML\emptyHTML;
@ -161,11 +162,16 @@ class MessageColumn extends Column
{
$c = "#000";
switch ($row['priority']) {
case SCORE_LOG_DEBUG: $c = "#999"; break;
case SCORE_LOG_INFO: $c = "#000"; break;
case SCORE_LOG_WARNING: $c = "#800"; break;
case SCORE_LOG_ERROR: $c = "#C00"; break;
case SCORE_LOG_CRITICAL: $c = "#F00"; break;
case SCORE_LOG_DEBUG: $c = "#999";
break;
case SCORE_LOG_INFO: $c = "#000";
break;
case SCORE_LOG_WARNING: $c = "#800";
break;
case SCORE_LOG_ERROR: $c = "#C00";
break;
case SCORE_LOG_CRITICAL: $c = "#F00";
break;
}
return SPAN(["style"=>"color: $c"], rawHTML($this->scan_entities($row[$this->name])));
}

View file

@ -791,7 +791,6 @@ class Media extends Extension
imagedestroy($image_resized);
$image_resized = $new_image;
break;
}
switch ($output_mime) {

View file

@ -247,7 +247,7 @@ class MimeType
case FileExtension::PPM:
$output = MimeType::PPM;
break;
// TODO: There is no uniquely defined Mime type for the cursor format. Need to figure this out.
// TODO: There is no uniquely defined Mime type for the cursor format. Need to figure this out.
// case FileExtension::CUR:
// $output = MimeType::CUR;
// break;

View file

@ -345,14 +345,12 @@ class Pools extends Extension
$image_order = $image_order + 1;
}
$database->commit();
}
catch (Exception $e) {
} catch (Exception $e) {
$database->rollback();
}
$page->set_mode(PageMode::REDIRECT);
$page->set_redirect(make_link("pool/view/" . $pool_id));
}
else {
} else {
$this->theme->display_error(403, "Permission Denied", "You do not have permission to access this page");
}
break;
@ -522,7 +520,6 @@ class Pools extends Extension
$poolID = str_replace("_", " ", $matches[1]);
$event->add_querylet(new Querylet("images.id IN (SELECT DISTINCT image_id FROM pool_images WHERE pool_id = $poolID)"));
}
}
public function onTagTermCheck(TagTermCheckEvent $event)

View file

@ -2,9 +2,9 @@
declare(strict_types=1);
/**
* @global ImageRating[] $_shm_ratings
*/
/**
* @global ImageRating[] $_shm_ratings
*/
global $_shm_ratings;
$_shm_ratings = [];

View file

@ -134,10 +134,8 @@ class ResizeImage extends Extension
if (is_null($image)) {
$this->theme->display_error(404, "Post not found", "No image in the database has the ID #$image_id");
} else {
/* Check if options were given to resize an image. */
if (isset($_POST['resize_width']) || isset($_POST['resize_height'])) {
/* get options */
$width = $height = 0;

View file

@ -65,10 +65,8 @@ class RotateImage extends Extension
if (is_null($image)) {
$this->theme->display_error(404, "Post not found", "No image in the database has the ID #$image_id");
} else {
/* Check if options were given to rotate an image. */
if (isset($_POST['rotate_deg'])) {
/* get options */
$deg = 0;
@ -153,11 +151,16 @@ class RotateImage extends Extension
/* Output to the same format as the original image */
switch ($info[2]) {
case IMAGETYPE_GIF: $result = imagegif($image_rotated, $tmp_filename); break;
case IMAGETYPE_JPEG: $result = imagejpeg($image_rotated, $tmp_filename); break;
case IMAGETYPE_PNG: $result = imagepng($image_rotated, $tmp_filename, 9); break;
case IMAGETYPE_WEBP: $result = imagewebp($image_rotated, $tmp_filename); break;
case IMAGETYPE_BMP: $result = imagebmp($image_rotated, $tmp_filename, true); break;
case IMAGETYPE_GIF: $result = imagegif($image_rotated, $tmp_filename);
break;
case IMAGETYPE_JPEG: $result = imagejpeg($image_rotated, $tmp_filename);
break;
case IMAGETYPE_PNG: $result = imagepng($image_rotated, $tmp_filename, 9);
break;
case IMAGETYPE_WEBP: $result = imagewebp($image_rotated, $tmp_filename);
break;
case IMAGETYPE_BMP: $result = imagebmp($image_rotated, $tmp_filename, true);
break;
default:
throw new ImageRotateException("Unsupported image type.");
}

View file

@ -396,10 +396,14 @@ class Setup extends Extension
$type = $_POST["_type_$name"];
$value = isset($_POST["_config_$name"]) ? $_POST["_config_$name"] : null;
switch ($type) {
case "string": $config->set_string($name, $value); break;
case "int": $config->set_int($name, parse_shorthand_int((string)$value)); break;
case "bool": $config->set_bool($name, bool_escape($value)); break;
case "array": $config->set_array($name, $value); break;
case "string": $config->set_string($name, $value);
break;
case "int": $config->set_int($name, parse_shorthand_int((string)$value));
break;
case "bool": $config->set_bool($name, bool_escape($value));
break;
case "array": $config->set_array($name, $value);
break;
}
}
}

View file

@ -3,9 +3,9 @@
declare(strict_types=1);
require_once "config.php";
/*
* This is used by the image transcoding code when there is an error while transcoding
*/
/*
* This is used by the image transcoding code when there is an error while transcoding
*/
class ImageTranscodeException extends SCoreException
{
}

View file

@ -3,9 +3,9 @@
declare(strict_types=1);
require_once "config.php";
/*
* This is used by the image transcoding code when there is an error while transcoding
*/
/*
* This is used by the image transcoding code when there is an error while transcoding
*/
class VideoTranscodeException extends SCoreException
{
}

View file

@ -3,6 +3,7 @@
declare(strict_types=1);
use MicroHTML\HTMLElement;
use function MicroHTML\TABLE;
use function MicroHTML\TR;
use function MicroHTML\TD;

View file

@ -11,6 +11,7 @@ use MicroCRUD\IntegerColumn;
use MicroCRUD\TextColumn;
use MicroCRUD\DateColumn;
use MicroCRUD\Table;
use function MicroHTML\A;
class UserNameColumn extends TextColumn

View file

@ -2,6 +2,7 @@
declare(strict_types=1);
use MicroHTML\HTMLElement;
use function MicroHTML\emptyHTML;
use function MicroHTML\rawHTML;
use function MicroHTML\TABLE;

View file

@ -552,7 +552,6 @@ class Wiki extends Extension
and
$fstop++ < 10 # and the distance is lower than 10 lines
) {
/**
* test the left side for a hit
*

View file

@ -1,6 +1,7 @@
<?php
use MicroHTML\HTMLElement;
use function MicroHTML\A;
class CustomUploadTheme extends UploadTheme