Skip to content

Commit

Permalink
silence php81 deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
nutama committed Dec 1, 2023
1 parent 20b53d9 commit 1313a0c
Show file tree
Hide file tree
Showing 12 changed files with 99 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/event/sfEvent.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ public function getParameters()
*
* @return Boolean true if the parameter exists, false otherwise
*/
#[\ReturnTypeWillChange]
public function offsetExists($name)
{
return array_key_exists($name, $this->parameters);
Expand All @@ -129,6 +130,7 @@ public function offsetExists($name)
*
* @return mixed The parameter value
*/
#[\ReturnTypeWillChange]
public function offsetGet($name)
{
if (!array_key_exists($name, $this->parameters))
Expand All @@ -145,6 +147,7 @@ public function offsetGet($name)
* @param string $name The parameter name
* @param mixed $value The parameter value
*/
#[\ReturnTypeWillChange]
public function offsetSet($name, $value)
{
$this->parameters[$name] = $value;
Expand All @@ -155,6 +158,7 @@ public function offsetSet($name, $value)
*
* @param string $name The parameter name
*/
#[\ReturnTypeWillChange]
public function offsetUnset($name)
{
unset($this->parameters[$name]);
Expand Down
4 changes: 4 additions & 0 deletions lib/form/sfForm.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,7 @@ public function resetFormFields()
*
* @return Boolean true if the widget exists, false otherwise
*/
#[\ReturnTypeWillChange]
public function offsetExists($name)
{
return isset($this->widgetSchema[$name]);
Expand All @@ -715,6 +716,7 @@ public function offsetExists($name)
*
* @return sfFormField A form field instance
*/
#[\ReturnTypeWillChange]
public function offsetGet($name)
{
if (!isset($this->formFields[$name]))
Expand Down Expand Up @@ -742,6 +744,7 @@ public function offsetGet($name)
*
* @throws <b>LogicException</b>
*/
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
throw new LogicException('Cannot update form fields.');
Expand All @@ -754,6 +757,7 @@ public function offsetSet($offset, $value)
*
* @param string $offset The field name
*/
#[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
unset(
Expand Down
10 changes: 10 additions & 0 deletions lib/form/sfFormFieldSchema.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public function __construct(sfWidgetFormSchema $widget, sfFormField $parent = nu
*
* @return Boolean true if the widget exists, false otherwise
*/
#[\ReturnTypeWillChange]
public function offsetExists($name)
{
return isset($this->widget[$name]);
Expand All @@ -58,6 +59,7 @@ public function offsetExists($name)
*
* @return sfFormField A form field instance
*/
#[\ReturnTypeWillChange]
public function offsetGet($name)
{
if (!isset($this->fields[$name]))
Expand Down Expand Up @@ -97,6 +99,7 @@ public function offsetGet($name)
*
* @throws LogicException
*/
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
throw new LogicException('Cannot update form fields (read-only).');
Expand All @@ -109,6 +112,7 @@ public function offsetSet($offset, $value)
*
* @throws LogicException
*/
#[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
throw new LogicException('Cannot remove form fields (read-only).');
Expand All @@ -117,6 +121,7 @@ public function offsetUnset($offset)
/**
* Resets the field names array to the beginning (implements the Iterator interface).
*/
#[\ReturnTypeWillChange]
public function rewind()
{
reset($this->fieldNames);
Expand All @@ -128,6 +133,7 @@ public function rewind()
*
* @return string The key
*/
#[\ReturnTypeWillChange]
public function key()
{
return current($this->fieldNames);
Expand All @@ -138,6 +144,7 @@ public function key()
*
* @return mixed The escaped value
*/
#[\ReturnTypeWillChange]
public function current()
{
return $this[current($this->fieldNames)];
Expand All @@ -146,6 +153,7 @@ public function current()
/**
* Moves to the next form field (implements the Iterator interface).
*/
#[\ReturnTypeWillChange]
public function next()
{
next($this->fieldNames);
Expand All @@ -157,6 +165,7 @@ public function next()
*
* @return boolean The validity of the current element; true if it is valid
*/
#[\ReturnTypeWillChange]
public function valid()
{
return $this->count > 0;
Expand All @@ -167,6 +176,7 @@ public function valid()
*
* @return integer The number of embedded form fields
*/
#[\ReturnTypeWillChange]
public function count()
{
return count($this->fieldNames);
Expand Down
12 changes: 12 additions & 0 deletions lib/response/sfResponse.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ public function serialize()
return serialize($this->content);
}



/**
* Unserializes a sfResponse instance.
*
Expand All @@ -161,4 +163,14 @@ public function unserialize($serialized)
{
$this->content = unserialize($serialized);
}

public function __serialize()
{
return $this->serialize();
}

public function __unserialize($serialized)
{
return $this->unserialize($serialized);
}
}
10 changes: 10 additions & 0 deletions lib/util/sfNamespacedParameterHolder.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -396,4 +396,14 @@ public function unserialize($serialized)
$this->default_namespace = $data[0];
$this->parameters = $data[1];
}

public function __serialize()
{
return $this->serialize();
}

public function __unserialize($serialized)
{
return $this->unserialize($serialized);
}
}
10 changes: 10 additions & 0 deletions lib/util/sfParameterHolder.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,4 +210,14 @@ public function unserialize($serialized)
{
$this->parameters = unserialize($serialized);
}

public function __serialize()
{
return $this->serialize();
}

public function __unserialize($serialized)
{
return $this->unserialize($serialized);
}
}
10 changes: 10 additions & 0 deletions lib/validator/sfValidatorError.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,14 @@ public function unserialize($serialized)
{
list($this->validator, $this->arguments, $this->code, $this->message) = unserialize($serialized);
}

public function __serialize()
{
return $this->serialize();
}

public function __unserialize($serialized)
{
return $this->unserialize($serialized);
}
}
20 changes: 20 additions & 0 deletions lib/validator/sfValidatorErrorSchema.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ public function getMessageFormat()
*
* @return int The number of array
*/
#[\ReturnTypeWillChange]
public function count()
{
return count($this->errors);
Expand All @@ -194,6 +195,7 @@ public function count()
/**
* Reset the error array to the beginning (implements the Iterator interface).
*/
#[\ReturnTypeWillChange]
public function rewind()
{
reset($this->errors);
Expand All @@ -206,6 +208,7 @@ public function rewind()
*
* @return string The key
*/
#[\ReturnTypeWillChange]
public function key()
{
return key($this->errors);
Expand All @@ -216,6 +219,7 @@ public function key()
*
* @return mixed The escaped value
*/
#[\ReturnTypeWillChange]
public function current()
{
return current($this->errors);
Expand All @@ -224,6 +228,7 @@ public function current()
/**
* Moves to the next error (implements the Iterator interface).
*/
#[\ReturnTypeWillChange]
public function next()
{
next($this->errors);
Expand All @@ -236,6 +241,7 @@ public function next()
*
* @return boolean The validity of the current element; true if it is valid
*/
#[\ReturnTypeWillChange]
public function valid()
{
return $this->count > 0;
Expand All @@ -248,6 +254,7 @@ public function valid()
*
* @return bool true if the error exists, false otherwise
*/
#[\ReturnTypeWillChange]
public function offsetExists($name)
{
return isset($this->errors[$name]);
Expand All @@ -260,6 +267,7 @@ public function offsetExists($name)
*
* @return sfValidatorError A sfValidatorError instance
*/
#[\ReturnTypeWillChange]
public function offsetGet($name)
{
return isset($this->errors[$name]) ? $this->errors[$name] : null;
Expand All @@ -273,6 +281,7 @@ public function offsetGet($name)
*
* @throws LogicException
*/
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
throw new LogicException('Unable update an error.');
Expand All @@ -283,6 +292,7 @@ public function offsetSet($offset, $value)
*
* @param string $offset (ignored)
*/
#[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
}
Expand Down Expand Up @@ -341,4 +351,14 @@ public function unserialize($serialized)
{
list($this->validator, $this->arguments, $this->code, $this->message, $this->errors, $this->globalErrors, $this->namedErrors) = unserialize($serialized);
}

public function __serialize()
{
return $this->serialize();
}

public function __unserialize($serialized)
{
return $this->unserialize($serialized);
}
}
4 changes: 4 additions & 0 deletions lib/validator/sfValidatorSchema.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ public function getPostValidator()
*
* @return bool true if the schema has a field with the given name, false otherwise
*/
#[\ReturnTypeWillChange]
public function offsetExists($name)
{
return isset($this->fields[$name]);
Expand All @@ -305,6 +306,7 @@ public function offsetExists($name)
*
* @return sfValidatorBase The sfValidatorBase instance associated with the given name, null if it does not exist
*/
#[\ReturnTypeWillChange]
public function offsetGet($name)
{
return isset($this->fields[$name]) ? $this->fields[$name] : null;
Expand All @@ -316,6 +318,7 @@ public function offsetGet($name)
* @param string $name The field name
* @param sfValidatorBase $validator An sfValidatorBase instance
*/
#[\ReturnTypeWillChange]
public function offsetSet($name, $validator)
{
if (!$validator instanceof sfValidatorBase)
Expand All @@ -331,6 +334,7 @@ public function offsetSet($name, $validator)
*
* @param string $name
*/
#[\ReturnTypeWillChange]
public function offsetUnset($name)
{
unset($this->fields[$name]);
Expand Down
10 changes: 10 additions & 0 deletions lib/view/sfViewParameterHolder.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,4 +186,14 @@ public function unserialize($serialized)
$this->setEscapingMethod($escapingMethod);
$this->setEscaping($escaping);
}

public function __serialize()
{
return $this->serialize();
}

public function __unserialize($serialized)
{
return $this->unserialize($serialized);
}
}
4 changes: 4 additions & 0 deletions lib/widget/sfWidgetFormSchema.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ public function setParent(sfWidgetFormSchema $parent = null)
*
* @return bool true if the schema has a field with the given name, false otherwise
*/
#[\ReturnTypeWillChange]
public function offsetExists($name)
{
return isset($this->fields[$name]);
Expand All @@ -514,6 +515,7 @@ public function offsetExists($name)
*
* @return sfWidget The sfWidget instance associated with the given name, null if it does not exist
*/
#[\ReturnTypeWillChange]
public function offsetGet($name)
{
return isset($this->fields[$name]) ? $this->fields[$name] : null;
Expand All @@ -525,6 +527,7 @@ public function offsetGet($name)
* @param string $name The field name
* @param sfWidget $widget An sfWidget instance
*/
#[\ReturnTypeWillChange]
public function offsetSet($name, $widget)
{
if (!$widget instanceof sfWidget)
Expand All @@ -551,6 +554,7 @@ public function offsetSet($name, $widget)
*
* @param string
*/
#[\ReturnTypeWillChange]
public function offsetUnset($name)
{
unset($this->fields[$name]);
Expand Down
2 changes: 1 addition & 1 deletion lib/yaml/sfYamlInline.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ static public function dump($value)
return 'true';
case false === $value:
return 'false';
case ctype_digit($value):
case ctype_digit((string) $value):
return is_string($value) ? "'$value'" : (int) $value;
case is_numeric($value):
return is_infinite($value) ? str_ireplace('INF', '.Inf', strval($value)) : (is_string($value) ? "'$value'" : $value);
Expand Down

0 comments on commit 1313a0c

Please sign in to comment.