Skip to content

Commit

Permalink
Fix static analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
MGatner committed Jul 31, 2022
1 parent bb643a9 commit a3b8597
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 11 deletions.
3 changes: 3 additions & 0 deletions psalm_autoload.php
Expand Up @@ -7,6 +7,9 @@
$helperDirs = [
'src/Helpers',
'vendor/codeigniter4/framework/system/Helpers',
'vendor/tatter/alerts/src/Helpers',
'vendor/tatter/imposter/src/Helpers',
'vendor/tatter/preferences/src/Helpers',
];

foreach ($helperDirs as $dir) {
Expand Down
3 changes: 3 additions & 0 deletions src/Config/Routes.php
Expand Up @@ -5,6 +5,9 @@
if (empty(config('Files')->routeFiles)) {
return;
}

$routes ??= service('routes');

$options = [
'filter' => 'assets:\Tatter\Files\Bundles\FilesBundle',
'namespace' => '\Tatter\Files\Controllers',
Expand Down
2 changes: 1 addition & 1 deletion src/Controllers/Files.php
Expand Up @@ -58,7 +58,7 @@ class Files extends Controller
public function __construct(?FilesConfig $config = null, ?FileModel $model = null)
{
$this->config = $config ?? config('Files');
$this->model = $model ?? model(FileModel::class); // @phpstan-ignore-line
$this->model = $model ?? model(FileModel::class);
}

//--------------------------------------------------------------------
Expand Down
8 changes: 4 additions & 4 deletions src/Helpers/files_helper.php
Expand Up @@ -110,13 +110,13 @@ function return_bytes(string $value): int

switch ($unit) {
case 'g': $num *= 1024;
// no break
// no break
case 'm': $num *= 1024;
// no break
// no break
case 'k': $num *= 1024;

// If it is not one of those modifiers then it was numerical bytes, add the final digit back
// no break
// If it is not one of those modifiers then it was numerical bytes, add the final digit back
// no break
default:
$num = (int) ($num . $unit);
}
Expand Down
10 changes: 5 additions & 5 deletions src/Views/Dropzone/config.php
Expand Up @@ -5,13 +5,13 @@
<?php
// Determine upload limit from PHP settings
helper('files');
$uploadLimitBytes = max_file_upload_in_bytes();
$uploadLimitBytes = max_file_upload_in_bytes();

// Buffer chunks to be just under the limit (maintain bytes)
$chunkSize = $uploadLimitBytes - 1000;
// Buffer chunks to be just under the limit (maintain bytes)
$chunkSize = $uploadLimitBytes - 1000;

// Limit files to the MB equivalent of 500 chunks
$maxFileSize = round($chunkSize * 500 / 1024 / 1024, 1);
// Limit files to the MB equivalent of 500 chunks
$maxFileSize = round($chunkSize * 500 / 1024 / 1024, 1);
?>
Dropzone.options.filesDropzone = {

Expand Down
2 changes: 1 addition & 1 deletion tests/_support/TestCase.php
Expand Up @@ -67,7 +67,7 @@ protected function setUp(): void
}

// Set up the model
$this->model = model(FileModel::class); // @phpstan-ignore-line
$this->model = model(FileModel::class);
}

protected function tearDown(): void
Expand Down

0 comments on commit a3b8597

Please sign in to comment.