phpstan: level 1 passed

This commit is contained in:
slawkens 2024-01-31 00:36:15 +01:00
parent cc3e66cacb
commit a2c8e2b2ae
10 changed files with 23 additions and 16 deletions

View File

@ -291,7 +291,7 @@ else if (isset($_REQUEST['search'])) {
<div class="card-body">
<div class="tab-content" id="accounts-tabContent">
<div class="tab-pane fade active show" id="accounts-acc">
<form action="<?php echo $admin_base . ((isset($id) && $id > 0) ? '&id=' . $id : ''); ?>" method="post">
<form action="<?php echo $admin_base . ($id > 0 ? '&id=' . $id : ''); ?>" method="post">
<?php csrf(); ?>
<div class="form-group row">
<?php if (USE_ACCOUNT_NAME): ?>

View File

@ -146,8 +146,8 @@ foreach ($query as $_news) {
'archive_link' => getLink('news') . '/archive/' . $_news['id'],
'title' => $_news['title'],
'date' => $_news['date'],
'player_name' => isset($_player) && $_player->isLoaded() ? $_player->getName() : '',
'player_link' => isset($_player) && $_player->isLoaded() ? getPlayerLink($_player->getName(), false) : '',
'player_name' => $_player->isLoaded() ? $_player->getName() : '',
'player_link' => $_player->isLoaded() ? getPlayerLink($_player->getName(), false) : '',
);
}

View File

@ -375,7 +375,7 @@ else if (isset($_REQUEST['search'])) {
</li>
</ul>
</div>
<form action="<?php echo $player_base . ((isset($id) && $id > 0) ? '&id=' . $id : ''); ?>" method="post">
<form action="<?php echo $player_base . ($id > 0 ? '&id=' . $id : ''); ?>" method="post">
<?php csrf(); ?>
<div class="card-body">
<div class="tab-content" id="tabs-tabContent">

View File

@ -27,7 +27,7 @@ $configBans = [];
$configBans['hasType'] = false;
$configBans['hasReason'] = false;
$limit = 'LIMIT ' . ($configBansPerPage + 1) . (isset($offset) ? ' OFFSET ' . $offset : '');
$limit = 'LIMIT ' . ($configBansPerPage + 1) . ' OFFSET ' . $offset;
if ($db->hasTable('account_bans')) {
$bansQuery = $db->query('SELECT * FROM `account_bans` ORDER BY `banned_at` DESC ' . $limit);
}

View File

@ -67,13 +67,9 @@ if(empty($errors)) {
}
else
{
if(!empty($errors)) {
$twig->display('error_box.html.twig', array('errors' => $errors));
$twig->display('error_box.html.twig', array('errors' => $errors));
$twig->display('guilds.back_button.html.twig', array(
$twig->display('guilds.back_button.html.twig', array(
'new_line' => true
));
}
}
?>

View File

@ -101,7 +101,7 @@ if(isset($_GET['page']) && $_GET['page'] == 'view' && isset($_REQUEST['house']))
'houseSize' => isset($house['size']) ? $house['size'] : null,
'houseRent' => isset($house['rent']) ? $house['rent'] : null,
'owner' => isset($owner) ? $owner : null,
'rentType' => isset($rentType) ? $rentType : null
'rentType' => $rentType
));
if (count($errors) > 0) {

View File

@ -47,7 +47,7 @@ class CronjobInstallCommand extends Command
{
exec('crontab -l', $crontab);
if(isset($crontab) && is_array($crontab)) {
if(is_array($crontab)) {
$crontab = array_flip($crontab);
if(isset($crontab[$command])){

View File

@ -73,7 +73,7 @@ class CreateCharacter
* @param array $errors
* @return bool
*/
public function check($name, $sex, &$vocation, &$town, &$errors)
public function check($name, $sex, ?int &$vocation, ?int &$town, &$errors)
{
$this->checkName($name, $errors);

View File

@ -4,6 +4,10 @@ namespace MyAAC\Models;
use Illuminate\Database\Eloquent\Model;
/**
* @property integer $lastday
* @property integer $premdays
*/
class Account extends Model {
protected $table = 'accounts';
@ -46,8 +50,8 @@ class Account extends Model {
return 65535;
}
$ret = ceil($this->premdays - (date("z", time()) + (365 * (date("Y", time()) - date("Y", $this->lastday))) - date("z", $this->lastday)));
return $ret > 0 ? $ret : 0;
$ret = ceil($this->premdays - ((int)date("z", time()) + (365 * (date("Y", time()) - date("Y", $this->lastday))) - date("z", $this->lastday)));
return max($ret, 0);
}
public function getIsPremiumAttribute()

View File

@ -2,7 +2,14 @@
namespace MyAAC\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasOne;
/**
* @property int $level
* @property int $vocation
* @property int $online
* @property hasOne $onlineTable
*/
class Player extends Model {
protected $table = 'players';