php8.4 fixes

This commit is contained in:
Fabian Berg
2025-04-28 13:22:18 +02:00
parent 69f92ac2e4
commit 25cbb212c8
6 changed files with 35 additions and 35 deletions

View File

@@ -105,9 +105,9 @@ class Update_model extends CI_Model {
return "Something went wrong with fetching the SOTA file";
}
$data = fgetcsv($csvhandle, 1000, ","); // Skip line we are not interested in
$data = fgetcsv($csvhandle, 1000, ","); // Skip line we are not interested in
$data = fgetcsv($csvhandle, 1000, ",");
$data = fgetcsv($csvhandle, 1000, ",", '"', '\\'); // Skip line we are not interested in
$data = fgetcsv($csvhandle, 1000, ",", '"', '\\'); // Skip line we are not interested in
$data = fgetcsv($csvhandle, 1000, ",", '"', '\\');
$sotafilehandle = fopen($sotafile, 'w');
if ($sotafilehandle === FALSE) {
@@ -120,7 +120,7 @@ class Update_model extends CI_Model {
fwrite($sotafilehandle, $data[0] . PHP_EOL);
$nCount++;
}
} while ($data = fgetcsv($csvhandle, 1000, ","));
} while ($data = fgetcsv($csvhandle, 1000, ",", '"', '\\'));
fclose($csvhandle);
fclose($sotafilehandle);
@@ -157,11 +157,11 @@ class Update_model extends CI_Model {
return "FAILED: Could not write to wwff.txt file";
}
$data = str_getcsv($csv, "\n");
$data = str_getcsv($csv, "\n", '"', '\\');
$nCount = 0;
foreach ($data as $idx => $row) {
if ($idx == 0) continue; // Skip line we are not interested in
$row = str_getcsv($row, ',');
$row = str_getcsv($row, ',', '"', '\\');
if ($row[0]) {
fwrite($wwfffilehandle, $row[0] . PHP_EOL);
$nCount++;
@@ -201,11 +201,11 @@ class Update_model extends CI_Model {
if ($potafilehandle === FALSE) {
return "FAILED: Could not write to pota.txt file";
}
$data = str_getcsv($csv, "\n");
$data = str_getcsv($csv, "\n", '"', '\\');
$nCount = 0;
foreach ($data as $idx => $row) {
if ($idx == 0) continue; // Skip line we are not interested in
$row = str_getcsv($row, ',');
$row = str_getcsv($row, ',', '"', '\\');
if ($row[0]) {
fwrite($potafilehandle, $row[0] . PHP_EOL);
$nCount++;
@@ -240,7 +240,7 @@ class Update_model extends CI_Model {
$this->db->empty_table("lotw_users");
$this->db->query("ALTER TABLE lotw_users AUTO_INCREMENT 1");
$i = 0;
$data = fgetcsv($handle, 1000, ",");
$data = fgetcsv($handle, 1000, ",", '"', '\\');
do {
if ($data[0]) {
$lotwdata[$i]['callsign'] = $data[0];
@@ -252,7 +252,7 @@ class Update_model extends CI_Model {
}
$i++;
}
} while ($data = fgetcsv($handle, 1000, ","));
} while ($data = fgetcsv($handle, 1000, ",", '"', '\\'));
fclose($handle);
$this->db->insert_batch('lotw_users', $lotwdata);
@@ -476,7 +476,7 @@ class Update_model extends CI_Model {
function update_norad_ids() {
$csvfile = 'https://www.df2et.de/cqrlog/lotw_norad.csv';
$csvhandle = fopen($csvfile, "r");
while (false !== ($data = fgetcsv($csvhandle, 1000, ","))) {
while (false !== ($data = fgetcsv($csvhandle, 1000, ",", '"', '\\'))) {
$this->db->set('norad_id', $data[1]);
$this->db->where('name', $data[0]);
$this->db->update('satellite');

View File

@@ -287,7 +287,7 @@ final class Map implements Collection, \ArrayAccess
* @psalm-param (callable(TKey, TValue): bool)|null $callback
* @psalm-return Map<TKey, TValue>
*/
public function filter(callable $callback = null): Map
public function filter(?callable $callback = null): Map
{
$filtered = new self();
@@ -552,7 +552,7 @@ final class Map implements Collection, \ArrayAccess
*
* @psalm-return Map<TKey, TValue>
*/
public function slice(int $offset, int $length = null): Map
public function slice(int $offset, ?int $length = null): Map
{
$map = new self();
@@ -578,7 +578,7 @@ final class Map implements Collection, \ArrayAccess
*
* @psalm-param (callable(TValue, TValue): int)|null $comparator
*/
public function sort(callable $comparator = null)
public function sort(?callable $comparator = null)
{
if ($comparator) {
usort($this->pairs, function($a, $b) use ($comparator) {
@@ -603,7 +603,7 @@ final class Map implements Collection, \ArrayAccess
* @psalm-param (callable(TValue, TValue): int)|null $comparator
* @psalm-return Map<TKey, TValue>
*/
public function sorted(callable $comparator = null): Map
public function sorted(?callable $comparator = null): Map
{
$copy = $this->copy();
$copy->sort($comparator);
@@ -619,7 +619,7 @@ final class Map implements Collection, \ArrayAccess
*
* @psalm-param (callable(TKey, TKey): int)|null $comparator
*/
public function ksort(callable $comparator = null)
public function ksort(?callable $comparator = null)
{
if ($comparator) {
usort($this->pairs, function($a, $b) use ($comparator) {
@@ -644,7 +644,7 @@ final class Map implements Collection, \ArrayAccess
* @psalm-param (callable(TKey, TKey): int)|null $comparator
* @psalm-return Map<TKey, TValue>
*/
public function ksorted(callable $comparator = null): Map
public function ksorted(?callable $comparator = null): Map
{
$copy = $this->copy();
$copy->ksort($comparator);

View File

@@ -175,7 +175,7 @@ final class Set implements Collection, \ArrayAccess
* @psalm-param (callable(TValue): bool)|null $callback
* @psalm-return Set<TValue>
*/
public function filter(callable $callback = null): Set
public function filter(?callable $callback = null): Set
{
return new self(array_filter($this->toArray(), $callback ?: 'boolval'));
}
@@ -241,7 +241,7 @@ final class Set implements Collection, \ArrayAccess
*
* @param string|null $glue
*/
public function join(string $glue = null): string
public function join(?string $glue = null): string
{
return implode($glue ?? '', $this->toArray());
}
@@ -345,7 +345,7 @@ final class Set implements Collection, \ArrayAccess
* at that offset in the set. If offset is negative,
* the set will start that far from the end.
*
* @param int $length If a length is given and is positive, the resulting
* @param int|null $length If a length is given and is positive, the resulting
* set will have up to that many values in it.
* If the requested length results in an overflow, only
* values up to the end of the set will be included.
@@ -361,7 +361,7 @@ final class Set implements Collection, \ArrayAccess
*
* @psalm-return Set<TValue>
*/
public function slice(int $offset, int $length = null): Set
public function slice(int $offset, ?int $length = null): Set
{
$sliced = new self();
$sliced->table = $this->table->slice($offset, $length);
@@ -377,7 +377,7 @@ final class Set implements Collection, \ArrayAccess
*
* @psalm-param (callable(TValue, TValue): int)|null $comparator
*/
public function sort(callable $comparator = null)
public function sort(?callable $comparator = null)
{
$this->table->ksort($comparator);
}
@@ -394,7 +394,7 @@ final class Set implements Collection, \ArrayAccess
* @psalm-param (callable(TValue, TValue): int)|null $comparator
* @psalm-return Set<TValue>
*/
public function sorted(callable $comparator = null): Set
public function sorted(?callable $comparator = null): Set
{
$sorted = $this->copy();
$sorted->table->ksort($comparator);

View File

@@ -21,10 +21,10 @@ class OpenStreetMap
* @param int $zoom Zoom
* @param int $imageWidth Width of the generated map image
* @param int $imageHeight Height of the generated map image
* @param TileLayer $tileLayer Tile server configuration, defaults to OpenStreetMaps tile server
* @param TileLayer|null $tileLayer Tile server configuration, defaults to OpenStreetMaps tile server
* @param int $tileSize Tile size in pixels
*/
public static function createFromLatLngZoom(LatLng $centerMap, int $zoom, int $imageWidth, int $imageHeight, TileLayer $tileLayer = null, int $tileSize = 256): OpenStreetMap
public static function createFromLatLngZoom(LatLng $centerMap, int $zoom, int $imageWidth, int $imageHeight, ?TileLayer $tileLayer = null, int $tileSize = 256): OpenStreetMap
{
return new OpenStreetMap($centerMap, $zoom, $imageWidth, $imageHeight, $tileLayer, $tileSize);
}
@@ -36,11 +36,11 @@ class OpenStreetMap
* @param int $padding Padding to add before top left and after bottom right position.
* @param int $imageWidth Width of the generated map image
* @param int $imageHeight Height of the generated map image
* @param TileLayer $tileLayer Tile server configuration, defaults to OpenStreetMaps tile server
* @param TileLayer|null $tileLayer Tile server configuration, defaults to OpenStreetMaps tile server
* @param int $tileSize Tile size in pixels
* @return OpenStreetMap
*/
public static function createFromBoundingBox(LatLng $topLeft, LatLng $bottomRight, int $padding, int $imageWidth, int $imageHeight, TileLayer $tileLayer = null, int $tileSize = 256): OpenStreetMap
public static function createFromBoundingBox(LatLng $topLeft, LatLng $bottomRight, int $padding, int $imageWidth, int $imageHeight, ?TileLayer $tileLayer = null, int $tileSize = 256): OpenStreetMap
{
if ($tileLayer === null) {
$tileLayer = TileLayer::defaultTileLayer();
@@ -73,10 +73,10 @@ class OpenStreetMap
* @param int $zoom Zoom
* @param int $imageWidth Width of the generated map image
* @param int $imageHeight Height of the generated map image
* @param TileLayer $tileLayer Tile server configuration, defaults to OpenStreetMaps tile server
* @param TileLayer|null $tileLayer Tile server configuration, defaults to OpenStreetMaps tile server
* @param int $tileSize Tile size in pixels
*/
public function __construct(LatLng $centerMap, int $zoom, int $imageWidth, int $imageHeight, TileLayer $tileLayer = null, int $tileSize = 256)
public function __construct(LatLng $centerMap, int $zoom, int $imageWidth, int $imageHeight, ?TileLayer $tileLayer = null, int $tileSize = 256)
{
if ($tileLayer === null) {
$tileLayer = TileLayer::defaultTileLayer();

View File

@@ -126,12 +126,12 @@ class Predict_Sat
/** Initialise satellite data.
* @param sat The satellite to initialise.
* @param qth Optional QTH info, use (0,0) if NULL.
* @param qth|null Optional QTH info, use (0,0) if NULL.
*
* This function calculates the satellite data at t = 0, ie. epoch time
* The function is called automatically by gtk_sat_data_read_sat.
*/
public function sat_data_init_sat(Predict_Sat $sat, Predict_QTH $qth = null)
public function sat_data_init_sat(Predict_Sat $sat, ?Predict_QTH $qth = null)
{
$obs_geodetic = new Predict_Geodetic();
$obs_set = new Predict_ObsSet();

View File

@@ -365,10 +365,10 @@ class CI_Encryption {
* Encrypt
*
* @param string $data Input data
* @param array $params Input parameters
* @param array|null $params Input parameters
* @return string
*/
public function encrypt($data, array $params = NULL)
public function encrypt($data, ?array $params = NULL)
{
if (($params = $this->_get_params($params)) === FALSE)
{
@@ -500,10 +500,10 @@ class CI_Encryption {
* Decrypt
*
* @param string $data Encrypted data
* @param array $params Input parameters
* @param array|null $params Input parameters
* @return string
*/
public function decrypt($data, array $params = NULL)
public function decrypt($data, ?array $params = NULL)
{
if (($params = $this->_get_params($params)) === FALSE)
{