Added phpstan as a dev dependency.

This commit is contained in:
Pachira 2023-07-21 19:38:54 +00:00
parent 761bc94b8e
commit 9962bbc5df
4 changed files with 71 additions and 7 deletions

View file

@ -29,5 +29,8 @@
"composer/installers": true,
"wikimedia/composer-merge-plugin": false
}
},
"require-dev": {
"phpstan/phpstan": "^1.10"
}
}

67
composer.lock generated
View file

@ -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": {

View file

@ -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(),

View file

@ -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.');