Replace Psalm with PHPStan + PHP‑CS‑Fixer + Biome, add linting configs & cleanup

- Removed the `vimeo/psalm` dependency and all related files
(`psalm.xml`, `psalm‑baseline.xml`, suppress annotations).  
- Added **PHPStan** (v2.1.54) and **PHP‑CS‑Fixer** (v3.95.1) to
`vendor/bin/`.  
- Created `phpstan.neon` (level 5, bootstraps `app/bootstrap.php`,
scans `Parsedown.php`).  
- Created `phpstan‑baseline.neon` with 10 pre‑existing errors.  
- Added `.php‑cs‑fixer.dist.php` (PSR‑12 + PHP80Migration, targets
 `app/src` & `app/tests`).  
- Added `biome.json` and updated `justfile` to replace the old Psalm
recipes with `phpstan`, `cs‑check`, and `cs‑fix`.  
- Updated `.gitignore` to exclude PHPStan and PHP‑CS‑Fixer cache files.  
- Updated several JS files (`file‑preview.js`, `file‑upload‑queue.js`)
eand PHP controllers (`MediaController.php`, `SearchController.php`,
`SystemController.php`).  
- Minor adjustments to `TODO.md`, `app/src/Database.php`,
`app/src/Parsedown.php`, `app/src/ShareLink.php`, and
`app/src/SmtpRelay.php`.
This commit is contained in:
Pontoporeia
2026-05-04 16:06:44 +02:00
parent d6e30ec9cd
commit 0a05f3911c
16 changed files with 191 additions and 58 deletions

View File

@@ -4,9 +4,7 @@
* renders a list of selected files with thumbnails (images) or file-type icons
* (PDFs, videos, archives…) and the filename + size.
*/
(function () {
'use strict';
(() => {
const ICON = {
pdf: '📄',
video: '🎬',
@@ -27,10 +25,10 @@
}
function humanSize(bytes) {
if (bytes >= 1073741824) return (bytes / 1073741824).toFixed(2) + ' GB';
if (bytes >= 1048576) return (bytes / 1048576).toFixed(2) + ' MB';
if (bytes >= 1024) return (bytes / 1024).toFixed(1) + ' KB';
return bytes + ' B';
if (bytes >= 1073741824) return `${(bytes / 1073741824).toFixed(2)} GB`;
if (bytes >= 1048576) return `${(bytes / 1048576).toFixed(2)} MB`;
if (bytes >= 1024) return `${(bytes / 1024).toFixed(1)} KB`;
return `${bytes} B`;
}
function renderPreview(input, container) {
@@ -38,7 +36,7 @@
const files = Array.from(input.files);
if (!files.length) return;
files.forEach(function (file) {
files.forEach((file) => {
const item = document.createElement('div');
item.className = 'fp-item';
@@ -47,7 +45,7 @@
img.className = 'fp-thumb';
img.alt = file.name;
const reader = new FileReader();
reader.onload = function (e) { img.src = e.target.result; };
reader.onload = (e) => { img.src = e.target.result; };
reader.readAsDataURL(file);
item.appendChild(img);
} else {
@@ -77,12 +75,12 @@
}
function init() {
document.querySelectorAll('input[type="file"][data-preview]').forEach(function (input) {
var containerId = input.getAttribute('data-preview');
var container = document.getElementById(containerId);
document.querySelectorAll('input[type="file"][data-preview]').forEach((input) => {
const containerId = input.getAttribute('data-preview');
const container = document.getElementById(containerId);
if (!container) return;
input.addEventListener('change', function () {
input.addEventListener('change', () => {
renderPreview(input, container);
});
});