Skip to content

Commit 81a793f

Browse files
authored
Merge pull request #8 from vemaeg/feature/php-8.1-support
Feature/php 8.1 support
2 parents 7873563 + 3991420 commit 81a793f

28 files changed

+258
-27
lines changed

lib/addon/sfPager.class.php

+6
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,7 @@ protected function resetIterator()
529529
*
530530
* @see Iterator
531531
*/
532+
#[ReturnTypeWillChange]
532533
public function current()
533534
{
534535
if (!$this->isIteratorInitialized())
@@ -544,6 +545,7 @@ public function current()
544545
*
545546
* @see Iterator
546547
*/
548+
#[ReturnTypeWillChange]
547549
public function key()
548550
{
549551
if (!$this->isIteratorInitialized())
@@ -559,6 +561,7 @@ public function key()
559561
*
560562
* @see Iterator
561563
*/
564+
#[ReturnTypeWillChange]
562565
public function next()
563566
{
564567
if (!$this->isIteratorInitialized())
@@ -576,6 +579,7 @@ public function next()
576579
*
577580
* @see Iterator
578581
*/
582+
#[ReturnTypeWillChange]
579583
public function rewind()
580584
{
581585
if (!$this->isIteratorInitialized())
@@ -593,6 +597,7 @@ public function rewind()
593597
*
594598
* @see Iterator
595599
*/
600+
#[ReturnTypeWillChange]
596601
public function valid()
597602
{
598603
if (!$this->isIteratorInitialized())
@@ -608,6 +613,7 @@ public function valid()
608613
*
609614
* @see Countable
610615
*/
616+
#[ReturnTypeWillChange]
611617
public function count()
612618
{
613619
return $this->getNbResults();

lib/config/sfViewConfigHandler.class.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ protected function addHtmlHead($viewName = '')
223223

224224
foreach ($this->mergeConfigValue('metas', $viewName) as $name => $content)
225225
{
226-
$data[] = sprintf(" \$response->addMeta('%s', '%s', false, false);", $name, str_replace('\'', '\\\'', preg_replace('/&(?=\w+;)/', '&', htmlspecialchars($content, ENT_QUOTES, sfConfig::get('sf_charset')))));
226+
$data[] = sprintf(" \$response->addMeta('%s', '%s', false, false);", $name, str_replace('\'', '\\\'', preg_replace('/&(?=\w+;)/', '&', htmlspecialchars($content == null ? '' : $content, ENT_QUOTES, sfConfig::get('sf_charset')))));
227227
}
228228

229229
return implode("\n", $data)."\n";

lib/escaper/sfOutputEscaperArrayDecorator.class.php

+11-1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public function __construct($escapingMethod, $value)
4242
/**
4343
* Reset the array to the beginning (as required for the Iterator interface).
4444
*/
45+
#[ReturnTypeWillChange]
4546
public function rewind()
4647
{
4748
reset($this->value);
@@ -54,6 +55,7 @@ public function rewind()
5455
*
5556
* @return string The key
5657
*/
58+
#[ReturnTypeWillChange]
5759
public function key()
5860
{
5961
return key($this->value);
@@ -67,6 +69,7 @@ public function key()
6769
*
6870
* @return mixed The escaped value
6971
*/
72+
#[ReturnTypeWillChange]
7073
public function current()
7174
{
7275
return sfOutputEscaper::escape($this->escapingMethod, current($this->value));
@@ -75,6 +78,7 @@ public function current()
7578
/**
7679
* Moves to the next element (as required by the Iterator interface).
7780
*/
81+
#[ReturnTypeWillChange]
7882
public function next()
7983
{
8084
next($this->value);
@@ -91,6 +95,7 @@ public function next()
9195
*
9296
* @return bool The validity of the current element; true if it is valid
9397
*/
98+
#[ReturnTypeWillChange]
9499
public function valid()
95100
{
96101
return $this->count > 0;
@@ -103,6 +108,7 @@ public function valid()
103108
*
104109
* @return bool true if the offset isset; false otherwise
105110
*/
111+
#[ReturnTypeWillChange]
106112
public function offsetExists($offset)
107113
{
108114
return isset($this->value[$offset]);
@@ -115,9 +121,10 @@ public function offsetExists($offset)
115121
*
116122
* @return mixed The escaped value
117123
*/
124+
#[ReturnTypeWillChange]
118125
public function offsetGet($offset)
119126
{
120-
return sfOutputEscaper::escape($this->escapingMethod, $this->value[$offset]);
127+
return sfOutputEscaper::escape($this->escapingMethod, isset($this->value[$offset]) ? $this->value[$offset] : null);
121128
}
122129

123130
/**
@@ -132,6 +139,7 @@ public function offsetGet($offset)
132139
*
133140
* @throws sfException
134141
*/
142+
#[ReturnTypeWillChange]
135143
public function offsetSet($offset, $value)
136144
{
137145
throw new sfException('Cannot set values.');
@@ -148,6 +156,7 @@ public function offsetSet($offset, $value)
148156
*
149157
* @throws sfException
150158
*/
159+
#[ReturnTypeWillChange]
151160
public function offsetUnset($offset)
152161
{
153162
throw new sfException('Cannot unset values.');
@@ -158,6 +167,7 @@ public function offsetUnset($offset)
158167
*
159168
* @return int The size of the array
160169
*/
170+
#[ReturnTypeWillChange]
161171
public function count()
162172
{
163173
return count($this->value);

lib/escaper/sfOutputEscaperIteratorDecorator.class.php

+9
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public function __construct($escapingMethod, Traversable $value)
5656
*
5757
* @return void
5858
*/
59+
#[ReturnTypeWillChange]
5960
public function rewind()
6061
{
6162
return $this->iterator->rewind();
@@ -66,6 +67,7 @@ public function rewind()
6667
*
6768
* @return mixed The escaped value
6869
*/
70+
#[ReturnTypeWillChange]
6971
public function current()
7072
{
7173
return sfOutputEscaper::escape($this->escapingMethod, $this->iterator->current());
@@ -76,6 +78,7 @@ public function current()
7678
*
7779
* @return string Iterator key
7880
*/
81+
#[ReturnTypeWillChange]
7982
public function key()
8083
{
8184
return $this->iterator->key();
@@ -86,6 +89,7 @@ public function key()
8689
*
8790
* @return void
8891
*/
92+
#[ReturnTypeWillChange]
8993
public function next()
9094
{
9195
return $this->iterator->next();
@@ -97,6 +101,7 @@ public function next()
97101
*
98102
* @return bool true if the current element is valid; false otherwise
99103
*/
104+
#[ReturnTypeWillChange]
100105
public function valid()
101106
{
102107
return $this->iterator->valid();
@@ -109,6 +114,7 @@ public function valid()
109114
*
110115
* @return bool true if the offset isset; false otherwise
111116
*/
117+
#[ReturnTypeWillChange]
112118
public function offsetExists($offset)
113119
{
114120
return isset($this->value[$offset]);
@@ -121,6 +127,7 @@ public function offsetExists($offset)
121127
*
122128
* @return mixed The escaped value
123129
*/
130+
#[ReturnTypeWillChange]
124131
public function offsetGet($offset)
125132
{
126133
return sfOutputEscaper::escape($this->escapingMethod, $this->value[$offset]);
@@ -138,6 +145,7 @@ public function offsetGet($offset)
138145
*
139146
* @throws sfException
140147
*/
148+
#[ReturnTypeWillChange]
141149
public function offsetSet($offset, $value)
142150
{
143151
throw new sfException('Cannot set values.');
@@ -154,6 +162,7 @@ public function offsetSet($offset, $value)
154162
*
155163
* @throws sfException
156164
*/
165+
#[ReturnTypeWillChange]
157166
public function offsetUnset($offset)
158167
{
159168
throw new sfException('Cannot unset values.');

lib/escaper/sfOutputEscaperObjectDecorator.class.php

+1
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ public function __isset($key)
115115
*
116116
* @return int The size of the object
117117
*/
118+
#[ReturnTypeWillChange]
118119
public function count()
119120
{
120121
return count($this->value);

lib/event/sfEvent.class.php

+4
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ public function getParameters()
117117
*
118118
* @return Boolean true if the parameter exists, false otherwise
119119
*/
120+
#[ReturnTypeWillChange]
120121
public function offsetExists($name)
121122
{
122123
return array_key_exists($name, $this->parameters);
@@ -129,6 +130,7 @@ public function offsetExists($name)
129130
*
130131
* @return mixed The parameter value
131132
*/
133+
#[ReturnTypeWillChange]
132134
public function offsetGet($name)
133135
{
134136
if (!array_key_exists($name, $this->parameters))
@@ -145,6 +147,7 @@ public function offsetGet($name)
145147
* @param string $name The parameter name
146148
* @param mixed $value The parameter value
147149
*/
150+
#[ReturnTypeWillChange]
148151
public function offsetSet($name, $value)
149152
{
150153
$this->parameters[$name] = $value;
@@ -155,6 +158,7 @@ public function offsetSet($name, $value)
155158
*
156159
* @param string $name The parameter name
157160
*/
161+
#[ReturnTypeWillChange]
158162
public function offsetUnset($name)
159163
{
160164
unset($this->parameters[$name]);

lib/form/sfForm.class.php

+10
Original file line numberDiff line numberDiff line change
@@ -1064,6 +1064,7 @@ public function resetFormFields()
10641064
*
10651065
* @return Boolean true if the widget exists, false otherwise
10661066
*/
1067+
#[ReturnTypeWillChange]
10671068
public function offsetExists($name)
10681069
{
10691070
return isset($this->widgetSchema[$name]);
@@ -1076,6 +1077,7 @@ public function offsetExists($name)
10761077
*
10771078
* @return sfFormField|sfFormFieldSchema A form field instance
10781079
*/
1080+
#[ReturnTypeWillChange]
10791081
public function offsetGet($name)
10801082
{
10811083
if (!isset($this->formFields[$name]))
@@ -1114,6 +1116,7 @@ public function offsetGet($name)
11141116
*
11151117
* @throws <b>LogicException</b>
11161118
*/
1119+
#[ReturnTypeWillChange]
11171120
public function offsetSet($offset, $value)
11181121
{
11191122
throw new LogicException('Cannot update form fields.');
@@ -1126,6 +1129,7 @@ public function offsetSet($offset, $value)
11261129
*
11271130
* @param string $offset The field name
11281131
*/
1132+
#[ReturnTypeWillChange]
11291133
public function offsetUnset($offset)
11301134
{
11311135
unset(
@@ -1227,6 +1231,7 @@ public function getErrors()
12271231
/**
12281232
* Resets the field names array to the beginning (implements the Iterator interface).
12291233
*/
1234+
#[ReturnTypeWillChange]
12301235
public function rewind()
12311236
{
12321237
$this->fieldNames = $this->widgetSchema->getPositions();
@@ -1240,6 +1245,7 @@ public function rewind()
12401245
*
12411246
* @return string The key
12421247
*/
1248+
#[ReturnTypeWillChange]
12431249
public function key()
12441250
{
12451251
return current($this->fieldNames);
@@ -1250,6 +1256,7 @@ public function key()
12501256
*
12511257
* @return mixed The escaped value
12521258
*/
1259+
#[ReturnTypeWillChange]
12531260
public function current()
12541261
{
12551262
return $this[current($this->fieldNames)];
@@ -1258,6 +1265,7 @@ public function current()
12581265
/**
12591266
* Moves to the next form field (implements the Iterator interface).
12601267
*/
1268+
#[ReturnTypeWillChange]
12611269
public function next()
12621270
{
12631271
next($this->fieldNames);
@@ -1269,6 +1277,7 @@ public function next()
12691277
*
12701278
* @return boolean The validity of the current element; true if it is valid
12711279
*/
1280+
#[ReturnTypeWillChange]
12721281
public function valid()
12731282
{
12741283
return $this->count > 0;
@@ -1279,6 +1288,7 @@ public function valid()
12791288
*
12801289
* @return integer The number of embedded form fields
12811290
*/
1291+
#[ReturnTypeWillChange]
12821292
public function count()
12831293
{
12841294
return count($this->getFormFieldSchema());

0 commit comments

Comments
 (0)