/
extension.neon
78 lines (78 loc) · 2.39 KB
/
extension.neon
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
parameters:
maria-stan:
# Apparently this has to exist even if it's not used. Otherwise DI is not happy.
db:
host: 127.0.0.1
port: 3306
user: ''
password: ''
database: ''
reflection:
file:
columnTypeOverrides: []
parametersSchema:
maria-stan: structure([
# Connection information for online DB reflection.
db: structure([
host: string()
port: int()
user: string()
password: string()
database: string()
])
reflection: structure([
# Schema dump for file DB reflection.
file: anyOf(string(), null)
])
# This option lets you narrow down the type of columns. It can be useful e.g. if some table has fixed data
# and you use something like EntityId::* in your phpdocs. Of course it's your responsibility to make sure
# that the type is actually correct.
columnTypeOverrides: listOf(structure([
# table.column
column: string()
# Any type that PHPStan can parse. Must be a subtype of the column type as returned by mysqli.
# Column nullability is considered automatically, so you don't have to add null to the type.
type: string()
]))
])
services:
mariaStanDb:
# make sure it doesn't conflict with other extensions
autowired: false
class: mysqli
arguments:
hostname: %maria-stan.db.host%
username: %maria-stan.db.user%
password: %maria-stan.db.password%
database: %maria-stan.db.database%
port: %maria-stan.db.port%
setup:
- options(::constant(MYSQLI_OPT_INT_AND_FLOAT_NATIVE), 1)
- set_charset('utf8mb4')
- MariaStan\Parser\MariaDbParser
- MariaStan\DbReflection\InformationSchemaParser
mariaDbFileDbReflection:
class: MariaStan\DbReflection\MariaDbFileDbReflection
autowired: false
arguments:
dumpFile: %maria-stan.reflection.file%
mariaDbOnlineDbReflection:
class: MariaStan\DbReflection\MariaDbOnlineDbReflection
autowired: false
arguments:
mysqli: @mariaStanDb
mariaDbReflection: @mariaDbOnlineDbReflection
-
class: MariaStan\Analyser\Analyser
arguments:
dbReflection: @mariaDbReflection
- MariaStan\PHPStan\Type\MySQLi\DbToPhpstanTypeMapper
-
class: MariaStan\PHPStan\Helper\PHPStanReturnTypeHelper
arguments:
dbReflection: @mariaDbReflection
columnTypeOverrides: %maria-stan.columnTypeOverrides%
- MariaStan\PHPStan\Helper\MySQLi\PHPStanMySQLiHelper
functionInfoRegistryFactory: MariaStan\Database\FunctionInfo\FunctionInfoRegistryFactory
-
create: @functionInfoRegistryFactory::create()