-
Notifications
You must be signed in to change notification settings - Fork 16
/
phpstan.neon.dist
124 lines (119 loc) · 9.3 KB
/
phpstan.neon.dist
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# Distributed PHPStan config
parameters:
level: 8
paths:
- src
- test
bootstrapFiles:
- src/config.php
# Stricter analysis
polluteScopeWithLoopInitialAssignments: false
polluteScopeWithAlwaysIterableForeach: false
checkAlwaysTrueCheckTypeFunctionCall: true
checkAlwaysTrueInstanceof: true
checkAlwaysTrueStrictComparison: true
checkExplicitMixedMissingReturn: true
checkFunctionNameCase: true
checkInternalClassCaseSensitivity: true
reportMaybesInMethodSignatures: true
reportMaybesInPropertyPhpDocTypes: true
reportStaticMethodSignatures: true
checkTooWideReturnTypesInProtectedAndPublicMethods: true
checkDynamicProperties: true
dynamicConstantNames:
- BUG_REPORT_TO_ADDRESSES
- CONTACT_FORM_CC_ADDRESSES
- ENABLE_BETA
- ENABLE_DEBUG
- ENABLE_LIBXML_ERRORS
- ENABLE_NPCS_CHESS
- FACEBOOK_APP_ID
- GOOGLE_ANALYTICS_ID
- GOOGLE_CLIENT_ID
- IRC_BOT_VERBOSE_PING
- NPC_LOG_TO_DATABASE
- OVERRIDE_FORWARD
- RECAPTCHA_PRIVATE
- SMTP_HOSTNAME
- TWITTER_CONSUMER_KEY
# We code in protection against a value of 0
- Smr\Combat\Weapon\Mines::TOTAL_ENEMY_MINES_MODIFIER
typeAliases:
WeaponDamageData: 'array{Shield: int, Armour: int, Rollover: bool, Launched?: int, Kamikaze?: int}'
TakenDamageData: 'array{KillingShot: bool, TargetAlreadyDead: bool, Shield: int, CDs: int, NumCDs: int, HasCDs: bool, Armour: int, TotalDamage: int}'
ForceTakenDamageData: 'array{KillingShot: bool, TargetAlreadyDead: bool, Mines: int, NumMines: int, HasMines: bool, CDs: int, NumCDs: int, HasCDs: bool, SDs: int, NumSDs: int, HasSDs: bool, TotalDamage: int}'
PlanetAttackerCombatResult: 'array{Player: \Smr\AbstractPlayer, TotalDamage: int, DeadBeforeShot: bool, Weapons: array<int, array{Weapon: \Smr\Combat\Weapon\AbstractWeapon, Target: \Smr\Planet, Hit: bool, WeaponDamage?: WeaponDamageData, ActualDamage?: TakenDamageData, KillResults?: array{}}>, Drones?: array{Weapon: \Smr\Combat\Weapon\AbstractWeapon, Target: \Smr\Planet, Hit: bool, WeaponDamage: WeaponDamageData, ActualDamage: TakenDamageData, KillResults?: array{}}}'
PlanetAttackerCombatResults: 'array{TotalDamage: int, Downgrades: array<int, int>, Traders: array<int, PlanetAttackerCombatResult>}'
PlanetCombatResults: 'array{Planet: \Smr\Planet, TotalDamage: int, TotalDamagePerTargetPlayer: array<int, int>, DeadBeforeShot: bool, Weapons?: array<int, array{Weapon: \Smr\Combat\Weapon\AbstractWeapon, Target: \Smr\AbstractPlayer, Hit: bool, WeaponDamage?: WeaponDamageData, ActualDamage?: TakenDamageData, KillResults?: array{DeadExp: int, LostCredits: int}}>, Drones?: array{Weapon: \Smr\Combat\Weapon\AbstractWeapon, Target: \Smr\AbstractPlayer, Hit: bool, WeaponDamage: WeaponDamageData, ActualDamage: TakenDamageData, KillResults?: array{DeadExp: int, LostCredits: int}}}'
PortAttackerCombatResult: 'array{Player: \Smr\AbstractPlayer, TotalDamage: int, DeadBeforeShot: bool, Weapons: array<int, array{Weapon: \Smr\Combat\Weapon\AbstractWeapon, Target: \Smr\Port, Hit: bool, WeaponDamage?: WeaponDamageData, ActualDamage?: TakenDamageData, KillResults?: array{}}>, Drones?: array{Weapon: \Smr\Combat\Weapon\AbstractWeapon, Target: \Smr\Port, Hit: bool, WeaponDamage: WeaponDamageData, ActualDamage: TakenDamageData, KillResults?: array{}}}'
PortAttackerCombatResults: 'array{TotalDamage: int, Downgrades: int, Traders: array<int, PortAttackerCombatResult>}'
PortCombatResults: 'array{Port: \Smr\Port, TotalDamage: int, TotalDamagePerTargetPlayer: array<int, int>, TotalShotsPerTargetPlayer: array<int, int>, DeadBeforeShot: bool, Weapons?: array<int, array{Weapon: \Smr\Combat\Weapon\AbstractWeapon, Target: \Smr\AbstractPlayer, Hit: bool, WeaponDamage?: WeaponDamageData, ActualDamage?: TakenDamageData, KillResults?: array{DeadExp: int, LostCredits: int}}>, Drones?: array{Weapon: \Smr\Combat\Weapon\AbstractWeapon, Target: \Smr\AbstractPlayer, Hit: bool, WeaponDamage: WeaponDamageData, ActualDamage: TakenDamageData, KillResults?: array{DeadExp: int, LostCredits: int}}}'
ForceAttackerCombatResult: 'array{Player: \Smr\AbstractPlayer, TotalDamage: int, DeadBeforeShot: bool, Weapons: array<int, array{Weapon: \Smr\Combat\Weapon\AbstractWeapon, Target: \Smr\Force, Hit: bool, WeaponDamage?: WeaponDamageData, ActualDamage?: ForceTakenDamageData, KillResults?: array{}}>, Drones?: array{Weapon: \Smr\Combat\Weapon\AbstractWeapon, Target: \Smr\Force, Hit: bool, WeaponDamage: WeaponDamageData, ActualDamage: ForceTakenDamageData, KillResults?: array{}}}'
ForceAttackerCombatResults: 'array{TotalDamage: int, Traders: array<int, ForceAttackerCombatResult>}'
ForceCombatResults: 'array{TotalDamage: int, DeadBeforeShot: bool, ForcesDestroyed?: bool, Results: array{Mines?: array{Weapon: \Smr\Combat\Weapon\AbstractWeapon, Target: \Smr\AbstractPlayer, Hit: bool, WeaponDamage: WeaponDamageData, ActualDamage: TakenDamageData, KillResults?: array{DeadExp: int, LostCredits: int}}, Drones?: array{Weapon: \Smr\Combat\Weapon\AbstractWeapon, Target: \Smr\AbstractPlayer, Hit: bool, WeaponDamage: WeaponDamageData, ActualDamage: TakenDamageData, KillResults?: array{DeadExp: int, LostCredits: int}}, Scouts?: array{Weapon: \Smr\Combat\Weapon\AbstractWeapon, Target: \Smr\AbstractPlayer, Hit: bool, WeaponDamage: WeaponDamageData, ActualDamage: TakenDamageData, KillResults?: array{DeadExp: int, LostCredits: int}}}}'
TraderCombatResult: 'array{Player: \Smr\AbstractPlayer, TotalDamage: int, TotalDamagePerTargetPlayer: array<int, int>, DeadBeforeShot: bool, Weapons: array<int, array{Weapon: \Smr\Combat\Weapon\AbstractWeapon, Target: \Smr\AbstractPlayer, Hit: bool, WeaponDamage?: WeaponDamageData, ActualDamage?: TakenDamageData, KillResults?: array{DeadExp: int, KillerExp: int, KillerCredits: int}}>, Drones?: array{Weapon: \Smr\Combat\Weapon\AbstractWeapon, Target: \Smr\AbstractPlayer, Hit: bool, WeaponDamage: WeaponDamageData, ActualDamage: TakenDamageData, KillResults?: array{DeadExp: int, KillerExp: int, KillerCredits: int}}}'
TraderTeamCombatResults: 'array{TotalDamage: int, Traders: array<int, TraderCombatResult>}'
#----------------------------------------------
# Warning suppression (to be fixed eventually!)
#----------------------------------------------
ignoreErrors:
-
# Template files currently emit many undefined variable errors
# because we source them inside Template::includeTemplate. This
# will require a redesign of the Template class to fix. (Level 1)
message: '#Variable .* might not be defined#'
path: src/templates/Default/engine/Default/admin
-
# This while loop is needed to reconnect the IRC bot after server
# timeouts. It could be replaced with Docker daemonization if we
# modify the delayed callback actions. (Level 4)
message: '#While loop condition is always true.#'
path: src/tools/irc/irc.php
count: 1
-
# The `$targetPlayer` has impure functions called on it, which
# should reset its method return value cache, but PHPStan cannot
# detect that this is happening. (Level 4)
message: '#Right side of || is always false.#'
path: src/pages/Player/AttackPlayerProcessor.php
count: 1
-
# This Admin Tool is temporarily(?) disabled. (Level 4)
message: '#Unreachable statement - code above always terminates.#'
path: src/pages/Admin/GameDeleteProcessor.php
count: 1
-
# https://github.com/phpstan/phpstan/issues/7520
message: '#Comparison operation ">" between 0 and 0 is always false.#'
paths:
- src/bootstrap.php
- src/pages/Account/BugReportProcessor.php
-
# https://github.com/phpstan/phpstan/issues/7520
message: '#Empty array passed to foreach.#'
path: src/pages/Account/ContactFormProcessor.php
count: 1
-
# https://github.com/thephpleague/oauth2-client/issues/897
message: '#Parameter \#1 \$token of method .*::getResourceOwner\(\) expects .*AccessToken, .*AccessTokenInterface given.#'
path: src/lib/Smr/SocialLogin
count: 2
-
# Templates are executed in the context of an Smr\Template method,
# so they have access to protected stuff. This needs refactoring.
message: '#(Call|Access) to protected (method|property).* Smr\\Template#'
path: src/templates
-
# https://github.com/phpstan/phpstan/issues/6830
message: '#Variable \$(Actual|Weapon)Damage might not be defined.#'
path: src/templates/Default/engine/Default/*CombatResults.inc.php
-
# https://github.com/discord-php/DiscordPHP/pull/1056
message: '#Cannot access property .* on Discord\\Parts\\Channel\\Channel|null.#'
path: src/lib/Smr/Discord/PlayerLink.php
count: 2
-
# https://github.com/phpstan/phpstan/issues/8837
message: '#Cannot call method saveHTML() on DOMDocument|null.#'
path: src/lib/Smr/Template.php
count: 1