Add type hints and quiet a few other PHPStan complaints

This commit is contained in:
Alex Cabal 2022-02-09 12:56:09 -06:00
parent c9ebd71587
commit 9f3104025d
5 changed files with 35 additions and 12 deletions

View file

@ -3,7 +3,11 @@ use Safe\DateTime;
use function Safe\substr;
abstract class OrmBase{
public static function FillObject($object, $row){
final public function __construct(){
// Satisfy PHPStan and prevent child classes from having their own constructor
}
public static function FillObject(Object $object, array $row): Object{
foreach($row as $property => $value){
if(substr($property, strlen($property) - 9) == 'Timestamp'){
if($value !== null){
@ -25,7 +29,7 @@ abstract class OrmBase{
return $object;
}
public static function FromRow($row){
public static function FromRow(array $row): Object{
return self::FillObject(new static(), $row);
}
}