mirror of
https://github.com/standardebooks/web.git
synced 2025-07-09 16:20:27 -04:00
Add type hints and quiet a few other PHPStan complaints
This commit is contained in:
parent
c9ebd71587
commit
9f3104025d
5 changed files with 35 additions and 12 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue