mirror of
https://github.com/openvk/openvk
synced 2025-03-04 00:29:57 +03:00
fix(phpstan): less errors
This commit is contained in:
parent
2c46297853
commit
332f803cb6
3 changed files with 14 additions and 7 deletions
|
@ -109,7 +109,7 @@ class Video extends Media
|
|||
} elseif (!is_null($this->getRecord()->link)) {
|
||||
return Video::TYPE_EMBED;
|
||||
}
|
||||
return VIDEO::TYPE_UNKNOWN;
|
||||
return Video::TYPE_UNKNOWN;
|
||||
}
|
||||
|
||||
public function getVideoDriver(): ?VideoDriver
|
||||
|
@ -240,7 +240,7 @@ class Video extends Media
|
|||
$this->save();
|
||||
}
|
||||
|
||||
public static function fastMake(int $owner, string $name = "Unnamed Video.ogv", string $description = "", array $file, bool $unlisted = true, bool $anon = false): Video
|
||||
public static function fastMake(int $owner, string $name, string $description, array $file, bool $unlisted = true, bool $anon = false): Video
|
||||
{
|
||||
if (OPENVK_ROOT_CONF['openvk']['preferences']['videos']['disableUploading']) {
|
||||
exit(VIDEOS_FRIENDLY_ERROR);
|
||||
|
|
|
@ -9,6 +9,7 @@ use Chandler\MVC\SimplePresenter;
|
|||
use Chandler\Session\Session;
|
||||
use Chandler\Security\Authenticator;
|
||||
use Latte\Engine as TemplatingEngine;
|
||||
use Nette\InvalidStateException as ISE;
|
||||
use openvk\Web\Models\Entities\IP;
|
||||
use openvk\Web\Themes\Themepacks;
|
||||
use openvk\Web\Models\Repositories\{IPs, Users, APITokens, Tickets, Reports, CurrentUser, Posts};
|
||||
|
@ -129,7 +130,7 @@ abstract class OpenVKPresenter extends SimplePresenter
|
|||
}
|
||||
|
||||
if ($throw) {
|
||||
throw new SecurityPolicyViolationException("Permission error");
|
||||
throw new ISE("Permission error");
|
||||
} else {
|
||||
$this->flashFail("err", tr("not_enough_permissions"), tr("not_enough_permissions_comment"));
|
||||
}
|
||||
|
|
|
@ -265,8 +265,11 @@ final class WallPresenter extends OpenVKPresenter
|
|||
$this->assertUserLoggedIn();
|
||||
$this->willExecuteWriteAction();
|
||||
|
||||
$wallOwner = ($wall > 0 ? (new Users())->get($wall) : (new Clubs())->get($wall * -1))
|
||||
?? $this->flashFail("err", tr("failed_to_publish_post"), tr("error_4"));
|
||||
$wallOwner = ($wall > 0 ? (new Users())->get($wall) : (new Clubs())->get($wall * -1));
|
||||
|
||||
if ($wallOwner === null) {
|
||||
$this->flashFail("err", tr("failed_to_publish_post"), tr("error_4"));
|
||||
}
|
||||
|
||||
if ($wallOwner->isBanned()) {
|
||||
$this->flashFail("err", tr("error"), tr("forbidden"));
|
||||
|
@ -568,8 +571,11 @@ final class WallPresenter extends OpenVKPresenter
|
|||
}
|
||||
$user = $this->user->id;
|
||||
|
||||
$wallOwner = ($wall > 0 ? (new Users())->get($wall) : (new Clubs())->get($wall * -1))
|
||||
?? $this->flashFail("err", tr("failed_to_delete_post"), tr("error_4"));
|
||||
$wallOwner = ($wall > 0 ? (new Users())->get($wall) : (new Clubs())->get($wall * -1));
|
||||
|
||||
if ($wallOwner === null) {
|
||||
$this->flashFail("err", tr("failed_to_delete_post"), tr("error_4"));
|
||||
}
|
||||
|
||||
if ($wallOwner->isBanned()) {
|
||||
$this->flashFail("err", tr("error"), tr("forbidden"));
|
||||
|
|
Loading…
Reference in a new issue