Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into 4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Oct 14, 2022
2 parents ce7de2d + a3eedf4 commit 16e2b14
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 17 deletions.
4 changes: 3 additions & 1 deletion admin/framework/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"kint-php/kint": "^4.2",
"codeigniter/coding-standard": "^1.5",
"fakerphp/faker": "^1.9",
"friendsofphp/php-cs-fixer": "~3.11.0",
"friendsofphp/php-cs-fixer": "~3.12.0",
"mikey179/vfsstream": "^1.6",
"nexusphp/cs-config": "^3.6",
"phpunit/phpunit": "^9.1",
Expand All @@ -34,6 +34,8 @@
"ext-memcache": "If you use Cache class MemcachedHandler with Memcache",
"ext-memcached": "If you use Cache class MemcachedHandler with Memcached",
"ext-redis": "If you use Cache class RedisHandler",
"ext-dom": "If you use TestResponse",
"ext-libxml": "If you use TestResponse",
"ext-fileinfo": "Improves mime type detection for files",
"ext-readline": "Improves CLI::input() usability"
},
Expand Down
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"kint-php/kint": "^4.2",
"codeigniter/coding-standard": "^1.5",
"fakerphp/faker": "^1.9",
"friendsofphp/php-cs-fixer": "~3.11.0",
"friendsofphp/php-cs-fixer": "~3.12.0",
"mikey179/vfsstream": "^1.6",
"nexusphp/cs-config": "^3.6",
"nexusphp/tachycardia": "^1.0",
Expand All @@ -38,6 +38,8 @@
"ext-memcache": "If you use Cache class MemcachedHandler with Memcache",
"ext-memcached": "If you use Cache class MemcachedHandler with Memcached",
"ext-redis": "If you use Cache class RedisHandler",
"ext-dom": "If you use TestResponse",
"ext-libxml": "If you use TestResponse",
"ext-fileinfo": "Improves mime type detection for files",
"ext-readline": "Improves CLI::input() usability"
},
Expand Down
11 changes: 10 additions & 1 deletion system/Validation/FormatRules.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,15 @@ public function valid_date(?string $str = null, ?string $format = null): bool
$date = DateTime::createFromFormat($format, $str);
$errors = DateTime::getLastErrors();

return $date !== false && $errors !== false && $errors['warning_count'] === 0 && $errors['error_count'] === 0;
if ($date === false) {
return false;
}

// PHP 8.2 or later.
if ($errors === false) {
return true;
}

return $errors['warning_count'] === 0 && $errors['error_count'] === 0;
}
}
4 changes: 2 additions & 2 deletions tests/_support/Log/Handlers/TestHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public function __construct(array $config)
* will stop. Any handlers that have not run, yet, will not
* be run.
*
* @param $level
* @param $message
* @param string $level
* @param string $message
*/
public function handle($level, $message): bool
{
Expand Down
11 changes: 2 additions & 9 deletions tests/system/Config/MimesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,8 @@ public function extensionsList()

/**
* @dataProvider extensionsList
*
* @param $expected
* @param $ext
* @param mixed $mime
*/
public function testGuessExtensionFromType($expected, $mime)
public function testGuessExtensionFromType(?string $expected, string $mime)
{
$this->assertSame($expected, Mimes::guessExtensionFromType($mime));
}
Expand Down Expand Up @@ -85,11 +81,8 @@ public function mimesList()

/**
* @dataProvider mimesList
*
* @param mixed $expected
* @param mixed $ext
*/
public function testGuessTypeFromExtension($expected, $ext)
public function testGuessTypeFromExtension(?string $expected, string $ext)
{
$this->assertSame($expected, Mimes::guessTypeFromExtension($ext));
}
Expand Down
3 changes: 0 additions & 3 deletions tests/system/Validation/FormatRulesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,6 @@ public function stringProvider(): Generator

/**
* @dataProvider alphaProvider
*
* @param $str
* @param $expected
*/
public function testAlpha(?string $str, bool $expected): void
{
Expand Down

0 comments on commit 16e2b14

Please sign in to comment.