Skip to content

Commit

Permalink
compatible PHP 7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
emondpph committed Apr 5, 2020
1 parent 8bd09f9 commit 7bf7cf9
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Once installed, the **Quid\Base** namespace will be available within your PHP ap

## Requirement
**QuidPHP/Base** requires the following:
- PHP 7.3+ with these extensions:
- PHP 7.3 or 7.4 with these extensions:
- curl
- date
- fileinfo
Expand Down
5 changes: 2 additions & 3 deletions src/Datetime.php
Original file line number Diff line number Diff line change
Expand Up @@ -646,10 +646,9 @@ final public static function parseFormat($key):array
if(is_scalar($format) || is_scalar($timezone))
{
$format = static::getFormatReplace($format,$lang);

$return['format'] = $format['format'];
$return['format'] = (is_array($format))? $format['format']:null;
$return['timezone'] = (is_scalar($timezone) && !empty($timezone))? $timezone:null;
$return['replace'] = (is_array($format['replace']) && !empty($format['replace']))? $format['replace']:null;
$return['replace'] = (is_array($format) && is_array($format['replace']) && !empty($format['replace']))? $format['replace']:null;

if(is_array($replace) && !empty($replace) && Arrs::is($replace))
$return['replace'] = Arrs::replace($return['replace'],$replace);
Expand Down
2 changes: 1 addition & 1 deletion src/Mime.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class Mime extends Root
// retourne vrai si le mime type en est un d'un fichier vide
final public static function isEmpty($value):bool
{
return (is_string($value) && strpos($value,'inode/x-empty') === 0)? true:false;
return is_string($value) && Str::isStarts(['inode/x-empty','application/x-empty'],$value);
}


Expand Down
2 changes: 0 additions & 2 deletions test/Arr.php
Original file line number Diff line number Diff line change
Expand Up @@ -1261,8 +1261,6 @@ final public static function trigger(array $data):bool
// keysLower
$array = [1=>'no',1.2=>'ok','1.2'=>'ok','test'=>'no','TEST'=>'no','tEST'=>'ok','TÉST'=>'mb'];
assert(Base\Arr::keysLower($array,true) === [1=>'ok','1.2'=>'ok','test'=>'ok','tést'=>'mb']);
if($isCli === false)
assert(Base\Arr::keysLower($array,false) === [1=>'ok','1.2'=>'ok','test'=>'ok','tÉst'=>'mb']); // je ne sais pas ce qui cause ceci sur cli

// keysUpper
$array = [1=>'no',1.2=>'ok','1.2'=>'ok','test'=>'no','TEST'=>'no','tEST'=>'ok','téST'=>'mb'];
Expand Down
2 changes: 1 addition & 1 deletion test/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ final public static function trigger(array $data):bool
assert(Base\File::mimeBasename($currentFile,'test.jpg') === 'test.jpg');

// mime
assert(Base\File::mime($temp) === 'inode/x-empty; charset=binary');
assert(Base\Mime::isEmpty(Base\File::mime($temp)));
assert(null === Base\File::mime('bla/bla/bla'));
assert(is_string(Base\File::mime($currentFile)));
assert(!empty(Base\File::mime($array)));
Expand Down
1 change: 1 addition & 0 deletions test/Mime.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ final public static function trigger(array $data):bool
// isEmpty
assert(!Base\Mime::isEmpty('text/csv; charset=us-ascii'));
assert(Base\Mime::isEmpty('inode/x-empty'));
assert(Base\Mime::isEmpty('application/x-empty'));

// isGroup
assert(Base\Mime::isGroup('php',$file,true));
Expand Down
2 changes: 1 addition & 1 deletion test/Nav.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ final public static function trigger(array $data):bool
assert(Base\Nav::pageLast(0,2) === null);

// general
assert(Base\Nav::general(1114,50,4,3)['next'] === null);
assert(Base\Nav::general(1114,50,4,3) === null);
assert(count(Base\Nav::general(4,50,4,3)) === 9);
assert(count(Base\Nav::general(2,[1,2,3,4,5,6,7,8,1,2,3],4,3)) === 9);

Expand Down
2 changes: 1 addition & 1 deletion test/Res.php
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ final public static function trigger(array $data):bool
assert(Base\Res::size($output) === 0);

// mime
assert(Base\Res::mime($fp) === 'inode/x-empty; charset=binary');
assert(Base\Mime::isEmpty(Base\Res::mime($fp)));
assert(strpos(Base\Res::mime($current),'text/x-php;') === 0);
assert(Base\Res::mime($http) === 'image/jpeg');
assert(Base\Res::mime($output) === null);
Expand Down
2 changes: 0 additions & 2 deletions test/Str.php
Original file line number Diff line number Diff line change
Expand Up @@ -869,8 +869,6 @@ final public static function trigger(array $data):bool

// toCamelCase
assert('camelCaseTest' === Base\Str::toCamelCase('_','camel_case_test'));
if($isCli === false)
assert('cameléCaseTest' === Base\Str::toCamelCase('_','camelé_case_test'));
assert('camelCaseTest23' === Base\Str::toCamelCase('_','camel_case_test_2_3'));
assert('testTest23Test4' === Base\Str::toCamelCase('_',['test','test2',3,'3','test4']));
assert('testÉtst23Test4' === Base\Str::toCamelCase('_',['test','étst2',3,'3','test4'],true));
Expand Down

0 comments on commit 7bf7cf9

Please sign in to comment.