diff options
author | Côme Chilliet <91878298+come-nc@users.noreply.github.com> | 2023-01-20 11:43:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-20 11:43:24 +0100 |
commit | 37bb33c5799b834dfef3fb73936bd0e5a4773fb8 (patch) | |
tree | 0c7dd249075d8bb435589481b1e671e0a3fdbc54 /lib/public | |
parent | fce87f8ddb2d523a503051362a66b7453bc2329b (diff) | |
parent | f32d18d4ea371dbf2ec04c254f91abfd0fa3f4b9 (diff) | |
download | nextcloud-server-37bb33c5799b834dfef3fb73936bd0e5a4773fb8.tar.gz nextcloud-server-37bb33c5799b834dfef3fb73936bd0e5a4773fb8.zip |
Merge pull request #34997 from nextcloud/fix/drop-php-7.4
Drop PHP 7.4 on master
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/AppFramework/Db/Entity.php | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/lib/public/AppFramework/Db/Entity.php b/lib/public/AppFramework/Db/Entity.php index dcd1c77c042..34cd297e57e 100644 --- a/lib/public/AppFramework/Db/Entity.php +++ b/lib/public/AppFramework/Db/Entity.php @@ -29,25 +29,27 @@ use function lcfirst; use function substr; /** - * @method integer getId() - * @method void setId(integer $id) + * @method int getId() + * @method void setId(int $id) * @since 7.0.0 + * @psalm-consistent-constructor */ abstract class Entity { + /** + * @var int + */ public $id; - private $_updatedFields = []; - private $_fieldTypes = ['id' => 'integer']; - + private array $_updatedFields = []; + private array $_fieldTypes = ['id' => 'integer']; /** * Simple alternative constructor for building entities from a request * @param array $params the array which was obtained via $this->params('key') * in the controller - * @return Entity * @since 7.0.0 */ - public static function fromParams(array $params) { + public static function fromParams(array $params): static { $instance = new static(); foreach ($params as $key => $value) { @@ -64,7 +66,7 @@ abstract class Entity { * @param array $row the row to map onto the entity * @since 7.0.0 */ - public static function fromRow(array $row) { + public static function fromRow(array $row): static { $instance = new static(); foreach ($row as $key => $value) { @@ -100,7 +102,7 @@ abstract class Entity { * Generic setter for properties * @since 7.0.0 */ - protected function setter($name, $args) { + protected function setter(string $name, array $args): void { // setters should only work for existing attributes if (property_exists($this, $name)) { if ($this->$name === $args[0]) { @@ -142,7 +144,7 @@ abstract class Entity { * Generic getter for properties * @since 7.0.0 */ - protected function getter($name) { + protected function getter(string $name): mixed { // getters should only work for existing attributes if (property_exists($this, $name)) { return $this->$name; @@ -160,7 +162,7 @@ abstract class Entity { * getter method * @since 7.0.0 */ - public function __call($methodName, $args) { + public function __call(string $methodName, array $args) { if (strpos($methodName, 'set') === 0) { $this->setter(lcfirst(substr($methodName, 3)), $args); } elseif (strpos($methodName, 'get') === 0) { @@ -191,7 +193,7 @@ abstract class Entity { * @param string $attribute the name of the attribute * @since 7.0.0 */ - protected function markFieldUpdated($attribute) { + protected function markFieldUpdated(string $attribute): void { $this->_updatedFields[$attribute] = true; } |