Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PHP 8.4] Fixes for implicit nullability deprecation #375

Merged
merged 1 commit into from
Jun 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ function basic($func=NULL) {
* @param $args array
* @param $func callback
**/
function __construct($storage,array $args=NULL,$func=NULL) {
function __construct($storage,?array $args=NULL,$func=NULL) {
if (is_object($storage) && is_a($storage,'DB\Cursor')) {
$this->storage=$storage->dbtype();
$this->mapper=$storage;
Expand Down
16 changes: 8 additions & 8 deletions base.php
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ function split($str,$noempty=TRUE) {
* @param $arg mixed
* @param $stack array
**/
function stringify($arg,array $stack=NULL) {
function stringify($arg,?array $stack=NULL) {
if ($stack) {
foreach ($stack as $node)
if ($arg===$node)
Expand Down Expand Up @@ -1316,7 +1316,7 @@ function ip() {
* @param $trace array|NULL
* @param $format bool
**/
function trace(array $trace=NULL,$format=TRUE) {
function trace(?array $trace=NULL,$format=TRUE) {
if (!$trace) {
$trace=debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
$frame=$trace[0];
Expand Down Expand Up @@ -1364,7 +1364,7 @@ function($frame) use($debug) {
* @param $trace array
* @param $level int
**/
function error($code,$text='',array $trace=NULL,$level=0) {
function error($code,$text='',?array $trace=NULL,$level=0) {
$prior=$this->hive['ERROR'];
$header=$this->status($code);
$req=$this->hive['VERB'].' '.$this->hive['PATH'];
Expand Down Expand Up @@ -1443,7 +1443,7 @@ function error($code,$text='',array $trace=NULL,$level=0) {
* @param $body string
**/
function mock($pattern,
array $args=NULL,array $headers=NULL,$body=NULL) {
?array $args=NULL,?array $headers=NULL,$body=NULL) {
if (!$args)
$args=[];
$types=['sync','ajax','cli'];
Expand Down Expand Up @@ -2929,7 +2929,7 @@ function($val) {
* @param $hive array
* @param $mime string
**/
protected function sandbox(array $hive=NULL,$mime=NULL) {
protected function sandbox(?array $hive=NULL,$mime=NULL) {
$fw=$this->fw;
$implicit=FALSE;
if (is_null($hive)) {
Expand Down Expand Up @@ -2966,7 +2966,7 @@ protected function sandbox(array $hive=NULL,$mime=NULL) {
* @param $hive array
* @param $ttl int
**/
function render($file,$mime='text/html',array $hive=NULL,$ttl=0) {
function render($file,$mime='text/html',?array $hive=NULL,$ttl=0) {
$fw=$this->fw;
$cache=Cache::instance();
foreach ($fw->split($fw->UI) as $dir) {
Expand Down Expand Up @@ -3113,7 +3113,7 @@ function($expr) {
* @param $persist bool
* @param $escape bool
**/
function resolve($node,array $hive=NULL,$ttl=0,$persist=FALSE,$escape=NULL) {
function resolve($node,?array $hive=NULL,$ttl=0,$persist=FALSE,$escape=NULL) {
$hash=null;
$fw=$this->fw;
$cache=Cache::instance();
Expand Down Expand Up @@ -3175,7 +3175,7 @@ function parse($text) {
* @param $hive array
* @param $ttl int
**/
function render($file,$mime='text/html',array $hive=NULL,$ttl=0) {
function render($file,$mime='text/html',?array $hive=NULL,$ttl=0) {
$fw=$this->fw;
$cache=Cache::instance();
if (!is_dir($tmp=$fw->TEMP))
Expand Down
10 changes: 5 additions & 5 deletions db/cursor.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ abstract function cast($obj=NULL);
* @param $options array
* @param $ttl int
**/
abstract function find($filter=NULL,array $options=NULL,$ttl=0);
abstract function find($filter=NULL,?array $options=NULL,$ttl=0);

/**
* Count records that match criteria
Expand All @@ -73,7 +73,7 @@ abstract function find($filter=NULL,array $options=NULL,$ttl=0);
* @param $options array
* @param $ttl int
**/
abstract function count($filter=NULL,array $options=NULL,$ttl=0);
abstract function count($filter=NULL,?array $options=NULL,$ttl=0);

/**
* Insert new record
Expand Down Expand Up @@ -126,7 +126,7 @@ function dry() {
* @param $options array
* @param $ttl int
**/
function findone($filter=NULL,array $options=NULL,$ttl=0) {
function findone($filter=NULL,?array $options=NULL,$ttl=0) {
if (!$options)
$options=[];
// Override limit
Expand All @@ -147,7 +147,7 @@ function findone($filter=NULL,array $options=NULL,$ttl=0) {
* @param $bounce bool
**/
function paginate(
$pos=0,$size=10,$filter=NULL,array $options=NULL,$ttl=0,$bounce=TRUE) {
$pos=0,$size=10,$filter=NULL,?array $options=NULL,$ttl=0,$bounce=TRUE) {
$total=$this->count($filter,$options,$ttl);
$count=(int)ceil($total/$size);
if ($bounce)
Expand All @@ -174,7 +174,7 @@ function paginate(
* @param $options array
* @param $ttl int
**/
function load($filter=NULL,array $options=NULL,$ttl=0) {
function load($filter=NULL,?array $options=NULL,$ttl=0) {
$this->reset();
return ($this->query=$this->find($filter,$options,$ttl)) &&
$this->skip(0)?$this->query[$this->ptr]:FALSE;
Expand Down
2 changes: 1 addition & 1 deletion db/jig.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function &read($file) {
* @param $file string
* @param $data array
**/
function write($file,array $data=NULL) {
function write($file,?array $data=NULL) {
if (!$this->dir || $this->lazy)
return count($this->data[$file]=$data);
$fw=\Base::instance();
Expand Down
4 changes: 2 additions & 2 deletions db/jig/mapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ function($expr) {
* @param $ttl int|array
* @param $log bool
**/
function find($filter=NULL,array $options=NULL,$ttl=0,$log=TRUE) {
function find($filter=NULL,?array $options=NULL,$ttl=0,$log=TRUE) {
if (!$options)
$options=[];
$options+=[
Expand Down Expand Up @@ -352,7 +352,7 @@ function reduce($key,$handler,$finalize=null){
* @param $options array
* @param $ttl int|array
**/
function count($filter=NULL,array $options=NULL,$ttl=0) {
function count($filter=NULL,?array $options=NULL,$ttl=0) {
$now=microtime(TRUE);
$out=count($this->find($filter,$options,$ttl,FALSE));
$this->db->jot('('.sprintf('%.1f',1e3*(microtime(TRUE)-$now)).'ms) '.
Expand Down
2 changes: 1 addition & 1 deletion db/mongo.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ private function __clone() {
* @param $dbname string
* @param $options array
**/
function __construct($dsn,$dbname,array $options=NULL) {
function __construct($dsn,$dbname,?array $options=NULL) {
$this->uuid=\Base::instance()->hash($this->dsn=$dsn);
if ($this->legacy=class_exists('\MongoClient')) {
$this->db=new \MongoDB(new \MongoClient($dsn,$options?:[]),$dbname);
Expand Down
6 changes: 3 additions & 3 deletions db/mongo/mapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function cast($obj=NULL) {
* @param $options array
* @param $ttl int|array
**/
function select($fields=NULL,$filter=NULL,array $options=NULL,$ttl=0) {
function select($fields=NULL,$filter=NULL,?array $options=NULL,$ttl=0) {
if (!$options)
$options=[];
$options+=[
Expand Down Expand Up @@ -199,7 +199,7 @@ function select($fields=NULL,$filter=NULL,array $options=NULL,$ttl=0) {
* @param $options array
* @param $ttl int|array
**/
function find($filter=NULL,array $options=NULL,$ttl=0) {
function find($filter=NULL,?array $options=NULL,$ttl=0) {
if (!$options)
$options=[];
$options+=[
Expand All @@ -218,7 +218,7 @@ function find($filter=NULL,array $options=NULL,$ttl=0) {
* @param $options array
* @param $ttl int|array
**/
function count($filter=NULL,array $options=NULL,$ttl=0) {
function count($filter=NULL,?array $options=NULL,$ttl=0) {
$fw=\Base::instance();
$cache=\Cache::instance();
$tag='';
Expand Down
2 changes: 1 addition & 1 deletion db/sql.php
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ private function __clone() {
* @param $pw string
* @param $options array
**/
function __construct($dsn,$user=NULL,$pw=NULL,array $options=NULL) {
function __construct($dsn,$user=NULL,$pw=NULL,?array $options=NULL) {
$fw=\Base::instance();
$this->uuid=$fw->hash($this->dsn=$dsn);
if (preg_match('/^.+?(?:dbname|database)=(.+?)(?=;|$)/is',$dsn,$parts))
Expand Down
8 changes: 4 additions & 4 deletions db/sql/mapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ function($row) {
* @param $filter string|array
* @param $options array
**/
function stringify($fields,$filter=NULL,array $options=NULL) {
function stringify($fields,$filter=NULL,?array $options=NULL) {
if (!$options)
$options=[];
$options+=[
Expand Down Expand Up @@ -303,7 +303,7 @@ function($parts) use($db) {
* @param $options array
* @param $ttl int|array
**/
function select($fields,$filter=NULL,array $options=NULL,$ttl=0) {
function select($fields,$filter=NULL,?array $options=NULL,$ttl=0) {
list($sql,$args)=$this->stringify($fields,$filter,$options);
$result=$this->db->exec($sql,$args,$ttl);
$out=[];
Expand All @@ -329,7 +329,7 @@ function select($fields,$filter=NULL,array $options=NULL,$ttl=0) {
* @param $options array
* @param $ttl int|array
**/
function find($filter=NULL,array $options=NULL,$ttl=0) {
function find($filter=NULL,?array $options=NULL,$ttl=0) {
if (!$options)
$options=[];
$options+=[
Expand All @@ -355,7 +355,7 @@ function find($filter=NULL,array $options=NULL,$ttl=0) {
* @param $options array
* @param $ttl int|array
**/
function count($filter=NULL,array $options=NULL,$ttl=0) {
function count($filter=NULL,?array $options=NULL,$ttl=0) {
$adhoc=[];
// with grouping involved, we need to wrap the actualy query and count the results
if ($subquery_mode=($options && !empty($options['group']))) {
Expand Down
2 changes: 1 addition & 1 deletion web.php
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ function subst(array &$old,$new) {
* @param $url string
* @param $options array
**/
function request($url,array $options=NULL) {
function request($url,?array $options=NULL) {
$fw=Base::instance();
$parts=parse_url($url);
if (empty($parts['scheme'])) {
Expand Down
2 changes: 1 addition & 1 deletion web/openid.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ protected function discover($proxy) {
* @param $attr array
* @param $reqd string|array
**/
function auth($proxy=NULL,$attr=[],array $reqd=NULL) {
function auth($proxy=NULL,$attr=[],?array $reqd=NULL) {
$fw=\Base::instance();
$root=$fw->SCHEME.'://'.$fw->HOST;
if (empty($this->args['trust_root']))
Expand Down