Set phpstan tmp dir, Basic class check date/time empty date fix

set explicit tmp folder for phpstan to not overlap with other users

Basic class return false for unset date or datetime parameter
This commit is contained in:
Clemens Schwaighofer
2019-09-24 14:12:33 +09:00
parent 98bf11e0c9
commit d04cc380b2
3 changed files with 7 additions and 1 deletions

View File

@@ -1,5 +1,4 @@
<?php
// Boostrap file for PHPstand
// sets the _SERVER['HTTP_HOST'] var so we can have DB detection
$_SERVER['HTTP_HOST'] = 'soba.tokyo.tequila.jp';

View File

@@ -1,6 +1,7 @@
# PHP Stan Config
parameters:
tmpDir: /tmp/phpstan-clemens
level: 1
paths:
- %currentWorkingDirectory%/www

View File

@@ -1664,6 +1664,9 @@ class Basic
*/
public static function checkDate($date): bool
{
if (!$date) {
return false;
}
list ($year, $month, $day) = preg_split("/[\/-]/", $date);
if (!$year || !$month || !$day) {
return false;
@@ -1681,6 +1684,9 @@ class Basic
*/
public static function checkDateTime($datetime): bool
{
if (!$datetime) {
return false;
}
list ($year, $month, $day, $hour, $min, $sec) = preg_split("/[\/\- :]/", $datetime);
if (!$year || !$month || !$day) {
return false;