Add strict mode 1
This commit is contained in:
parent
25889b1415
commit
bd0ca920fd
31 changed files with 76 additions and 12 deletions
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ForkBB\Controllers;
|
||||
|
||||
use ForkBB\Core\Container;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ForkBB\Controllers;
|
||||
|
||||
use ForkBB\Core\Container;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ForkBB\Controllers;
|
||||
|
||||
use ForkBB\Core\Container;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ForkBB\Controllers;
|
||||
|
||||
use ForkBB\Core\Container;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ForkBB\Core\Cache;
|
||||
|
||||
use Psr\SimpleCache\CacheInterface;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ForkBB\Core;
|
||||
|
||||
use ForkBB\Core\Exceptions\ForkException;
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* based on Container https://github.com/artoodetoo/container
|
||||
* by artoodetoo
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ForkBB\Core;
|
||||
|
||||
use InvalidArgumentException;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ForkBB\Core;
|
||||
|
||||
use ForkBB\Core\Secury;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ForkBB\Core;
|
||||
|
||||
use ForkBB\Core\DBStatement;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ForkBB\Core\DB;
|
||||
|
||||
use ForkBB\Core\DB;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ForkBB\Core;
|
||||
|
||||
use PDO;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ForkBB\Core;
|
||||
|
||||
use Throwable;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ForkBB\Core;
|
||||
|
||||
use ForkBB\Core\Exceptions\FileException;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ForkBB\Core;
|
||||
|
||||
use ForkBB\Core\File;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ForkBB\Core;
|
||||
|
||||
use ForkBB\Core\Container;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ForkBB\Core;
|
||||
|
||||
use ForkBB\Core\Files;
|
||||
|
@ -59,8 +61,8 @@ class Image extends File
|
|||
$wr = ($maxW < 1) ? 1 : $maxW / $oldW;
|
||||
$hr = ($maxH < 1) ? 1 : $maxH / $oldH;
|
||||
$r = \min($wr, $hr, 1);
|
||||
$width = \round($oldW * $r);
|
||||
$height = \round($oldH * $r);
|
||||
$width = (int) \round($oldW * $r);
|
||||
$height = (int) \round($oldH * $r);
|
||||
|
||||
if (false === ($image = \imagecreatetruecolor($width, $height))) {
|
||||
throw new FileException('Failed to create new truecolor image');
|
||||
|
@ -126,7 +128,7 @@ class Image extends File
|
|||
$result = @\imagejpeg($this->image, $path, $this->quality);
|
||||
break;
|
||||
case 'png':
|
||||
$quality = \floor((100 - $this->quality) / 11);
|
||||
$quality = (int) \floor((100 - $this->quality) / 11);
|
||||
$result = @\imagepng($this->image, $path, $quality);
|
||||
break;
|
||||
case 'gif':
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ForkBB\Core;
|
||||
|
||||
use ForkBB\Core\Container;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ForkBB\Core;
|
||||
|
||||
use ForkBB\Core\Exceptions\MailException;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ForkBB\Core;
|
||||
|
||||
use Parserus;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ForkBB\Core;
|
||||
|
||||
use ForkBB\Core\Csrf;
|
||||
|
@ -84,7 +86,7 @@ class Router
|
|||
$this->baseUrl = $base;
|
||||
$this->csrf = $csrf;
|
||||
$this->host = \parse_url($base, \PHP_URL_HOST);
|
||||
$this->prefix = \parse_url($base, \PHP_URL_PATH);
|
||||
$this->prefix = \parse_url($base, \PHP_URL_PATH) ?? '';
|
||||
$this->length = \strlen($this->prefix);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ForkBB\Core;
|
||||
|
||||
use ForkBB\Core\Container;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ForkBB\Core;
|
||||
|
||||
use RuntimeException;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ForkBB\Core;
|
||||
|
||||
use ForkBB\Core\Container;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ForkBB\Core;
|
||||
|
||||
use ForkBB\Core\Container;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ForkBB\Core;
|
||||
|
||||
use R2\Templating\Dirk;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ForkBB;
|
||||
|
||||
use ForkBB\Core\Container;
|
||||
|
@ -8,8 +10,8 @@ use ForkBB\Models\Page;
|
|||
use RuntimeException;
|
||||
|
||||
\error_reporting(\E_ALL ^ \E_NOTICE);
|
||||
\ini_set('display_errors', 0);
|
||||
\ini_set('log_errors', 1);
|
||||
\ini_set('display_errors', '0');
|
||||
\ini_set('log_errors', '1');
|
||||
|
||||
\setlocale(\LC_ALL, 'C');
|
||||
\mb_language('uni');
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
\error_reporting(\E_ALL);
|
||||
\ini_set('display_errors', 1);
|
||||
\ini_set('log_errors', 1);
|
||||
\ini_set('display_errors', '1');
|
||||
\ini_set('log_errors', '1');
|
||||
|
||||
function forkGetBaseURL()
|
||||
{
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
# development
|
||||
#\error_reporting(\E_ALL);
|
||||
#\ini_set('display_errors', 1);
|
||||
#\ini_set('log_errors', 1);
|
||||
#\ini_set('display_errors', '1');
|
||||
#\ini_set('log_errors', '1');
|
||||
|
||||
return [
|
||||
'BASE_URL' => '_BASE_URL_',
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ForkBB;
|
||||
|
||||
use ForkBB\Core\Container;
|
||||
|
@ -67,7 +69,7 @@ function e(string $arg): string
|
|||
function num(/* mixed */ $number, int $decimals = 0): string
|
||||
{
|
||||
return \is_numeric($number)
|
||||
? \number_format($number, $decimals, __('lang_decimal_point'), __('lang_thousands_sep'))
|
||||
? \number_format((float) $number, $decimals, __('lang_decimal_point'), __('lang_thousands_sep'))
|
||||
: '-';
|
||||
}
|
||||
|
||||
|
@ -87,7 +89,7 @@ function dt(int $arg, bool $dateOnly = false, string $dateFormat = null, string
|
|||
return __('Never');
|
||||
}
|
||||
|
||||
$diff = ($c->user->timezone + $c->user->dst) * 3600;
|
||||
$diff = (int) (($c->user->timezone + $c->user->dst) * 3600);
|
||||
$arg += $diff;
|
||||
|
||||
if (null === $dateFormat) {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$forkStart = empty($_SERVER['REQUEST_TIME_FLOAT']) ? \microtime(true) : $_SERVER['REQUEST_TIME_FLOAT'];
|
||||
$forkPublic = __DIR__ . '/public';
|
||||
$forkPublicPrefix = '/public';
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$forkStart = empty($_SERVER['REQUEST_TIME_FLOAT']) ? \microtime(true) : $_SERVER['REQUEST_TIME_FLOAT'];
|
||||
$forkPublic = __DIR__;
|
||||
$forkPublicPrefix = '';
|
||||
|
|
Loading…
Add table
Reference in a new issue