mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-08-01 16:54:32 +02:00
Added declare strict types to all files
This commit is contained in:
parent
bea90a7d94
commit
6a2ff9d153
196 changed files with 685 additions and 360 deletions
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
|
@ -17,7 +20,6 @@
|
|||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace App\Services\Misc;
|
||||
|
||||
class ConsoleInfoHelper
|
||||
|
@ -47,17 +49,7 @@ class ConsoleInfoHelper
|
|||
return $user['name'];
|
||||
}
|
||||
|
||||
//Try to retrieve the name via the environment variable Username (Windows)
|
||||
if (isset($_SERVER['USERNAME'])) {
|
||||
return $_SERVER['USERNAME'];
|
||||
}
|
||||
|
||||
//Try to retrieve the name via the environment variable USER (Linux)
|
||||
if (isset($_SERVER['USER'])) {
|
||||
return $_SERVER['USER'];
|
||||
}
|
||||
|
||||
//Otherwise we can't determine the username
|
||||
return null;
|
||||
return $_SERVER['USERNAME'] ?? $_SERVER['USER'] ?? null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
|
@ -17,7 +20,6 @@
|
|||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace App\Services\Misc;
|
||||
|
||||
use Doctrine\DBAL\Exception;
|
||||
|
|
|
@ -71,7 +71,7 @@ class RangeParser
|
|||
$ranges[] = $this->generateMinMaxRange($matches[1], $matches[2]);
|
||||
} elseif (is_numeric($number)) {
|
||||
$ranges[] = [(int) $number];
|
||||
} elseif (empty($number)) { //Allow empty tokens
|
||||
} elseif ($number === '') { //Allow empty tokens
|
||||
continue;
|
||||
} else {
|
||||
throw new InvalidArgumentException('Invalid range encoutered: '.$number);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue