diff --git a/app/Config/App.php b/app/Config/App.php index c6eec07a..0a23462b 100644 --- a/app/Config/App.php +++ b/app/Config/App.php @@ -21,10 +21,22 @@ class App extends BaseConfig * and path to your installation. However, you should always configure this * explicitly and never rely on auto-guessing, especially in production * environments. + */ + public string $baseURL = 'http://localhost:8080/'; + + /** + * Allowed Hostnames in the Site URL other than the hostname in the baseURL. + * If you want to accept multiple Hostnames, set this. * - * @var string + * E.g. When your site URL ($baseURL) is 'http://example.com/', and your site + * also accepts 'http://media.example.com/' and + * 'http://accounts.example.com/': + * ['media.example.com', 'accounts.example.com'] + * + * @var string[] + * @phpstan-var list */ - public $baseURL = 'http://localhost:8080/'; + public array $allowedHostnames = []; /** * -------------------------------------------------------------------------- @@ -34,10 +46,8 @@ class App extends BaseConfig * Typically this will be your index.php file, unless you've renamed it to * something else. If you are using mod_rewrite to remove the page set this * variable so that it is blank. - * - * @var string */ - public $indexPage = 'index.php'; + public string $indexPage = 'index.php'; /** * -------------------------------------------------------------------------- @@ -53,10 +63,8 @@ class App extends BaseConfig * 'PATH_INFO' Uses $_SERVER['PATH_INFO'] * * WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded! - * - * @var string */ - public $uriProtocol = 'REQUEST_URI'; + public string $uriProtocol = 'REQUEST_URI'; /** * -------------------------------------------------------------------------- @@ -67,10 +75,8 @@ class App extends BaseConfig * is viewing the site from. It affects the language strings and other * strings (like currency markers, numbers, etc), that your program * should run under for this request. - * - * @var string */ - public $defaultLocale = 'en'; + public string $defaultLocale = 'en'; /** * -------------------------------------------------------------------------- @@ -81,10 +87,8 @@ class App extends BaseConfig * language to use based on the value of the Accept-Language header. * * If false, no automatic detection will be performed. - * - * @var bool */ - public $negotiateLocale = false; + public bool $negotiateLocale = false; /** * -------------------------------------------------------------------------- @@ -97,7 +101,7 @@ class App extends BaseConfig * * @var string[] */ - public $supportedLocales = ['en']; + public array $supportedLocales = ['en']; /** * -------------------------------------------------------------------------- @@ -106,10 +110,8 @@ class App extends BaseConfig * * The default timezone that will be used in your application to display * dates with the date helper, and can be retrieved through app_timezone() - * - * @var string */ - public $appTimezone = 'America/Chicago'; + public string $appTimezone = 'UTC'; /** * -------------------------------------------------------------------------- @@ -120,10 +122,8 @@ class App extends BaseConfig * that require a character set to be provided. * * @see http://php.net/htmlspecialchars for a list of supported charsets. - * - * @var string */ - public $charset = 'UTF-8'; + public string $charset = 'UTF-8'; /** * -------------------------------------------------------------------------- @@ -134,10 +134,8 @@ class App extends BaseConfig * made via a secure connection (HTTPS). If the incoming request is not * secure, the user will be redirected to a secure version of the page * and the HTTP Strict Transport Security header will be set. - * - * @var bool */ - public $forceGlobalSecureRequests = false; + public bool $forceGlobalSecureRequests = false; /** * -------------------------------------------------------------------------- @@ -150,9 +148,9 @@ class App extends BaseConfig * - `CodeIgniter\Session\Handlers\MemcachedHandler` * - `CodeIgniter\Session\Handlers\RedisHandler` * - * @var string + * @deprecated use Config\Session::$driver instead. */ - public $sessionDriver = FileHandler::class; + public string $sessionDriver = FileHandler::class; /** * -------------------------------------------------------------------------- @@ -161,9 +159,9 @@ class App extends BaseConfig * * The session cookie name, must contain only [0-9a-z_-] characters * - * @var string + * @deprecated use Config\Session::$cookieName instead. */ - public $sessionCookieName = 'ci_session'; + public string $sessionCookieName = 'ci_session'; /** * -------------------------------------------------------------------------- @@ -173,9 +171,9 @@ class App extends BaseConfig * The number of SECONDS you want the session to last. * Setting to 0 (zero) means expire when the browser is closed. * - * @var int + * @deprecated use Config\Session::$expiration instead. */ - public $sessionExpiration = 7200; + public int $sessionExpiration = 7200; /** * -------------------------------------------------------------------------- @@ -192,9 +190,9 @@ class App extends BaseConfig * * IMPORTANT: You are REQUIRED to set a valid save path! * - * @var string + * @deprecated use Config\Session::$savePath instead. */ - public $sessionSavePath = WRITEPATH . 'session'; + public string $sessionSavePath = WRITEPATH . 'session'; /** * -------------------------------------------------------------------------- @@ -206,9 +204,9 @@ class App extends BaseConfig * WARNING: If you're using the database driver, don't forget to update * your session table's PRIMARY KEY when changing this setting. * - * @var bool + * @deprecated use Config\Session::$matchIP instead. */ - public $sessionMatchIP = false; + public bool $sessionMatchIP = false; /** * -------------------------------------------------------------------------- @@ -217,9 +215,9 @@ class App extends BaseConfig * * How many seconds between CI regenerating the session ID. * - * @var int + * @deprecated use Config\Session::$timeToUpdate instead. */ - public $sessionTimeToUpdate = 300; + public int $sessionTimeToUpdate = 300; /** * -------------------------------------------------------------------------- @@ -230,9 +228,20 @@ class App extends BaseConfig * when auto-regenerating the session ID. When set to FALSE, the data * will be later deleted by the garbage collector. * - * @var bool + * @deprecated use Config\Session::$regenerateDestroy instead. */ - public $sessionRegenerateDestroy = false; + public bool $sessionRegenerateDestroy = false; + + /** + * -------------------------------------------------------------------------- + * Session Database Group + * -------------------------------------------------------------------------- + * + * DB Group for the database session. + * + * @deprecated use Config\Session::$DBGroup instead. + */ + public ?string $sessionDBGroup = null; /** * -------------------------------------------------------------------------- @@ -241,11 +250,9 @@ class App extends BaseConfig * * Set a cookie name prefix if you need to avoid collisions. * - * @var string - * * @deprecated use Config\Cookie::$prefix property instead. */ - public $cookiePrefix = ''; + public string $cookiePrefix = ''; /** * -------------------------------------------------------------------------- @@ -254,11 +261,9 @@ class App extends BaseConfig * * Set to `.your-domain.com` for site-wide cookies. * - * @var string - * * @deprecated use Config\Cookie::$domain property instead. */ - public $cookieDomain = ''; + public string $cookieDomain = ''; /** * -------------------------------------------------------------------------- @@ -267,11 +272,9 @@ class App extends BaseConfig * * Typically will be a forward slash. * - * @var string - * * @deprecated use Config\Cookie::$path property instead. */ - public $cookiePath = '/'; + public string $cookiePath = '/'; /** * -------------------------------------------------------------------------- @@ -280,11 +283,9 @@ class App extends BaseConfig * * Cookie will only be set if a secure HTTPS connection exists. * - * @var bool - * * @deprecated use Config\Cookie::$secure property instead. */ - public $cookieSecure = false; + public bool $cookieSecure = false; /** * -------------------------------------------------------------------------- @@ -293,11 +294,9 @@ class App extends BaseConfig * * Cookie will only be accessible via HTTP(S) (no JavaScript). * - * @var bool - * * @deprecated use Config\Cookie::$httponly property instead. */ - public $cookieHTTPOnly = true; + public bool $cookieHTTPOnly = true; /** * -------------------------------------------------------------------------- @@ -319,11 +318,9 @@ class App extends BaseConfig * (empty string) means default SameSite attribute set by browsers (`Lax`) * will be set on cookies. If set to `None`, `$cookieSecure` must also be set. * - * @var string|null - * * @deprecated use Config\Cookie::$samesite property instead. */ - public $cookieSameSite = 'Lax'; + public ?string $cookieSameSite = 'Lax'; /** * -------------------------------------------------------------------------- @@ -346,7 +343,7 @@ class App extends BaseConfig * * @var array */ - public $proxyIPs = []; + public array $proxyIPs = []; /** * -------------------------------------------------------------------------- @@ -356,10 +353,8 @@ class App extends BaseConfig * The token name. * * @deprecated Use `Config\Security` $tokenName property instead of using this property. - * - * @var string */ - public $CSRFTokenName = 'csrf_test_name'; + public string $CSRFTokenName = 'csrf_test_name'; /** * -------------------------------------------------------------------------- @@ -369,10 +364,8 @@ class App extends BaseConfig * The header name. * * @deprecated Use `Config\Security` $headerName property instead of using this property. - * - * @var string */ - public $CSRFHeaderName = 'X-CSRF-TOKEN'; + public string $CSRFHeaderName = 'X-CSRF-TOKEN'; /** * -------------------------------------------------------------------------- @@ -382,10 +375,8 @@ class App extends BaseConfig * The cookie name. * * @deprecated Use `Config\Security` $cookieName property instead of using this property. - * - * @var string */ - public $CSRFCookieName = 'csrf_cookie_name'; + public string $CSRFCookieName = 'csrf_cookie_name'; /** * -------------------------------------------------------------------------- @@ -395,10 +386,8 @@ class App extends BaseConfig * The number in seconds the token should expire. * * @deprecated Use `Config\Security` $expire property instead of using this property. - * - * @var int */ - public $CSRFExpire = 7200; + public int $CSRFExpire = 7200; /** * -------------------------------------------------------------------------- @@ -408,10 +397,8 @@ class App extends BaseConfig * Regenerate token on every submission? * * @deprecated Use `Config\Security` $regenerate property instead of using this property. - * - * @var bool */ - public $CSRFRegenerate = true; + public bool $CSRFRegenerate = true; /** * -------------------------------------------------------------------------- @@ -421,10 +408,8 @@ class App extends BaseConfig * Redirect to previous page with error on failure? * * @deprecated Use `Config\Security` $redirect property instead of using this property. - * - * @var bool */ - public $CSRFRedirect = true; + public bool $CSRFRedirect = false; /** * -------------------------------------------------------------------------- @@ -442,10 +427,8 @@ class App extends BaseConfig * @see https://portswigger.net/web-security/csrf/samesite-cookies * * @deprecated `Config\Cookie` $samesite property is used. - * - * @var string */ - public $CSRFSameSite = 'Lax'; + public string $CSRFSameSite = 'Lax'; /** * -------------------------------------------------------------------------- @@ -462,8 +445,6 @@ class App extends BaseConfig * * @see http://www.html5rocks.com/en/tutorials/security/content-security-policy/ * @see http://www.w3.org/TR/CSP/ - * - * @var bool */ - public $CSPEnabled = false; + public bool $CSPEnabled = false; } diff --git a/app/Config/Autoload.php b/app/Config/Autoload.php index 61721a0f..abd9df9d 100644 --- a/app/Config/Autoload.php +++ b/app/Config/Autoload.php @@ -31,12 +31,10 @@ class Autoload extends AutoloadConfig * else you will need to modify all of those classes for this to work. * * Prototype: - *``` * $psr4 = [ * 'CodeIgniter' => SYSTEMPATH, * 'App' => APPPATH * ]; - *``` * * @var array|string> * @phpstan-var array> @@ -57,11 +55,9 @@ class Autoload extends AutoloadConfig * were being autoloaded through a namespace. * * Prototype: - *``` * $classmap = [ * 'MyClass' => '/path/to/class/file.php' * ]; - *``` * * @var array */ @@ -76,13 +72,26 @@ class Autoload extends AutoloadConfig * or for loading functions. * * Prototype: - * ``` - * $files = [ - * '/path/to/my/file.php', - * ]; - * ``` + * $files = [ + * '/path/to/my/file.php', + * ]; * - * @var array + * @var string[] + * @phpstan-var list */ public $files = []; + + /** + * ------------------------------------------------------------------- + * Helpers + * ------------------------------------------------------------------- + * Prototype: + * $helpers = [ + * 'form', + * ]; + * + * @var string[] + * @phpstan-var list + */ + public $helpers = []; } diff --git a/app/Config/CURLRequest.php b/app/Config/CURLRequest.php index b4c8e5c4..6c3ed74a 100644 --- a/app/Config/CURLRequest.php +++ b/app/Config/CURLRequest.php @@ -15,8 +15,6 @@ class CURLRequest extends BaseConfig * * If true, all the options won't be reset between requests. * It may cause an error request with unnecessary headers. - * - * @var bool */ - public $shareOptions = true; + public bool $shareOptions = true; } diff --git a/app/Config/Cache.php b/app/Config/Cache.php index e76c02d8..659d9ed6 100644 --- a/app/Config/Cache.php +++ b/app/Config/Cache.php @@ -19,10 +19,8 @@ class Cache extends BaseConfig * * The name of the preferred handler that should be used. If for some reason * it is not available, the $backupHandler will be used in its place. - * - * @var string */ - public $handler = 'file'; + public string $handler = 'file'; /** * -------------------------------------------------------------------------- @@ -32,10 +30,8 @@ class Cache extends BaseConfig * The name of the handler that will be used in case the first one is * unreachable. Often, 'file' is used here since the filesystem is * always available, though that's not always practical for the app. - * - * @var string */ - public $backupHandler = 'dummy'; + public string $backupHandler = 'dummy'; /** * -------------------------------------------------------------------------- @@ -45,11 +41,9 @@ class Cache extends BaseConfig * The path to where cache files should be stored, if using a file-based * system. * - * @var string - * * @deprecated Use the driver-specific variant under $file */ - public $storePath = WRITEPATH . 'cache/'; + public string $storePath = WRITEPATH . 'cache/'; /** * -------------------------------------------------------------------------- @@ -77,10 +71,8 @@ class Cache extends BaseConfig * * This string is added to all cache item names to help avoid collisions * if you run multiple applications with the same cache engine. - * - * @var string */ - public $prefix = ''; + public string $prefix = ''; /** * -------------------------------------------------------------------------- @@ -92,10 +84,8 @@ class Cache extends BaseConfig * WARNING: This is not used by framework handlers where 60 seconds is * hard-coded, but may be useful to projects and modules. This will replace * the hard-coded value in a future release. - * - * @var int */ - public $ttl = 60; + public int $ttl = 60; /** * -------------------------------------------------------------------------- @@ -106,10 +96,8 @@ class Cache extends BaseConfig * Strings that violate this restriction will cause handlers to throw. * Default: {}()/\@: * Note: The default set is required for PSR-6 compliance. - * - * @var string */ - public $reservedCharacters = '{}()/\@:'; + public string $reservedCharacters = '{}()/\@:'; /** * -------------------------------------------------------------------------- @@ -120,7 +108,7 @@ class Cache extends BaseConfig * * @var array */ - public $file = [ + public array $file = [ 'storePath' => WRITEPATH . 'cache/', 'mode' => 0640, ]; @@ -136,7 +124,7 @@ class Cache extends BaseConfig * * @var array */ - public $memcached = [ + public array $memcached = [ 'host' => '127.0.0.1', 'port' => 11211, 'weight' => 1, @@ -152,7 +140,7 @@ class Cache extends BaseConfig * * @var array */ - public $redis = [ + public array $redis = [ 'host' => '127.0.0.1', 'password' => null, 'port' => 6379, @@ -170,7 +158,7 @@ class Cache extends BaseConfig * * @var array */ - public $validHandlers = [ + public array $validHandlers = [ 'dummy' => DummyHandler::class, 'file' => FileHandler::class, 'memcached' => MemcachedHandler::class, diff --git a/app/Config/ContentSecurityPolicy.php b/app/Config/ContentSecurityPolicy.php index 0be61630..18612e15 100644 --- a/app/Config/ContentSecurityPolicy.php +++ b/app/Config/ContentSecurityPolicy.php @@ -21,27 +21,21 @@ class ContentSecurityPolicy extends BaseConfig /** * Default CSP report context - * - * @var bool */ - public $reportOnly = false; + public bool $reportOnly = false; /** * Specifies a URL where a browser will send reports * when a content security policy is violated. - * - * @var string|null */ - public $reportURI; + public ?string $reportURI = null; /** * Instructs user agents to rewrite URL schemes, changing * HTTP to HTTPS. This directive is for websites with * large numbers of old URLs that need to be rewritten. - * - * @var bool */ - public $upgradeInsecureRequests = false; + public bool $upgradeInsecureRequests = false; // ------------------------------------------------------------------------- // Sources allowed @@ -167,22 +161,16 @@ class ContentSecurityPolicy extends BaseConfig /** * Nonce tag for style - * - * @var string */ - public $styleNonceTag = '{csp-style-nonce}'; + public string $styleNonceTag = '{csp-style-nonce}'; /** * Nonce tag for script - * - * @var string */ - public $scriptNonceTag = '{csp-script-nonce}'; + public string $scriptNonceTag = '{csp-script-nonce}'; /** * Replace nonce tag automatically - * - * @var bool */ - public $autoNonce = true; + public bool $autoNonce = true; } diff --git a/app/Config/Cookie.php b/app/Config/Cookie.php index 8ee01c71..440af5ee 100644 --- a/app/Config/Cookie.php +++ b/app/Config/Cookie.php @@ -13,10 +13,8 @@ class Cookie extends BaseConfig * -------------------------------------------------------------------------- * * Set a cookie name prefix if you need to avoid collisions. - * - * @var string */ - public $prefix = ''; + public string $prefix = ''; /** * -------------------------------------------------------------------------- @@ -37,10 +35,8 @@ class Cookie extends BaseConfig * -------------------------------------------------------------------------- * * Typically will be a forward slash. - * - * @var string */ - public $path = '/'; + public string $path = '/'; /** * -------------------------------------------------------------------------- @@ -48,10 +44,8 @@ class Cookie extends BaseConfig * -------------------------------------------------------------------------- * * Set to `.your-domain.com` for site-wide cookies. - * - * @var string */ - public $domain = ''; + public string $domain = ''; /** * -------------------------------------------------------------------------- @@ -59,10 +53,8 @@ class Cookie extends BaseConfig * -------------------------------------------------------------------------- * * Cookie will only be set if a secure HTTPS connection exists. - * - * @var bool */ - public $secure = false; + public bool $secure = false; /** * -------------------------------------------------------------------------- @@ -70,10 +62,8 @@ class Cookie extends BaseConfig * -------------------------------------------------------------------------- * * Cookie will only be accessible via HTTP(S) (no JavaScript). - * - * @var bool */ - public $httponly = true; + public bool $httponly = true; /** * -------------------------------------------------------------------------- @@ -94,10 +84,8 @@ class Cookie extends BaseConfig * Defaults to `Lax` for compatibility with modern browsers. Setting `''` * (empty string) means default SameSite attribute set by browsers (`Lax`) * will be set on cookies. If set to `None`, `$secure` must also be set. - * - * @var string */ - public $samesite = 'Lax'; + public string $samesite = 'Lax'; /** * -------------------------------------------------------------------------- @@ -110,10 +98,8 @@ class Cookie extends BaseConfig * If this is set to `true`, cookie names should be compliant of RFC 2616's * list of allowed characters. * - * @var bool - * * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#attributes * @see https://tools.ietf.org/html/rfc2616#section-2.2 */ - public $raw = false; + public bool $raw = false; } diff --git a/app/Config/Database.php b/app/Config/Database.php index 87d73b13..2c092124 100644 --- a/app/Config/Database.php +++ b/app/Config/Database.php @@ -12,25 +12,19 @@ class Database extends Config /** * The directory that holds the Migrations * and Seeds directories. - * - * @var string */ - public $filesPath = APPPATH . 'Database' . DIRECTORY_SEPARATOR; + public string $filesPath = APPPATH . 'Database' . DIRECTORY_SEPARATOR; /** * Lets you choose which connection group to * use if no other is specified. - * - * @var string */ - public $defaultGroup = 'default'; + public string $defaultGroup = 'default'; /** * The default database connection. - * - * @var array */ - public $default = [ + public array $default = [ 'DSN' => '', 'hostname' => 'localhost', 'username' => '', @@ -39,7 +33,7 @@ class Database extends Config 'DBDriver' => 'MySQLi', 'DBPrefix' => '', 'pConnect' => false, - 'DBDebug' => (ENVIRONMENT !== 'production'), + 'DBDebug' => true, 'charset' => 'utf8', 'DBCollat' => 'utf8_general_ci', 'swapPre' => '', @@ -53,10 +47,8 @@ class Database extends Config /** * This database connection is used when * running PHPUnit database tests. - * - * @var array */ - public $tests = [ + public array $tests = [ 'DSN' => '', 'hostname' => '127.0.0.1', 'username' => '', @@ -65,7 +57,7 @@ class Database extends Config 'DBDriver' => 'SQLite3', 'DBPrefix' => 'db_', // Needed to ensure we're working correctly with prefixes live. DO NOT REMOVE FOR CI DEVS 'pConnect' => false, - 'DBDebug' => (ENVIRONMENT !== 'production'), + 'DBDebug' => true, 'charset' => 'utf8', 'DBCollat' => 'utf8_general_ci', 'swapPre' => '', @@ -75,6 +67,7 @@ class Database extends Config 'failover' => [], 'port' => 3306, 'foreignKeys' => true, + 'busyTimeout' => 1000, ]; public function __construct() diff --git a/app/Config/DocTypes.php b/app/Config/DocTypes.php index 6f166936..788d68fd 100755 --- a/app/Config/DocTypes.php +++ b/app/Config/DocTypes.php @@ -9,7 +9,7 @@ class DocTypes * * @var array */ - public $list = [ + public array $list = [ 'xhtml11' => '', 'xhtml1-strict' => '', 'xhtml1-trans' => '', @@ -30,4 +30,14 @@ class DocTypes 'xhtml-rdfa-1' => '', 'xhtml-rdfa-2' => '', ]; + + /** + * Whether to remove the solidus (`/`) character for void HTML elements (e.g. ``) + * for HTML5 compatibility. + * + * Set to: + * `true` - to be HTML5 compatible + * `false` - to be XHTML compatible + */ + public bool $html5 = true; } diff --git a/app/Config/Email.php b/app/Config/Email.php index 3a42fbe6..729e8957 100644 --- a/app/Config/Email.php +++ b/app/Config/Email.php @@ -6,165 +6,112 @@ class Email extends BaseConfig { - /** - * @var string - */ - public $fromEmail; - - /** - * @var string - */ - public $fromName; - - /** - * @var string - */ - public $recipients; + public string $fromEmail; + public string $fromName; + public string $recipients; /** * The "user agent" - * - * @var string */ - public $userAgent = 'CodeIgniter'; + public string $userAgent = 'CodeIgniter'; /** * The mail sending protocol: mail, sendmail, smtp - * - * @var string */ - public $protocol = 'mail'; + public string $protocol = 'mail'; /** * The server path to Sendmail. - * - * @var string */ - public $mailPath = '/usr/sbin/sendmail'; + public string $mailPath = '/usr/sbin/sendmail'; /** * SMTP Server Address - * - * @var string */ - public $SMTPHost; + public string $SMTPHost; /** * SMTP Username - * - * @var string */ - public $SMTPUser; + public string $SMTPUser; /** * SMTP Password - * - * @var string */ - public $SMTPPass; + public string $SMTPPass; /** * SMTP Port - * - * @var int */ - public $SMTPPort = 25; + public int $SMTPPort = 25; /** * SMTP Timeout (in seconds) - * - * @var int */ - public $SMTPTimeout = 5; + public int $SMTPTimeout = 5; /** * Enable persistent SMTP connections - * - * @var bool */ - public $SMTPKeepAlive = false; + public bool $SMTPKeepAlive = false; /** * SMTP Encryption. Either tls or ssl - * - * @var string */ - public $SMTPCrypto = 'tls'; + public string $SMTPCrypto = 'tls'; /** * Enable word-wrap - * - * @var bool */ - public $wordWrap = true; + public bool $wordWrap = true; /** * Character count to wrap at - * - * @var int */ - public $wrapChars = 76; + public int $wrapChars = 76; /** * Type of mail, either 'text' or 'html' - * - * @var string */ - public $mailType = 'text'; + public string $mailType = 'text'; /** * Character set (utf-8, iso-8859-1, etc.) - * - * @var string */ - public $charset = 'UTF-8'; + public string $charset = 'UTF-8'; /** * Whether to validate the email address - * - * @var bool */ - public $validate = false; + public bool $validate = false; /** * Email Priority. 1 = highest. 5 = lowest. 3 = normal - * - * @var int */ - public $priority = 3; + public int $priority = 3; /** * Newline character. (Use “\r\n” to comply with RFC 822) - * - * @var string */ - public $CRLF = "\r\n"; + public string $CRLF = "\r\n"; /** * Newline character. (Use “\r\n” to comply with RFC 822) - * - * @var string */ - public $newline = "\r\n"; + public string $newline = "\r\n"; /** * Enable BCC Batch Mode. - * - * @var bool */ - public $BCCBatchMode = false; + public bool $BCCBatchMode = false; /** * Number of emails in each BCC batch - * - * @var int */ - public $BCCBatchSize = 200; + public int $BCCBatchSize = 200; /** * Enable notify message from server - * - * @var bool */ - public $DSN = false; + public bool $DSN = false; } diff --git a/app/Config/Encryption.php b/app/Config/Encryption.php index 07b45a0b..e37b4e2a 100644 --- a/app/Config/Encryption.php +++ b/app/Config/Encryption.php @@ -20,10 +20,8 @@ class Encryption extends BaseConfig * If you use the Encryption class you must set an encryption key (seed). * You need to ensure it is long enough for the cipher and mode you plan to use. * See the user guide for more info. - * - * @var string */ - public $key = ''; + public string $key = ''; /** * -------------------------------------------------------------------------- @@ -35,10 +33,8 @@ class Encryption extends BaseConfig * Available drivers: * - OpenSSL * - Sodium - * - * @var string */ - public $driver = 'OpenSSL'; + public string $driver = 'OpenSSL'; /** * -------------------------------------------------------------------------- @@ -49,10 +45,8 @@ class Encryption extends BaseConfig * before it is encrypted. This value should be greater than zero. * * See the user guide for more information on padding. - * - * @var int */ - public $blockSize = 16; + public int $blockSize = 16; /** * -------------------------------------------------------------------------- @@ -60,8 +54,30 @@ class Encryption extends BaseConfig * -------------------------------------------------------------------------- * * HMAC digest to use, e.g. 'SHA512' or 'SHA256'. Default value is 'SHA512'. + */ + public string $digest = 'SHA512'; + + /** + * Whether the cipher-text should be raw. If set to false, then it will be base64 encoded. + * This setting is only used by OpenSSLHandler. + * + * Set to false for CI3 Encryption compatibility. + */ + public bool $rawData = true; + + /** + * Encryption key info. + * This setting is only used by OpenSSLHandler. + * + * Set to 'encryption' for CI3 Encryption compatibility. + */ + public string $encryptKeyInfo = ''; + + /** + * Authentication key info. + * This setting is only used by OpenSSLHandler. * - * @var string + * Set to 'authentication' for CI3 Encryption compatibility. */ - public $digest = 'SHA512'; + public string $authKeyInfo = ''; } diff --git a/app/Config/Exceptions.php b/app/Config/Exceptions.php index 7cbc78a8..bf3a1b96 100644 --- a/app/Config/Exceptions.php +++ b/app/Config/Exceptions.php @@ -3,6 +3,7 @@ namespace Config; use CodeIgniter\Config\BaseConfig; +use Psr\Log\LogLevel; /** * Setup how the exception handler works. @@ -17,10 +18,8 @@ class Exceptions extends BaseConfig * through Services::Log. * * Default: true - * - * @var bool */ - public $log = true; + public bool $log = true; /** * -------------------------------------------------------------------------- @@ -28,10 +27,8 @@ class Exceptions extends BaseConfig * -------------------------------------------------------------------------- * Any status codes here will NOT be logged if logging is turned on. * By default, only 404 (Page Not Found) exceptions are ignored. - * - * @var array */ - public $ignoreCodes = [404]; + public array $ignoreCodes = [404]; /** * -------------------------------------------------------------------------- @@ -41,10 +38,8 @@ class Exceptions extends BaseConfig * directories that hold the views used to generate errors. * * Default: APPPATH.'Views/errors' - * - * @var string */ - public $errorViewPath = APPPATH . 'Views/errors'; + public string $errorViewPath = APPPATH . 'Views/errors'; /** * -------------------------------------------------------------------------- @@ -53,8 +48,30 @@ class Exceptions extends BaseConfig * Any data that you would like to hide from the debug trace. * In order to specify 2 levels, use "/" to separate. * ex. ['server', 'setup/password', 'secret_token'] + */ + public array $sensitiveDataInTrace = []; + + /** + * -------------------------------------------------------------------------- + * LOG DEPRECATIONS INSTEAD OF THROWING? + * -------------------------------------------------------------------------- + * By default, CodeIgniter converts deprecations into exceptions. Also, + * starting in PHP 8.1 will cause a lot of deprecated usage warnings. + * Use this option to temporarily cease the warnings and instead log those. + * This option also works for user deprecations. + */ + public bool $logDeprecations = true; + + /** + * -------------------------------------------------------------------------- + * LOG LEVEL THRESHOLD FOR DEPRECATIONS + * -------------------------------------------------------------------------- + * If `$logDeprecations` is set to `true`, this sets the log level + * to which the deprecation will be logged. This should be one of the log + * levels recognized by PSR-3. * - * @var array + * The related `Config\Logger::$threshold` should be adjusted, if needed, + * to capture logging the deprecations. */ - public $sensitiveDataInTrace = []; + public string $deprecationLogLevel = LogLevel::WARNING; } diff --git a/app/Config/Feature.php b/app/Config/Feature.php index 4c5ec90c..0bc45c6f 100644 --- a/app/Config/Feature.php +++ b/app/Config/Feature.php @@ -20,10 +20,8 @@ class Feature extends BaseConfig * - CodeIgniter\Router\Router::handle() uses: * - property $filtersInfo, instead of $filterInfo * - CodeIgniter\Router\RouteCollection::getFiltersForRoute(), instead of getFilterForRoute() - * - * @var bool */ - public $multipleFilters = false; + public bool $multipleFilters = false; /** * Use improved new auto routing instead of the default legacy version. diff --git a/app/Config/Filters.php b/app/Config/Filters.php index d0a97238..7b70c4fb 100644 --- a/app/Config/Filters.php +++ b/app/Config/Filters.php @@ -14,10 +14,8 @@ class Filters extends BaseConfig /** * Configures aliases for Filter classes to * make reading things nicer and simpler. - * - * @var array */ - public $aliases = [ + public array $aliases = [ 'csrf' => CSRF::class, 'toolbar' => DebugToolbar::class, 'honeypot' => Honeypot::class, @@ -28,10 +26,8 @@ class Filters extends BaseConfig /** * List of filter aliases that are always * applied before and after every request. - * - * @var array */ - public $globals = [ + public array $globals = [ 'before' => [ // 'honeypot', // 'csrf', @@ -54,10 +50,8 @@ class Filters extends BaseConfig * If you use this, you should disable auto-routing because auto-routing * permits any HTTP method to access a controller. Accessing the controller * with a method you don’t expect could bypass the filter. - * - * @var array */ - public $methods = []; + public array $methods = []; /** * List of filter aliases that should run on any @@ -65,8 +59,6 @@ class Filters extends BaseConfig * * Example: * 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']] - * - * @var array */ - public $filters = []; + public array $filters = []; } diff --git a/app/Config/Format.php b/app/Config/Format.php index d89e4084..749da3e5 100644 --- a/app/Config/Format.php +++ b/app/Config/Format.php @@ -24,7 +24,7 @@ class Format extends BaseConfig * * @var string[] */ - public $supportedResponseFormats = [ + public array $supportedResponseFormats = [ 'application/json', 'application/xml', // machine-readable XML 'text/xml', // human-readable XML @@ -41,7 +41,7 @@ class Format extends BaseConfig * * @var array */ - public $formatters = [ + public array $formatters = [ 'application/json' => JSONFormatter::class, 'application/xml' => XMLFormatter::class, 'text/xml' => XMLFormatter::class, @@ -57,7 +57,7 @@ class Format extends BaseConfig * * @var array */ - public $formatterOptions = [ + public array $formatterOptions = [ 'application/json' => JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES, 'application/xml' => 0, 'text/xml' => 0, diff --git a/app/Config/Generators.php b/app/Config/Generators.php index 11214fdc..01b1ef2b 100644 --- a/app/Config/Generators.php +++ b/app/Config/Generators.php @@ -25,7 +25,7 @@ class Generators extends BaseConfig * * @var array */ - public $views = [ + public array $views = [ 'make:command' => 'CodeIgniter\Commands\Generators\Views\command.tpl.php', 'make:config' => 'CodeIgniter\Commands\Generators\Views\config.tpl.php', 'make:controller' => 'CodeIgniter\Commands\Generators\Views\controller.tpl.php', diff --git a/app/Config/Honeypot.php b/app/Config/Honeypot.php index 42b5a0dc..67ebcb0e 100644 --- a/app/Config/Honeypot.php +++ b/app/Config/Honeypot.php @@ -8,36 +8,35 @@ class Honeypot extends BaseConfig { /** * Makes Honeypot visible or not to human - * - * @var bool */ - public $hidden = true; + public bool $hidden = true; /** * Honeypot Label Content - * - * @var string */ - public $label = 'Fill This Field'; + public string $label = 'Fill This Field'; /** * Honeypot Field Name - * - * @var string */ - public $name = 'honeypot'; + public string $name = 'honeypot'; /** * Honeypot HTML Template - * - * @var string */ - public $template = ''; + public string $template = ''; /** * Honeypot container * - * @var string + * If you enabled CSP, you can remove `style="display:none"`. + */ + public string $container = '
{template}
'; + + /** + * The id attribute for Honeypot container tag + * + * Used when CSP is enabled. */ - public $container = '
{template}
'; + public string $containerId = 'hpc'; } diff --git a/app/Config/Images.php b/app/Config/Images.php index 1c15d815..a33ddadb 100644 --- a/app/Config/Images.php +++ b/app/Config/Images.php @@ -10,25 +10,21 @@ class Images extends BaseConfig { /** * Default handler used if no other handler is specified. - * - * @var string */ - public $defaultHandler = 'gd'; + public string $defaultHandler = 'gd'; /** * The path to the image library. * Required for ImageMagick, GraphicsMagick, or NetPBM. - * - * @var string */ - public $libraryPath = '/usr/local/bin/convert'; + public string $libraryPath = '/usr/local/bin/convert'; /** * The available handler classes. * * @var array */ - public $handlers = [ + public array $handlers = [ 'gd' => GDHandler::class, 'imagick' => ImageMagickHandler::class, ]; diff --git a/app/Config/Kint.php b/app/Config/Kint.php index b1016ed5..7e0a0157 100644 --- a/app/Config/Kint.php +++ b/app/Config/Kint.php @@ -3,7 +3,7 @@ namespace Config; use CodeIgniter\Config\BaseConfig; -use Kint\Renderer\Renderer; +use Kint\Renderer\AbstractRenderer; /** * -------------------------------------------------------------------------- @@ -24,18 +24,18 @@ class Kint extends BaseConfig */ public $plugins; - public $maxDepth = 6; - public $displayCalledFrom = true; - public $expanded = false; + public int $maxDepth = 6; + public bool $displayCalledFrom = true; + public bool $expanded = false; /* |-------------------------------------------------------------------------- | RichRenderer Settings |-------------------------------------------------------------------------- */ - public $richTheme = 'aante-light.css'; - public $richFolder = false; - public $richSort = Renderer::SORT_FULL; + public string $richTheme = 'aante-light.css'; + public bool $richFolder = false; + public int $richSort = AbstractRenderer::SORT_FULL; public $richObjectPlugins; public $richTabPlugins; @@ -44,8 +44,8 @@ class Kint extends BaseConfig | CLI Settings |-------------------------------------------------------------------------- */ - public $cliColors = true; - public $cliForceUTF8 = false; - public $cliDetectWidth = true; - public $cliMinWidth = 40; + public bool $cliColors = true; + public bool $cliForceUTF8 = false; + public bool $cliDetectWidth = true; + public int $cliMinWidth = 40; } diff --git a/app/Config/Logger.php b/app/Config/Logger.php index 1dfeb339..7c7414d4 100644 --- a/app/Config/Logger.php +++ b/app/Config/Logger.php @@ -38,7 +38,7 @@ class Logger extends BaseConfig * * @var array|int */ - public $threshold = 4; + public $threshold = (ENVIRONMENT === 'production') ? 4 : 9; /** * -------------------------------------------------------------------------- @@ -47,10 +47,8 @@ class Logger extends BaseConfig * * Each item that is logged has an associated date. You can use PHP date * codes to set your own date formatting - * - * @var string */ - public $dateFormat = 'Y-m-d H:i:s'; + public string $dateFormat = 'Y-m-d H:i:s'; /** * -------------------------------------------------------------------------- @@ -60,7 +58,7 @@ class Logger extends BaseConfig * The logging system supports multiple actions to be taken when something * is logged. This is done by allowing for multiple Handlers, special classes * designed to write the log to their chosen destinations, whether that is - * a file on the server, a cloud-based service, or even taking actions such + * a file on the getServer, a cloud-based service, or even taking actions such * as emailing the dev team. * * Each handler is defined by the class name used for that handler, and it @@ -74,10 +72,8 @@ class Logger extends BaseConfig * * Handlers are executed in the order defined in this array, starting with * the handler on top and continuing down. - * - * @var array */ - public $handlers = [ + public array $handlers = [ /* * -------------------------------------------------------------------- diff --git a/app/Config/Migrations.php b/app/Config/Migrations.php index 604e059a..af28e8ef 100644 --- a/app/Config/Migrations.php +++ b/app/Config/Migrations.php @@ -15,10 +15,8 @@ class Migrations extends BaseConfig * * You should enable migrations whenever you intend to do a schema migration * and disable it back when you're done. - * - * @var bool */ - public $enabled = true; + public bool $enabled = true; /** * -------------------------------------------------------------------------- @@ -30,10 +28,8 @@ class Migrations extends BaseConfig * level the system is at. It then compares the migration level in this * table to the $config['migration_version'] if they are not the same it * will migrate up. This must be set. - * - * @var string */ - public $table = 'migrations'; + public string $table = 'migrations'; /** * -------------------------------------------------------------------------- @@ -51,8 +47,6 @@ class Migrations extends BaseConfig * - YmdHis_ * - Y-m-d-His_ * - Y_m_d_His_ - * - * @var string */ - public $timestampFormat = 'Y-m-d-His_'; + public string $timestampFormat = 'Y-m-d-His_'; } diff --git a/app/Config/Mimes.php b/app/Config/Mimes.php index 884e76bc..6b06c4e3 100644 --- a/app/Config/Mimes.php +++ b/app/Config/Mimes.php @@ -20,10 +20,8 @@ class Mimes { /** * Map of extensions to mime types. - * - * @var array */ - public static $mimes = [ + public static array $mimes = [ 'hqx' => [ 'application/mac-binhex40', 'application/mac-binhex', diff --git a/app/Config/Modules.php b/app/Config/Modules.php index bde4079f..5b6a639b 100644 --- a/app/Config/Modules.php +++ b/app/Config/Modules.php @@ -31,6 +31,29 @@ class Modules extends BaseModules */ public $discoverInComposer = true; + /** + * The Composer package list for Auto-Discovery + * This setting is optional. + * + * E.g.: + * [ + * 'only' => [ + * // List up all packages to auto-discover + * 'codeigniter4/shield', + * ], + * ] + * or + * [ + * 'exclude' => [ + * // List up packages to exclude. + * 'pestphp/pest', + * ], + * ] + * + * @var array + */ + public $composerPackages = []; + /** * -------------------------------------------------------------------------- * Auto-Discovery Rules diff --git a/app/Config/Pager.php b/app/Config/Pager.php index 92257538..e341f4d3 100644 --- a/app/Config/Pager.php +++ b/app/Config/Pager.php @@ -20,7 +20,7 @@ class Pager extends BaseConfig * * @var array */ - public $templates = [ + public array $templates = [ 'default_full' => 'CodeIgniter\Pager\Views\default_full', 'default_simple' => 'CodeIgniter\Pager\Views\default_simple', 'default_head' => 'CodeIgniter\Pager\Views\default_head', @@ -32,8 +32,6 @@ class Pager extends BaseConfig * -------------------------------------------------------------------------- * * The default number of results shown in a single page. - * - * @var int */ - public $perPage = 20; + public int $perPage = 20; } diff --git a/app/Config/Paths.php b/app/Config/Paths.php index 3ff97302..d0035fbc 100644 --- a/app/Config/Paths.php +++ b/app/Config/Paths.php @@ -22,10 +22,8 @@ class Paths * * This must contain the name of your "system" folder. Include * the path if the folder is not in the same directory as this file. - * - * @var string */ - public $systemDirectory = __DIR__ . '/../../vendor/codeigniter4/framework/system'; + public string $systemDirectory = __DIR__ . '/../../vendor/codeigniter4/framework/system'; /** * --------------------------------------------------------------- @@ -38,10 +36,8 @@ class Paths * you do, use a full server path. * * @see http://codeigniter.com/user_guide/general/managing_apps.html - * - * @var string */ - public $appDirectory = __DIR__ . '/..'; + public string $appDirectory = __DIR__ . '/..'; /** * --------------------------------------------------------------- @@ -53,10 +49,8 @@ class Paths * need write permission to a single place that can be tucked away * for maximum security, keeping it out of the app and/or * system directories. - * - * @var string */ - public $writableDirectory = __DIR__ . '/../../writable'; + public string $writableDirectory = __DIR__ . '/../../writable'; /** * --------------------------------------------------------------- @@ -64,10 +58,8 @@ class Paths * --------------------------------------------------------------- * * This variable must contain the name of your "tests" directory. - * - * @var string */ - public $testsDirectory = __DIR__ . '/../../tests'; + public string $testsDirectory = __DIR__ . '/../../tests'; /** * --------------------------------------------------------------- @@ -78,8 +70,6 @@ class Paths * contains the view files used by your application. By * default this is in `app/Views`. This value * is used when no value is provided to `Services::renderer()`. - * - * @var string */ - public $viewDirectory = __DIR__ . '/../Views'; + public string $viewDirectory = __DIR__ . '/../Views'; } diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 0bfdce97..c251ec22 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -5,12 +5,6 @@ // Create a new instance of our RouteCollection class. $routes = Services::routes(); -// Load the system's routing file first, so that the app and ENVIRONMENT -// can override as needed. -if (is_file(SYSTEMPATH . 'Config/Routes.php')) { - require SYSTEMPATH . 'Config/Routes.php'; -} - /* * -------------------------------------------------------------------- * Router Setup diff --git a/app/Config/Security.php b/app/Config/Security.php index 107bd954..57be4ee4 100644 --- a/app/Config/Security.php +++ b/app/Config/Security.php @@ -15,7 +15,7 @@ class Security extends BaseConfig * * @var string 'cookie' or 'session' */ - public $csrfProtection = 'cookie'; + public string $csrfProtection = 'cookie'; /** * -------------------------------------------------------------------------- @@ -23,10 +23,8 @@ class Security extends BaseConfig * -------------------------------------------------------------------------- * * Randomize the CSRF Token for added security. - * - * @var bool */ - public $tokenRandomize = false; + public bool $tokenRandomize = false; /** * -------------------------------------------------------------------------- @@ -34,10 +32,8 @@ class Security extends BaseConfig * -------------------------------------------------------------------------- * * Token name for Cross Site Request Forgery protection. - * - * @var string */ - public $tokenName = 'csrf_test_name'; + public string $tokenName = 'csrf_test_name'; /** * -------------------------------------------------------------------------- @@ -45,10 +41,8 @@ class Security extends BaseConfig * -------------------------------------------------------------------------- * * Header name for Cross Site Request Forgery protection. - * - * @var string */ - public $headerName = 'X-CSRF-TOKEN'; + public string $headerName = 'X-CSRF-TOKEN'; /** * -------------------------------------------------------------------------- @@ -56,10 +50,8 @@ class Security extends BaseConfig * -------------------------------------------------------------------------- * * Cookie name for Cross Site Request Forgery protection. - * - * @var string */ - public $cookieName = 'csrf_cookie_name'; + public string $cookieName = 'csrf_cookie_name'; /** * -------------------------------------------------------------------------- @@ -69,10 +61,8 @@ class Security extends BaseConfig * Expiration time for Cross Site Request Forgery protection cookie. * * Defaults to two hours (in seconds). - * - * @var int */ - public $expires = 7200; + public int $expires = 7200; /** * -------------------------------------------------------------------------- @@ -80,10 +70,8 @@ class Security extends BaseConfig * -------------------------------------------------------------------------- * * Regenerate CSRF Token on every submission. - * - * @var bool */ - public $regenerate = true; + public bool $regenerate = true; /** * -------------------------------------------------------------------------- @@ -91,10 +79,8 @@ class Security extends BaseConfig * -------------------------------------------------------------------------- * * Redirect to previous page with error on failure. - * - * @var bool */ - public $redirect = true; + public bool $redirect = false; /** * -------------------------------------------------------------------------- @@ -109,9 +95,7 @@ class Security extends BaseConfig * * @see https://portswigger.net/web-security/csrf/samesite-cookies * - * @var string - * * @deprecated `Config\Cookie` $samesite property is used. */ - public $samesite = 'Lax'; + public string $samesite = 'Lax'; } diff --git a/app/Config/Session.php b/app/Config/Session.php new file mode 100644 index 00000000..ea834805 --- /dev/null +++ b/app/Config/Session.php @@ -0,0 +1,102 @@ + + */ + public string $driver = FileHandler::class; + + /** + * -------------------------------------------------------------------------- + * Session Cookie Name + * -------------------------------------------------------------------------- + * + * The session cookie name, must contain only [0-9a-z_-] characters + */ + public string $cookieName = 'ci_session'; + + /** + * -------------------------------------------------------------------------- + * Session Expiration + * -------------------------------------------------------------------------- + * + * The number of SECONDS you want the session to last. + * Setting to 0 (zero) means expire when the browser is closed. + */ + public int $expiration = 7200; + + /** + * -------------------------------------------------------------------------- + * Session Save Path + * -------------------------------------------------------------------------- + * + * The location to save sessions to and is driver dependent. + * + * For the 'files' driver, it's a path to a writable directory. + * WARNING: Only absolute paths are supported! + * + * For the 'database' driver, it's a table name. + * Please read up the manual for the format with other session drivers. + * + * IMPORTANT: You are REQUIRED to set a valid save path! + */ + public string $savePath = WRITEPATH . 'session'; + + /** + * -------------------------------------------------------------------------- + * Session Match IP + * -------------------------------------------------------------------------- + * + * Whether to match the user's IP address when reading the session data. + * + * WARNING: If you're using the database driver, don't forget to update + * your session table's PRIMARY KEY when changing this setting. + */ + public bool $matchIP = false; + + /** + * -------------------------------------------------------------------------- + * Session Time to Update + * -------------------------------------------------------------------------- + * + * How many seconds between CI regenerating the session ID. + */ + public int $timeToUpdate = 300; + + /** + * -------------------------------------------------------------------------- + * Session Regenerate Destroy + * -------------------------------------------------------------------------- + * + * Whether to destroy session data associated with the old session ID + * when auto-regenerating the session ID. When set to FALSE, the data + * will be later deleted by the garbage collector. + */ + public bool $regenerateDestroy = false; + + /** + * -------------------------------------------------------------------------- + * Session Database Group + * -------------------------------------------------------------------------- + * + * DB Group for the database session. + */ + public ?string $DBGroup = null; +} diff --git a/app/Config/Toolbar.php b/app/Config/Toolbar.php index 2860f74d..ecab7a2c 100644 --- a/app/Config/Toolbar.php +++ b/app/Config/Toolbar.php @@ -33,7 +33,7 @@ class Toolbar extends BaseConfig * * @var string[] */ - public $collectors = [ + public array $collectors = [ Timers::class, Database::class, Logs::class, @@ -51,10 +51,8 @@ class Toolbar extends BaseConfig * * If set to false var data from the views will not be colleted. Useful to * avoid high memory usage when there are lots of data passed to the view. - * - * @var bool */ - public $collectVarData = true; + public bool $collectVarData = true; /** * -------------------------------------------------------------------------- @@ -64,10 +62,8 @@ class Toolbar extends BaseConfig * `$maxHistory` sets a limit on the number of past requests that are stored, * helping to conserve file space used to store them. You can set it to * 0 (zero) to not have any history stored, or -1 for unlimited history. - * - * @var int */ - public $maxHistory = 20; + public int $maxHistory = 20; /** * -------------------------------------------------------------------------- @@ -76,10 +72,8 @@ class Toolbar extends BaseConfig * * The full path to the the views that are used by the toolbar. * This MUST have a trailing slash. - * - * @var string */ - public $viewsPath = SYSTEMPATH . 'Debug/Toolbar/Views/'; + public string $viewsPath = SYSTEMPATH . 'Debug/Toolbar/Views/'; /** * -------------------------------------------------------------------------- @@ -92,8 +86,6 @@ class Toolbar extends BaseConfig * with hundreds of queries. * * `$maxQueries` defines the maximum amount of queries that will be stored. - * - * @var int */ - public $maxQueries = 100; + public int $maxQueries = 100; } diff --git a/app/Config/UserAgents.php b/app/Config/UserAgents.php index e1dbfa63..fda73748 100644 --- a/app/Config/UserAgents.php +++ b/app/Config/UserAgents.php @@ -23,7 +23,7 @@ class UserAgents extends BaseConfig * * @var array */ - public $platforms = [ + public array $platforms = [ 'windows nt 10.0' => 'Windows 10', 'windows nt 6.3' => 'Windows 8.1', 'windows nt 6.2' => 'Windows 8', @@ -78,7 +78,7 @@ class UserAgents extends BaseConfig * * @var array */ - public $browsers = [ + public array $browsers = [ 'OPR' => 'Opera', 'Flock' => 'Flock', 'Edge' => 'Spartan', @@ -119,7 +119,7 @@ class UserAgents extends BaseConfig * * @var array */ - public $mobiles = [ + public array $mobiles = [ // legacy array, old values commented out 'mobileexplorer' => 'Mobile Explorer', // 'openwave' => 'Open Wave', @@ -228,7 +228,7 @@ class UserAgents extends BaseConfig * * @var array */ - public $robots = [ + public array $robots = [ 'googlebot' => 'Googlebot', 'msnbot' => 'MSNBot', 'baiduspider' => 'Baiduspider', diff --git a/app/Config/Validation.php b/app/Config/Validation.php index e0a03bdf..017dac5a 100644 --- a/app/Config/Validation.php +++ b/app/Config/Validation.php @@ -3,10 +3,10 @@ namespace Config; use CodeIgniter\Config\BaseConfig; -use CodeIgniter\Validation\CreditCardRules; -use CodeIgniter\Validation\FileRules; -use CodeIgniter\Validation\FormatRules; -use CodeIgniter\Validation\Rules; +use CodeIgniter\Validation\StrictRules\CreditCardRules; +use CodeIgniter\Validation\StrictRules\FileRules; +use CodeIgniter\Validation\StrictRules\FormatRules; +use CodeIgniter\Validation\StrictRules\Rules; class Validation extends BaseConfig { @@ -20,7 +20,7 @@ class Validation extends BaseConfig * * @var string[] */ - public $ruleSets = [ + public array $ruleSets = [ Rules::class, FormatRules::class, FileRules::class, @@ -33,7 +33,7 @@ class Validation extends BaseConfig * * @var array */ - public $templates = [ + public array $templates = [ 'list' => 'CodeIgniter\Validation\Views\list', 'single' => 'CodeIgniter\Validation\Views\single', ]; diff --git a/app/Views/errors/html/error_404.php b/app/Views/errors/html/error_404.php index 5ba9f8ad..c3010132 100644 --- a/app/Views/errors/html/error_404.php +++ b/app/Views/errors/html/error_404.php @@ -2,7 +2,7 @@ - 404 Page Not Found + <?= lang('Errors.pageNotFound') ?> - diff --git a/app/Views/errors/html/production.php b/app/Views/errors/html/production.php index 9faa4a15..2f59a8de 100644 --- a/app/Views/errors/html/production.php +++ b/app/Views/errors/html/production.php @@ -4,9 +4,9 @@ - Whoops! + <?= lang('Errors.whoops') ?> - @@ -14,9 +14,9 @@
-

Whoops!

+

-

We seem to have hit a snag. Please try again later...

+

diff --git a/app/Views/welcome_message.php b/app/Views/welcome_message.php index 57489116..6d5da23f 100644 --- a/app/Views/welcome_message.php +++ b/app/Views/welcome_message.php @@ -5,7 +5,7 @@ Welcome to CodeIgniter 4! - + diff --git a/env b/env index 9dede2ea..cb99e19c 100644 --- a/env +++ b/env @@ -24,15 +24,6 @@ # If you have trouble with `.`, you could also use `_`. # app_baseURL = '' # app.forceGlobalSecureRequests = false - -# app.sessionDriver = 'CodeIgniter\Session\Handlers\FileHandler' -# app.sessionCookieName = 'ci_session' -# app.sessionExpiration = 7200 -# app.sessionSavePath = null -# app.sessionMatchIP = false -# app.sessionTimeToUpdate = 300 -# app.sessionRegenerateDestroy = false - # app.CSPEnabled = false #-------------------------------------------------------------------- @@ -124,9 +115,21 @@ # security.cookieName = 'csrf_cookie_name' # security.expires = 7200 # security.regenerate = true -# security.redirect = true +# security.redirect = false # security.samesite = 'Lax' +#-------------------------------------------------------------------- +# SESSION +#-------------------------------------------------------------------- + +# session.driver = 'CodeIgniter\Session\Handlers\FileHandler' +# session.cookieName = 'ci_session' +# session.expiration = 7200 +# session.savePath = null +# session.matchIP = false +# session.timeToUpdate = 300 +# session.regenerateDestroy = false + #-------------------------------------------------------------------- # LOGGER #-------------------------------------------------------------------- diff --git a/spark b/spark index 49a00aa8..f2ba3f30 100755 --- a/spark +++ b/spark @@ -81,10 +81,9 @@ require_once SYSTEMPATH . 'Config/DotEnv.php'; // Grab our CodeIgniter $app = Config\Services::codeigniter(); $app->initialize(); -$app->setContext('spark'); // Grab our Console -$console = new CodeIgniter\CLI\Console($app); +$console = new CodeIgniter\CLI\Console(); // Show basic information before we do anything else. if (is_int($suppress = array_search('--no-header', $_SERVER['argv'], true))) { @@ -95,8 +94,6 @@ if (is_int($suppress = array_search('--no-header', $_SERVER['argv'], true))) { $console->showHeader($suppress); // fire off the command in the main framework. -$response = $console->run(); +$exit = $console->run(); -if ($response->getStatusCode() >= 300) { - exit($response->getStatusCode()); -} +exit(is_int($exit) ? $exit : EXIT_SUCCESS);