stricter nulls
This commit is contained in:
parent
eca49bfc94
commit
8fb6fd5f54
18 changed files with 21 additions and 25 deletions
|
@ -586,7 +586,7 @@ class Image
|
|||
{
|
||||
$this->mime = $mime;
|
||||
$ext = FileExtension::get_for_mime($this->get_mime());
|
||||
assert($ext != null);
|
||||
assert($ext !== null);
|
||||
$this->ext = $ext;
|
||||
}
|
||||
|
||||
|
|
|
@ -196,7 +196,7 @@ function redirect_to_next_image(Image $image): void
|
|||
|
||||
$target_image = $image->get_next($search_terms);
|
||||
|
||||
if ($target_image == null) {
|
||||
if ($target_image === null) {
|
||||
$redirect_target = referer_or(make_link("post/list"), ['post/view']);
|
||||
} else {
|
||||
$redirect_target = make_link("post/view/{$target_image->id}", null, $query);
|
||||
|
|
|
@ -12,12 +12,8 @@ class BulkActionBlockBuildingEvent extends Event
|
|||
public array $actions = [];
|
||||
public array $search_terms = [];
|
||||
|
||||
public function add_action(String $action, string $button_text, string $access_key = null, String $confirmation_message = "", String $block = "", int $position = 40)
|
||||
public function add_action(String $action, string $button_text, string $access_key = null, string $confirmation_message = "", string $block = "", int $position = 40)
|
||||
{
|
||||
if ($block == null) {
|
||||
$block = "";
|
||||
}
|
||||
|
||||
if (!empty($access_key)) {
|
||||
assert(strlen($access_key)==1);
|
||||
foreach ($this->actions as $existing) {
|
||||
|
@ -180,7 +176,7 @@ class BulkActions extends Extension
|
|||
}
|
||||
} elseif (isset($_POST['bulk_query']) && $_POST['bulk_query'] != "") {
|
||||
$query = $_POST['bulk_query'];
|
||||
if ($query != null && $query != "") {
|
||||
if (!empty($query)) {
|
||||
$items = $this->yield_search_results($query);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -14,7 +14,7 @@ function validate_selections(form, confirmationMessage) {
|
|||
} else {
|
||||
var query = $(form).find('input[name="bulk_query"]').val();
|
||||
|
||||
if (query == null || query === "") {
|
||||
if (query === null || query === "") {
|
||||
return false;
|
||||
} else {
|
||||
queryOnly = true;
|
||||
|
|
|
@ -26,7 +26,7 @@ class BulkActionsTheme extends Themelet
|
|||
</td></tr></table>
|
||||
";
|
||||
|
||||
$hasQuery = ($query != null && $query != "");
|
||||
$hasQuery = !empty($query);
|
||||
|
||||
if ($hasQuery) {
|
||||
$body .= "</div>";
|
||||
|
|
|
@ -31,7 +31,7 @@ class BulkParentChild extends Extension
|
|||
($event->action == BulkParentChild::PARENT_CHILD_ACTION_NAME)) {
|
||||
$prev_id = null;
|
||||
foreach ($event->items as $image) {
|
||||
if ($prev_id != null) {
|
||||
if ($prev_id !== null) {
|
||||
send_event(new ImageRelationshipSetEvent($image->id, $prev_id));
|
||||
}
|
||||
$prev_id = $image->id;
|
||||
|
|
|
@ -259,7 +259,7 @@ class Index extends Extension
|
|||
}
|
||||
|
||||
// If we've reached this far, and nobody else has done anything with this term, then treat it as a tag
|
||||
if ($event->order == null && $event->img_conditions == [] && $event->tag_conditions == []) {
|
||||
if ($event->order === null && $event->img_conditions == [] && $event->tag_conditions == []) {
|
||||
$event->add_tag_condition(new TagCondition($event->term, $event->positive));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ class LinkImageTheme extends Themelet
|
|||
|
||||
protected function url(string $url, string $content, string $type): string
|
||||
{
|
||||
if ($content == null) {
|
||||
if (empty($content)) {
|
||||
$content=$url;
|
||||
}
|
||||
|
||||
|
|
|
@ -368,8 +368,8 @@ class Media extends Extension
|
|||
global $config;
|
||||
|
||||
$ffprobe = $config->get_string(MediaConfig::FFPROBE_PATH);
|
||||
if ($ffprobe == null || $ffprobe == "") {
|
||||
throw new MediaException("ffprobe command configured");
|
||||
if (empty($ffprobe)) {
|
||||
throw new MediaException("ffprobe command not configured");
|
||||
}
|
||||
|
||||
$args = [
|
||||
|
@ -656,7 +656,7 @@ class Media extends Extension
|
|||
$width = $info[0];
|
||||
$height = $info[1];
|
||||
|
||||
if ($output_mime == null) {
|
||||
if ($output_mime === null) {
|
||||
/* If not specified, output to the same format as the original image */
|
||||
switch ($info[2]) {
|
||||
case IMAGETYPE_GIF:
|
||||
|
|
|
@ -166,7 +166,7 @@ class MimeType
|
|||
|
||||
for ($i = 0; $i < $cc; $i++) {
|
||||
$byte = $comparison[$i];
|
||||
if ($byte == null) {
|
||||
if ($byte === null) {
|
||||
continue;
|
||||
} else {
|
||||
$fileByte = $chunk[$i + 1];
|
||||
|
|
|
@ -183,7 +183,7 @@ class Ratings extends Extension
|
|||
public function onBulkImport(BulkImportEvent $event)
|
||||
{
|
||||
if (array_key_exists("rating", $event->fields)
|
||||
&& $event->fields['rating'] != null
|
||||
&& $event->fields['rating'] !== null
|
||||
&& Ratings::rating_is_valid($event->fields['rating'])) {
|
||||
$this->set_rating($event->image->id, $event->fields['rating'], "");
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ class _SafeImage
|
|||
public function __construct(Image $img)
|
||||
{
|
||||
$_id = $img->id;
|
||||
assert($_id != null);
|
||||
assert($_id !== null);
|
||||
$this->id = $_id;
|
||||
$this->height = $img->height;
|
||||
$this->width = $img->width;
|
||||
|
|
|
@ -175,7 +175,7 @@ class TagEditCloud extends Extension
|
|||
}
|
||||
|
||||
if ($counter++ <= $def_count) {
|
||||
if ($last_cat !== $current_cat && $last_cat != null) {
|
||||
if ($last_cat !== $current_cat && $last_cat !== null) {
|
||||
$cloud .= "</span><span class='tag-category'>\n";
|
||||
} //TODO: Maybe add a title for the category after the span opens?
|
||||
$cloud .= $entry;
|
||||
|
|
|
@ -119,7 +119,7 @@ class TagListTheme extends Themelet
|
|||
$page->add_block(new Block($category_display_name, $tag_categories_html[$category], "left", 9));
|
||||
}
|
||||
|
||||
if ($main_html != null) {
|
||||
if ($main_html !== null) {
|
||||
$page->add_block(new Block("Tags", $main_html, "left", 10));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -190,7 +190,7 @@ class UploadTheme extends Themelet
|
|||
}
|
||||
else {
|
||||
var tags = prompt("Please enter tags", "tagme");
|
||||
if(tags != "" && tags != null) {
|
||||
if(tags !== "" && tags !== null) {
|
||||
var link = "'. $link . $delimiter .'url="+location.href+"&tags="+tags;
|
||||
var w = window.open(link, "_blank");
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ class CustomViewImageTheme extends ViewImageTheme
|
|||
}
|
||||
|
||||
if (Extension::is_enabled(RatingsInfo::KEY)) {
|
||||
if ($image->rating == null || $image->rating == "?") {
|
||||
if ($image->rating === null || $image->rating == "?") {
|
||||
$image->rating = "?";
|
||||
}
|
||||
$h_rating = Ratings::rating_to_human($image->rating);
|
||||
|
|
|
@ -52,7 +52,7 @@ class CustomViewImageTheme extends ViewImageTheme
|
|||
}
|
||||
|
||||
if (Extension::is_enabled(RatingsInfo::KEY)) {
|
||||
if ($image->rating == null || $image->rating == "?") {
|
||||
if ($image->rating === null || $image->rating == "?") {
|
||||
$image->rating = "?";
|
||||
}
|
||||
if (Extension::is_enabled(RatingsInfo::KEY)) {
|
||||
|
|
|
@ -56,7 +56,7 @@ class CustomViewImageTheme extends ViewImageTheme
|
|||
}
|
||||
|
||||
if (Extension::is_enabled(RatingsInfo::KEY)) {
|
||||
if ($image->rating == null || $image->rating == "?") {
|
||||
if ($image->rating === null || $image->rating == "?") {
|
||||
$image->rating = "?";
|
||||
}
|
||||
$h_rating = Ratings::rating_to_human($image->rating);
|
||||
|
|
Reference in a new issue