From 385b3f4adf86606e03941171c136d8f2eb2b35c2 Mon Sep 17 00:00:00 2001 From: n-peugnet Date: Fri, 24 Apr 2020 16:36:12 +0200 Subject: fix: most of PHPStan errors --- app/class/Item.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app/class/Item.php') diff --git a/app/class/Item.php b/app/class/Item.php index 8a8f2d6..a76e700 100644 --- a/app/class/Item.php +++ b/app/class/Item.php @@ -33,7 +33,7 @@ abstract class Item public function dry() { $array = []; - foreach ($this as $var => $value) { + foreach (get_object_vars($this) as $var => $value) { $array[$var] = $this->$var(); } return $array; @@ -74,13 +74,13 @@ abstract class Item } elseif ($option == 'date' || $option == 'sort') { return $this->$property; } elseif ($option == 'hrdi') { - $now = new DateTimeImmutable(null, timezone_open("Europe/Paris")); + $now = new DateTimeImmutable("now", timezone_open("Europe/Paris")); return hrdi($this->$property->diff($now)); } elseif ($option == 'pdate') { return $this->$property->format('Y-m-d'); } elseif ($option == 'ptime') { return $this->$property->format('H:i'); - } elseif ($option = 'dmy') { + } elseif ($option == 'dmy') { return $this->$property->format('d/m/Y'); } } else { -- cgit v1.2.3