Ignore:
Timestamp:
Nov 20, 2020, 12:08:12 AM (3 years ago)
Author:
chronos
Message:
  • Added: Static types added to almost all classes, methods and function. Supported by PHP 7.4.
  • Fixed: Various found code issues.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Common/Form/Types/Date.php

    r874 r887  
    55class TypeDate extends TypeBase
    66{
    7   var $DatabaseCompareOperators = array('Rovno' => '=', 'Nerovno' => '!=', 'Menší' => '<', 'Větší' => '>');
     7  function __construct(FormManager $FormManager)
     8  {
     9    parent::__construct($FormManager);
     10    $this->DatabaseCompareOperators = array('Rovno' => '=', 'Nerovno' => '!=', 'Menší' => '<', 'Větší' => '>');
     11  }
    812
    9   function OnView($Item)
     13  function OnView(array $Item): ?string
    1014  {
    11     global $MonthNames;
    12 
    1315    if ($Item['Value'] == null) return '';
    1416    if ((strtolower($Item['Value']) == 'now') or (strtolower($Item['Value']) == '')) $Item['Value'] = time();
     
    1921  }
    2022
    21   function OnEdit($Item)
     23  function OnEdit(array $Item): string
    2224  {
    2325    global $MonthNames;
     
    7476  }
    7577
    76   function OnLoad($Item)
     78  function OnLoad(array $Item): ?string
    7779  {
    7880    if (!array_key_exists($Item['Name'].'-null', $_POST) and array_key_exists('Null', $Item) and ($Item['Null'] == true)) return null;
     
    8082  }
    8183
    82   function OnLoadDb($Item)
     84  function OnLoadDb(array $Item): ?string
    8385  {
    8486    return MysqlDateToTime($Item['Value']);
    8587  }
    8688
    87   function OnSaveDb($Item)
     89  function OnSaveDb(array $Item): ?string
    8890  {
    8991    if ($Item['Value'] == null) return null;
     
    9193  }
    9294
    93   function DatabaseEscape($Value)
     95  function DatabaseEscape(string $Value): string
    9496  {
    9597    return '"'.addslashes($Value).'"';
Note: See TracChangeset for help on using the changeset viewer.