Skip to content

Commit 4576c7b

Browse files
Declare Connection::fetch methods as impure
1 parent 5e5fc80 commit 4576c7b

File tree

2 files changed

+192
-0
lines changed

2 files changed

+192
-0
lines changed

stubs/DBAL/Connection.stub

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,100 @@ class Connection
7474
*/
7575
public function transactional(Closure $func);
7676

77+
/**
78+
* @param list<mixed>|array<string, mixed> $params
79+
* @param array<int, int|string|Type|null>|array<string, int|string|Type|null> $types
80+
*
81+
* @return array<string, mixed>|false
82+
*
83+
* @throws Exception
84+
*
85+
* @phpstan-impure
86+
*/
87+
public function fetchAssociative(string $query, array $params = [], array $types = []): array|false;
88+
89+
/**
90+
* @param list<mixed>|array<string, mixed> $params
91+
* @param array<int, int|string|Type|null>|array<string, int|string|Type|null> $types
92+
*
93+
* @return list<mixed>|false
94+
*
95+
* @throws Exception
96+
*
97+
* @phpstan-impure
98+
*/
99+
public function fetchNumeric(string $query, array $params = [], array $types = []): array|false
100+
101+
/**
102+
* @param list<mixed>|array<string, mixed> $params
103+
* @param array<int, int|string|Type|null>|array<string, int|string|Type|null> $types
104+
*
105+
* @return mixed|false
106+
*
107+
* @throws Exception
108+
*
109+
* @phpstan-impure
110+
*/
111+
public function fetchOne(string $query, array $params = [], array $types = []): mixed
112+
113+
/**
114+
* @param list<mixed>|array<string, mixed> $params
115+
* @param array<int, int|string|Type|null>|array<string, int|string|Type|null> $types
116+
*
117+
* @return list<list<mixed>>
118+
*
119+
* @throws Exception
120+
*
121+
* @phpstan-impure
122+
*/
123+
public function fetchAllNumeric(string $query, array $params = [], array $types = []): array
124+
125+
/**
126+
* @param list<mixed>|array<string, mixed> $params
127+
* @param array<int, int|string|Type|null>|array<string, int|string|Type|null> $types
128+
*
129+
* @return list<array<string,mixed>>
130+
*
131+
* @throws Exception
132+
*
133+
* @phpstan-impure
134+
*/
135+
public function fetchAllAssociative(string $query, array $params = [], array $types = []): array
136+
137+
/**
138+
* @param list<mixed>|array<string, mixed> $params
139+
* @param array<int, int|string|Type|null>|array<string, int|string|Type|null> $types
140+
*
141+
* @return array<mixed,mixed>
142+
*
143+
* @throws Exception
144+
*
145+
* @phpstan-impure
146+
*/
147+
public function fetchAllKeyValue(string $query, array $params = [], array $types = []): array
148+
149+
/**
150+
* @param list<mixed>|array<string, mixed> $params
151+
* @param array<int, int|string|Type|null>|array<string, int|string|Type|null> $types
152+
*
153+
* @return array<mixed,array<string,mixed>>
154+
*
155+
* @throws Exception
156+
*
157+
* @phpstan-impure
158+
*/
159+
public function fetchAllAssociativeIndexed(string $query, array $params = [], array $types = []): array
160+
161+
/**
162+
* @param list<mixed>|array<string, mixed> $params
163+
* @param array<int, int|string|Type|null>|array<string, int|string|Type|null> $types
164+
*
165+
* @return list<mixed>
166+
*
167+
* @throws Exception
168+
*
169+
* @phpstan-impure
170+
*/
171+
public function fetchFirstColumn(string $query, array $params = [], array $types = []): array
172+
77173
}

stubs/DBAL/Connection4.stub

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,100 @@ class Connection
7878
*/
7979
public function transactional(Closure $func);
8080

81+
/**
82+
* @param list<mixed>|array<string, mixed> $params
83+
* @param WrapperParameterTypeArray $types
84+
*
85+
* @return array<string, mixed>|false
86+
*
87+
* @throws Exception
88+
*
89+
* @phpstan-impure
90+
*/
91+
public function fetchAssociative(string $query, array $params = [], array $types = []): array|false;
92+
93+
/**
94+
* @param list<mixed>|array<string, mixed> $params
95+
* @param WrapperParameterTypeArray $types
96+
*
97+
* @return list<mixed>|false
98+
*
99+
* @throws Exception
100+
*
101+
* @phpstan-impure
102+
*/
103+
public function fetchNumeric(string $query, array $params = [], array $types = []): array|false
104+
105+
/**
106+
* @param list<mixed>|array<string, mixed> $params
107+
* @param WrapperParameterTypeArray $types
108+
*
109+
* @return mixed|false
110+
*
111+
* @throws Exception
112+
*
113+
* @phpstan-impure
114+
*/
115+
public function fetchOne(string $query, array $params = [], array $types = []): mixed
116+
117+
/**
118+
* @param list<mixed>|array<string, mixed> $params
119+
* @param WrapperParameterTypeArray $types
120+
*
121+
* @return list<list<mixed>>
122+
*
123+
* @throws Exception
124+
*
125+
* @phpstan-impure
126+
*/
127+
public function fetchAllNumeric(string $query, array $params = [], array $types = []): array
128+
129+
/**
130+
* @param list<mixed>|array<string, mixed> $params
131+
* @param WrapperParameterTypeArray $types
132+
*
133+
* @return list<array<string,mixed>>
134+
*
135+
* @throws Exception
136+
*
137+
* @phpstan-impure
138+
*/
139+
public function fetchAllAssociative(string $query, array $params = [], array $types = []): array
140+
141+
/**
142+
* @param list<mixed>|array<string, mixed> $params
143+
* @param WrapperParameterTypeArray $types
144+
*
145+
* @return array<mixed,mixed>
146+
*
147+
* @throws Exception
148+
*
149+
* @phpstan-impure
150+
*/
151+
public function fetchAllKeyValue(string $query, array $params = [], array $types = []): array
152+
153+
/**
154+
* @param list<mixed>|array<string, mixed> $params
155+
* @param WrapperParameterTypeArray $types
156+
*
157+
* @return array<mixed,array<string,mixed>>
158+
*
159+
* @throws Exception
160+
*
161+
* @phpstan-impure
162+
*/
163+
public function fetchAllAssociativeIndexed(string $query, array $params = [], array $types = []): array
164+
165+
/**
166+
* @param list<mixed>|array<string, mixed> $params
167+
* @param WrapperParameterTypeArray $types
168+
*
169+
* @return list<mixed>
170+
*
171+
* @throws Exception
172+
*
173+
* @phpstan-impure
174+
*/
175+
public function fetchFirstColumn(string $query, array $params = [], array $types = []): array
176+
81177
}

0 commit comments

Comments
 (0)