diff --git a/composer.json b/composer.json index 45d54d1..8c22d20 100644 --- a/composer.json +++ b/composer.json @@ -29,5 +29,8 @@ "composer/installers": true, "wikimedia/composer-merge-plugin": false } + }, + "require-dev": { + "phpstan/phpstan": "^1.10" } } diff --git a/composer.lock b/composer.lock index 1643481..f2a9bf7 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "157cc1ef2fbb3b5667fd0b539ce87b27", + "content-hash": "c76eb19b0eb02b6a9fccb4b63f50d165", "packages": [ { "name": "chillerlan/php-qrcode", @@ -1545,7 +1545,70 @@ "time": "2023-06-08T12:52:13+00:00" } ], - "packages-dev": [], + "packages-dev": [ + { + "name": "phpstan/phpstan", + "version": "1.10.26", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "5d660cbb7e1b89253a47147ae44044f49832351f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/5d660cbb7e1b89253a47147ae44044f49832351f", + "reference": "5d660cbb7e1b89253a47147ae44044f49832351f", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "docs": "https://phpstan.org/user-guide/getting-started", + "forum": "https://github.com/phpstan/phpstan/discussions", + "issues": "https://github.com/phpstan/phpstan/issues", + "security": "https://github.com/phpstan/phpstan/security/policy", + "source": "https://github.com/phpstan/phpstan-src" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", + "type": "tidelift" + } + ], + "time": "2023-07-19T12:44:37+00:00" + } + ], "aliases": [], "minimum-stability": "dev", "stability-flags": { diff --git a/src/ClientInfo.php b/src/ClientInfo.php index 3ba7688..fc0b132 100644 --- a/src/ClientInfo.php +++ b/src/ClientInfo.php @@ -83,7 +83,7 @@ class ClientInfo implements Stringable { if($version < 0 || $version > self::SERIALIZE_VERSION) throw new RuntimeException('$data does not contain a valid version argument'); - return new static( + return new ClientInfo( $data['bot'] ?? null, $data['client'] ?? null, $data['os'] ?? null, @@ -108,7 +108,7 @@ class ClientInfo implements Stringable { $dd->parse(); - return new static( + return new ClientInfo( $dd->getBot(), $dd->getClient(), $dd->getOs(), diff --git a/src/Profile/ProfileFields.php b/src/Profile/ProfileFields.php index aba1d5f..3269255 100644 --- a/src/Profile/ProfileFields.php +++ b/src/Profile/ProfileFields.php @@ -9,11 +9,9 @@ use Misuzu\DbStatementCache; use Misuzu\Users\User; class ProfileFields { - private IDbConnection $dbConn; private DbStatementCache $cache; public function __construct(IDbConnection $dbConn) { - $this->dbConn = $dbConn; $this->cache = new DbStatementCache($dbConn); } @@ -210,7 +208,7 @@ class ProfileFields { foreach($fieldInfos as $key => $fieldInfo) { if(is_string($fieldInfo)) - $fieldInfo = $this->getField($fieldId); + $fieldInfo = $this->getField($fieldInfo); elseif(!($fieldInfo instanceof ProfileFieldInfo)) throw new InvalidArgumentException('Entries of $fieldInfos must either be field IDs or instances of ProfileFieldInfo.');