Skip to content

Commit a4fad3e

Browse files
authored
[CKLS-22635] Fix deprecations on Propel (#22)
1 parent cc00fea commit a4fad3e

17 files changed

+85
-58
lines changed

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"intelephense.environment.phpVersion": "8.3.0"
3+
}

runtime/lib/adapter/MSSQL/MssqlPropelPDO.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ class MssqlPropelPDO extends PropelPDO
2121
* It is necessary to override the abstract PDO transaction functions here, as
2222
* the PDO driver for MSSQL does not support transactions.
2323
*
24-
* @return integer
24+
* @return bool
2525
*/
26-
public function beginTransaction()
26+
public function beginTransaction(): bool
2727
{
2828
$return = true;
2929
$opcount = $this->getNestedTransactionCount();
3030
if ($opcount === 0) {
31-
$return = self::exec('BEGIN TRANSACTION');
31+
$return = (bool) self::exec('BEGIN TRANSACTION');
3232
if ($this->useDebug) {
3333
$this->log('Begin transaction', null, __METHOD__);
3434
}
@@ -45,11 +45,11 @@ public function beginTransaction()
4545
* It is necessary to override the abstract PDO transaction functions here, as
4646
* the PDO driver for MSSQL does not support transactions.
4747
*
48-
* @return integer
48+
* @return bool
4949
*
5050
* @throws PropelException
5151
*/
52-
public function commit()
52+
public function commit(): bool
5353
{
5454
$return = true;
5555
$opcount = $this->getNestedTransactionCount();
@@ -58,7 +58,7 @@ public function commit()
5858
if ($this->isUncommitable) {
5959
throw new PropelException('Cannot commit because a nested transaction was rolled back');
6060
} else {
61-
$return = self::exec('COMMIT TRANSACTION');
61+
$return = (bool) self::exec('COMMIT TRANSACTION');
6262
if ($this->useDebug) {
6363
$this->log('Commit transaction', null, __METHOD__);
6464
}
@@ -77,15 +77,15 @@ public function commit()
7777
* It is necessary to override the abstract PDO transaction functions here, as
7878
* the PDO driver for MSSQL does not support transactions.
7979
*
80-
* @return integer
80+
* @return bool
8181
*/
82-
public function rollBack()
82+
public function rollBack(): bool
8383
{
8484
$return = true;
8585
$opcount = $this->getNestedTransactionCount();
8686
if ($opcount > 0) {
8787
if ($opcount === 1) {
88-
$return = self::exec('ROLLBACK TRANSACTION');
88+
$return = (bool) self::exec('ROLLBACK TRANSACTION');
8989
if ($this->useDebug) {
9090
$this->log('Rollback transaction', null, __METHOD__);
9191
}
@@ -132,6 +132,7 @@ public function forceRollBack()
132132
* @param string $seqname
133133
* @return integer
134134
*/
135+
#[\ReturnTypeWillChange]
135136
public function lastInsertId($seqname = null)
136137
{
137138
$result = self::query('SELECT SCOPE_IDENTITY()');

runtime/lib/collection/PropelArrayCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public function toArray($keyColumn = null, $usePrefix = false, $keyType = BasePe
162162
*
163163
* @return array
164164
*/
165-
public function getArrayCopy($keyColumn = null, $usePrefix = false)
165+
public function getArrayCopy($keyColumn = null, $usePrefix = false): array
166166
{
167167
if (null === $keyColumn && false === $usePrefix) {
168168
return parent::getArrayCopy();

runtime/lib/collection/PropelCollection.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ public function diff(PropelCollection $collection)
359359
/**
360360
* @return string
361361
*/
362-
public function serialize()
362+
public function serialize(): string
363363
{
364364
$repr = array(
365365
'data' => $this->getArrayCopy(),
@@ -374,7 +374,7 @@ public function serialize()
374374
*
375375
* @return void
376376
*/
377-
public function unserialize($data)
377+
public function unserialize($data): void
378378
{
379379
$repr = unserialize($data);
380380
$this->exchangeArray($repr['data']);
@@ -387,9 +387,9 @@ public function unserialize($data)
387387
* Overrides ArrayObject::getIterator() to save the iterator object
388388
* for internal use e.g. getNext(), isOdd(), etc.
389389
*
390-
* @return ArrayIterator
390+
* @return Iterator
391391
*/
392-
public function getIterator()
392+
public function getIterator(): Iterator
393393
{
394394
$this->iterator = new ArrayIterator($this);
395395

runtime/lib/collection/PropelObjectCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public function fromArray($arr)
137137
*
138138
* @return array
139139
*/
140-
public function getArrayCopy($keyColumn = null, $usePrefix = false)
140+
public function getArrayCopy($keyColumn = null, $usePrefix = false): array
141141
{
142142
if (null === $keyColumn && false === $usePrefix) {
143143
return parent::getArrayCopy();

runtime/lib/collection/PropelOnDemandCollection.php

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function fromArray($arr)
5454
/**
5555
* @return PropelOnDemandIterator
5656
*/
57-
public function getIterator()
57+
public function getIterator(): Iterator
5858
{
5959
return $this->iterator;
6060
}
@@ -67,7 +67,7 @@ public function getIterator()
6767
*
6868
* @return boolean
6969
*/
70-
public function offsetExists($offset)
70+
public function offsetExists($offset): bool
7171
{
7272
if ($offset == $this->currentKey) {
7373
return true;
@@ -81,7 +81,7 @@ public function offsetExists($offset)
8181
*
8282
* @return mixed
8383
*/
84-
public function offsetGet($offset)
84+
public function offsetGet($offset): mixed
8585
{
8686
if ($offset == $this->currentKey) {
8787
return $this->currentRow;
@@ -95,7 +95,7 @@ public function offsetGet($offset)
9595
* @param integer $offset
9696
* @param mixed $value
9797
*/
98-
public function offsetSet($offset, $value)
98+
public function offsetSet($offset, $value): void
9999
{
100100
throw new PropelException('The On Demand Collection is read only');
101101
}
@@ -104,7 +104,7 @@ public function offsetSet($offset, $value)
104104
* @throws PropelException
105105
* @param integer $offset
106106
*/
107-
public function offsetUnset($offset)
107+
public function offsetUnset($offset): void
108108
{
109109
throw new PropelException('The On Demand Collection is read only');
110110
}
@@ -114,7 +114,7 @@ public function offsetUnset($offset)
114114
/**
115115
* @throws PropelException
116116
*/
117-
public function serialize()
117+
public function serialize(): string
118118
{
119119
throw new PropelException('The On Demand Collection cannot be serialized');
120120
}
@@ -125,7 +125,7 @@ public function serialize()
125125
*
126126
* @return void
127127
*/
128-
public function unserialize($data)
128+
public function unserialize($data): void
129129
{
130130
throw new PropelException('The On Demand Collection cannot be serialized');
131131
}
@@ -138,14 +138,14 @@ public function unserialize($data)
138138
*
139139
* @return integer Number of results
140140
*/
141-
public function count()
141+
public function count(): int
142142
{
143143
return $this->iterator->count();
144144
}
145145

146146
// ArrayObject methods
147147

148-
public function append($value)
148+
public function append($value): void
149149
{
150150
throw new PropelException('The On Demand Collection is read only');
151151
}
@@ -155,51 +155,57 @@ public function prepend($value)
155155
throw new PropelException('The On Demand Collection is read only');
156156
}
157157

158+
#[\ReturnTypeWillChange]
158159
public function asort($flags = SORT_REGULAR)
159160
{
160161
throw new PropelException('The On Demand Collection is read only');
161162
}
162163

163-
public function exchangeArray($input)
164+
public function exchangeArray($input): array
164165
{
165166
throw new PropelException('The On Demand Collection is read only');
166167
}
167168

168-
public function getArrayCopy()
169+
public function getArrayCopy(): array
169170
{
170171
throw new PropelException('The On Demand Collection does not allow acces by offset');
171172
}
172173

173-
public function getFlags()
174+
public function getFlags(): int
174175
{
175176
throw new PropelException('The On Demand Collection does not allow acces by offset');
176177
}
177178

179+
#[\ReturnTypeWillChange]
178180
public function ksort($flags = SORT_REGULAR)
179181
{
180182
throw new PropelException('The On Demand Collection is read only');
181183
}
182184

185+
#[\ReturnTypeWillChange]
183186
public function natcasesort()
184187
{
185188
throw new PropelException('The On Demand Collection is read only');
186189
}
187190

191+
#[\ReturnTypeWillChange]
188192
public function natsort()
189193
{
190194
throw new PropelException('The On Demand Collection is read only');
191195
}
192196

193-
public function setFlags($flags)
197+
public function setFlags($flags): void
194198
{
195199
throw new PropelException('The On Demand Collection does not allow acces by offset');
196200
}
197201

202+
#[\ReturnTypeWillChange]
198203
public function uasort($cmp_function)
199204
{
200205
throw new PropelException('The On Demand Collection is read only');
201206
}
202207

208+
#[\ReturnTypeWillChange]
203209
public function uksort($cmp_function)
204210
{
205211
throw new PropelException('The On Demand Collection is read only');

runtime/lib/collection/PropelOnDemandIterator.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ public function count()
6969
*
7070
* @return BaseObject
7171
*/
72+
#[\ReturnTypeWillChange]
7273
public function current()
7374
{
7475
return $this->formatter->getAllObjectsFromRow($this->currentRow);
@@ -79,6 +80,7 @@ public function current()
7980
*
8081
* @return string
8182
*/
83+
#[\ReturnTypeWillChange]
8284
public function key()
8385
{
8486
return $this->currentKey;
@@ -88,7 +90,7 @@ public function key()
8890
* Advances the curesor in the statement
8991
* Closes the cursor if the end of the statement is reached
9092
*/
91-
public function next()
93+
public function next(): void
9294
{
9395
$this->currentRow = $this->stmt->fetch(PDO::FETCH_NUM);
9496
$this->currentKey++;
@@ -105,7 +107,7 @@ public function next()
105107
* Initializes the iterator by advancing to the first position
106108
* This method can only be called once (this is a NoRewindIterator)
107109
*/
108-
public function rewind()
110+
public function rewind(): void
109111
{
110112
// check that the hydration can begin
111113
if (null === $this->formatter) {
@@ -125,7 +127,7 @@ public function rewind()
125127
/**
126128
* @return boolean
127129
*/
128-
public function valid()
130+
public function valid(): bool
129131
{
130132
return (boolean) $this->isValid;
131133
}

runtime/lib/config/PropelConfiguration.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* configuration can also be retrieved as a nested arrays, flat array or as a
1717
* PropelConfiguration instance.
1818
*
19-
* @author Veikko Mäkinen <veikko@veikko.fi>
19+
* @author Veikko Mäkinen <veikko@veikko.fi>
2020
* @version $Revision$
2121
* @package propel.runtime.config
2222
*/
@@ -46,7 +46,7 @@ public function __construct(array $parameters = array())
4646
* @param integer $offset
4747
* @return boolean
4848
*/
49-
public function offsetExists($offset)
49+
public function offsetExists($offset): bool
5050
{
5151
return array_key_exists($offset, $this->parameters);
5252
}
@@ -57,7 +57,7 @@ public function offsetExists($offset)
5757
* @param integer $offset
5858
* @param mixed $value
5959
*/
60-
public function offsetSet($offset, $value)
60+
public function offsetSet($offset, $value): void
6161
{
6262
$this->parameters[$offset] = $value;
6363
$this->isFlattened = false;
@@ -69,6 +69,7 @@ public function offsetSet($offset, $value)
6969
* @param integer $offset
7070
* @return array
7171
*/
72+
#[\ReturnTypeWillChange]
7273
public function offsetGet($offset)
7374
{
7475
return $this->parameters[$offset];
@@ -79,7 +80,7 @@ public function offsetGet($offset)
7980
*
8081
* @param integer $offset
8182
*/
82-
public function offsetUnset($offset)
83+
public function offsetUnset($offset): void
8384
{
8485
unset($this->parameters[$offset]);
8586
$this->isFlattened = false;

runtime/lib/config/PropelConfigurationIterator.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* PropelConfigurationIterator is used internally by PropelConfiguration to
1313
* build a flat array from nesting configuration arrays.
1414
*
15-
* @author Veikko Mäkinen <veikko@veikko.fi>
15+
* @author Veikko Mäkinen <veikko@veikko.fi>
1616
* @version $Revision$
1717
* @package propel.runtime.config
1818
*/
@@ -72,6 +72,7 @@ public function getNodeType()
7272
* @see http://www.php.net/RecursiveIteratorIterator
7373
* @return mixed
7474
*/
75+
#[\ReturnTypeWillChange]
7576
public function current()
7677
{
7778
$current = parent::current();
@@ -90,7 +91,7 @@ public function current()
9091
*
9192
* @see http://www.php.net/RecursiveIteratorIterator
9293
*/
93-
public function endChildren()
94+
public function endChildren(): void
9495
{
9596
if ($this->namespaceStack) {
9697
array_pop($this->namespaceStack);

0 commit comments

Comments
 (0)