Skip to content

Commit 2acf6a6

Browse files
committed
PHPStan updates
1 parent 2b766a8 commit 2acf6a6

File tree

3 files changed

+6
-15
lines changed

3 files changed

+6
-15
lines changed

src/PHPFUI/ORM/DataObject.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,14 @@ public function __get(string $field) : mixed
3030
throw new \PHPFUI\ORM\Exception(self::class . " {$field} is not a valid field");
3131
}
3232

33-
public function __set(string $field, mixed $value)
33+
public function __set(string $field, mixed $value) : void
3434
{
3535
if (! \array_key_exists($field, $this->current))
3636
{
3737
throw new \PHPFUI\ORM\Exception(self::class . " {$field} is not defined");
3838
}
3939

4040
$this->current[$field] = $value;
41-
42-
return $value;
4341
}
4442

4543
public function empty() : bool

src/PHPFUI/ORM/Migration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ protected function addIndex(string $table, string | array $fields, string $index
232232
protected function addPrimaryKey(string $table, array $fields) : bool
233233
{
234234
$this->dropPrimaryKey($table);
235-
$keys = implode('`, `', $fields);
235+
$keys = \implode('`, `', $fields);
236236
$this->alters[$table] = ["ADD PRIMARY KEY (`{$keys}`)"];
237237

238238
return true;
@@ -297,7 +297,7 @@ protected function deleteDuplicateRows(string $table, array $keys) : bool
297297
foreach ($keys as $key)
298298
{
299299
// @phpstan-ignore-next-line
300-
if (is_null($row[$key]))
300+
if (null === $row[$key])
301301
{
302302
$where .= "{$comma}`{$key}` is null";
303303
}

src/PHPFUI/ORM/Record.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,7 @@ public function __isset(string $field) : bool
143143
return (bool)(\array_key_exists($field, $this->current) || \array_key_exists($field, static::$virtualFields) || \array_key_exists($field . \PHPFUI\ORM::$idSuffix, $this->current));
144144
}
145145

146-
/**
147-
* Allows for $object->field = $x syntax
148-
*
149-
* @return mixed returns $value so you can string together assignments
150-
*/
151-
public function __set(string $field, $value)
146+
public function __set(string $field, mixed $value) : void
152147
{
153148
$relationship = static::$virtualFields[$field] ?? false;
154149

@@ -158,7 +153,7 @@ public function __set(string $field, $value)
158153
$relationshipObject = new $relationshipClass($this, $field);
159154
$relationshipObject->setValue($value, $relationship);
160155

161-
return $value;
156+
return;
162157
}
163158

164159
$id = $field . \PHPFUI\ORM::$idSuffix;
@@ -180,7 +175,7 @@ public function __set(string $field, $value)
180175
$this->current[$id] = $value->{$id};
181176
}
182177

183-
return $value;
178+
return;
184179
}
185180

186181
$haveType = \PHPFUI\ORM::getBaseClassName($haveType);
@@ -231,8 +226,6 @@ public function __set(string $field, $value)
231226
}
232227
$this->empty = false;
233228
$this->current[$field] = $value;
234-
235-
return $value;
236229
}
237230

238231
/**

0 commit comments

Comments
 (0)