Skip to content

PHP8 #265

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed

PHP8 #265

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions lib/addon/sfPager.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ protected function resetIterator()
*
* @see Iterator
*/
public function current()
public function current(): mixed
{
if (!$this->isIteratorInitialized())
{
Expand All @@ -544,7 +544,7 @@ public function current()
*
* @see Iterator
*/
public function key()
public function key(): mixed
{
if (!$this->isIteratorInitialized())
{
Expand All @@ -559,7 +559,7 @@ public function key()
*
* @see Iterator
*/
public function next()
public function next(): void
{
if (!$this->isIteratorInitialized())
{
Expand All @@ -568,15 +568,15 @@ public function next()

--$this->resultsCounter;

return next($this->results);
next($this->results);
}

/**
* Resets the internal pointer and returns the current result.
*
* @see Iterator
*/
public function rewind()
public function rewind(): void
{
if (!$this->isIteratorInitialized())
{
Expand All @@ -585,15 +585,15 @@ public function rewind()

$this->resultsCounter = count($this->results);

return reset($this->results);
reset($this->results);
}

/**
* Returns true if pointer is within bounds.
*
* @see Iterator
*/
public function valid()
public function valid(): bool
{
if (!$this->isIteratorInitialized())
{
Expand All @@ -608,7 +608,7 @@ public function valid()
*
* @see Countable
*/
public function count()
public function count(): int
{
return $this->getNbResults();
}
Expand Down
20 changes: 10 additions & 10 deletions lib/escaper/sfOutputEscaperArrayDecorator.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct($escapingMethod, $value)
/**
* Reset the array to the beginning (as required for the Iterator interface).
*/
public function rewind()
public function rewind(): void
{
reset($this->value);

Expand All @@ -54,7 +54,7 @@ public function rewind()
*
* @return string The key
*/
public function key()
public function key(): mixed
{
return key($this->value);
}
Expand All @@ -67,15 +67,15 @@ public function key()
*
* @return mixed The escaped value
*/
public function current()
public function current(): mixed
{
return sfOutputEscaper::escape($this->escapingMethod, current($this->value));
}

/**
* Moves to the next element (as required by the Iterator interface).
*/
public function next()
public function next(): void
{
next($this->value);

Expand All @@ -91,7 +91,7 @@ public function next()
*
* @return bool The validity of the current element; true if it is valid
*/
public function valid()
public function valid(): bool
{
return $this->count > 0;
}
Expand All @@ -103,7 +103,7 @@ public function valid()
*
* @return bool true if the offset isset; false otherwise
*/
public function offsetExists($offset)
public function offsetExists(mixed $offset): bool
{
return isset($this->value[$offset]);
}
Expand All @@ -115,7 +115,7 @@ public function offsetExists($offset)
*
* @return mixed The escaped value
*/
public function offsetGet($offset)
public function offsetGet(mixed $offset): mixed
{
return sfOutputEscaper::escape($this->escapingMethod, $this->value[$offset]);
}
Expand All @@ -132,7 +132,7 @@ public function offsetGet($offset)
*
* @throws sfException
*/
public function offsetSet($offset, $value)
public function offsetSet(mixed $offset, mixed $value): void
{
throw new sfException('Cannot set values.');
}
Expand All @@ -148,7 +148,7 @@ public function offsetSet($offset, $value)
*
* @throws sfException
*/
public function offsetUnset($offset)
public function offsetUnset(mixed $offset): void
{
throw new sfException('Cannot unset values.');
}
Expand All @@ -158,7 +158,7 @@ public function offsetUnset($offset)
*
* @return int The size of the array
*/
public function count()
public function count(): int
{
return count($this->value);
}
Expand Down
22 changes: 11 additions & 11 deletions lib/escaper/sfOutputEscaperIteratorDecorator.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,17 @@ public function __construct($escapingMethod, Traversable $value)
*
* @return void
*/
public function rewind()
public function rewind(): void
{
return $this->iterator->rewind();
$this->iterator->rewind();
}

/**
* Escapes and gets the current element (as required by the Iterator interface).
*
* @return mixed The escaped value
*/
public function current()
public function current(): mixed
{
return sfOutputEscaper::escape($this->escapingMethod, $this->iterator->current());
}
Expand All @@ -76,7 +76,7 @@ public function current()
*
* @return string Iterator key
*/
public function key()
public function key(): mixed
{
return $this->iterator->key();
}
Expand All @@ -86,9 +86,9 @@ public function key()
*
* @return void
*/
public function next()
public function next(): void
{
return $this->iterator->next();
$this->iterator->next();
}

/**
Expand All @@ -97,7 +97,7 @@ public function next()
*
* @return bool true if the current element is valid; false otherwise
*/
public function valid()
public function valid(): bool
{
return $this->iterator->valid();
}
Expand All @@ -109,7 +109,7 @@ public function valid()
*
* @return bool true if the offset isset; false otherwise
*/
public function offsetExists($offset)
public function offsetExists(mixed $offset): bool
{
return isset($this->value[$offset]);
}
Expand All @@ -121,7 +121,7 @@ public function offsetExists($offset)
*
* @return mixed The escaped value
*/
public function offsetGet($offset)
public function offsetGet(mixed $offset): mixed
{
return sfOutputEscaper::escape($this->escapingMethod, $this->value[$offset]);
}
Expand All @@ -138,7 +138,7 @@ public function offsetGet($offset)
*
* @throws sfException
*/
public function offsetSet($offset, $value)
public function offsetSet(mixed $offset, mixed $value): void
{
throw new sfException('Cannot set values.');
}
Expand All @@ -154,7 +154,7 @@ public function offsetSet($offset, $value)
*
* @throws sfException
*/
public function offsetUnset($offset)
public function offsetUnset(mixed $offset): void
{
throw new sfException('Cannot unset values.');
}
Expand Down
2 changes: 1 addition & 1 deletion lib/escaper/sfOutputEscaperObjectDecorator.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public function __isset($key)
*
* @return int The size of the object
*/
public function count()
public function count(): int
{
return count($this->value);
}
Expand Down
10 changes: 5 additions & 5 deletions lib/event/sfEvent.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ public function getParameters()
*
* @return Boolean true if the parameter exists, false otherwise
*/
public function offsetExists($name)
public function offsetExists(mixed $offset): bool
{
return array_key_exists($name, $this->parameters);
return array_key_exists($offset, $this->parameters);
}

/**
Expand All @@ -129,7 +129,7 @@ public function offsetExists($name)
*
* @return mixed The parameter value
*/
public function offsetGet($name)
public function offsetGet(mixed $name): mixed
{
if (!array_key_exists($name, $this->parameters))
{
Expand All @@ -145,7 +145,7 @@ public function offsetGet($name)
* @param string $name The parameter name
* @param mixed $value The parameter value
*/
public function offsetSet($name, $value)
public function offsetSet(mixed $name, mixed $value): void
{
$this->parameters[$name] = $value;
}
Expand All @@ -155,7 +155,7 @@ public function offsetSet($name, $value)
*
* @param string $name The parameter name
*/
public function offsetUnset($name)
public function offsetUnset(mixed $name): void
{
unset($this->parameters[$name]);
}
Expand Down
22 changes: 11 additions & 11 deletions lib/form/sfForm.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1064,9 +1064,9 @@ public function resetFormFields()
*
* @return Boolean true if the widget exists, false otherwise
*/
public function offsetExists($name)
public function offsetExists(mixed $offset): bool
{
return isset($this->widgetSchema[$name]);
return isset($this->widgetSchema[$offset]);
}

/**
Expand All @@ -1076,7 +1076,7 @@ public function offsetExists($name)
*
* @return sfFormField|sfFormFieldSchema A form field instance
*/
public function offsetGet($name)
public function offsetGet(mixed $name): mixed
{
if (!isset($this->formFields[$name]))
{
Expand Down Expand Up @@ -1114,7 +1114,7 @@ public function offsetGet($name)
*
* @throws <b>LogicException</b>
*/
public function offsetSet($offset, $value)
public function offsetSet(mixed $offset, mixed $value): void
{
throw new LogicException('Cannot update form fields.');
}
Expand All @@ -1126,7 +1126,7 @@ public function offsetSet($offset, $value)
*
* @param string $offset The field name
*/
public function offsetUnset($offset)
public function offsetUnset(mixed $offset): void
{
unset(
$this->widgetSchema[$offset],
Expand Down Expand Up @@ -1227,7 +1227,7 @@ public function getErrors()
/**
* Resets the field names array to the beginning (implements the Iterator interface).
*/
public function rewind()
public function rewind(): void
{
$this->fieldNames = $this->widgetSchema->getPositions();

Expand All @@ -1240,7 +1240,7 @@ public function rewind()
*
* @return string The key
*/
public function key()
public function key(): mixed
{
return current($this->fieldNames);
}
Expand All @@ -1250,15 +1250,15 @@ public function key()
*
* @return mixed The escaped value
*/
public function current()
public function current(): mixed
{
return $this[current($this->fieldNames)];
}

/**
* Moves to the next form field (implements the Iterator interface).
*/
public function next()
public function next(): void
{
next($this->fieldNames);
--$this->count;
Expand All @@ -1269,7 +1269,7 @@ public function next()
*
* @return boolean The validity of the current element; true if it is valid
*/
public function valid()
public function valid(): bool
{
return $this->count > 0;
}
Expand All @@ -1279,7 +1279,7 @@ public function valid()
*
* @return integer The number of embedded form fields
*/
public function count()
public function count(): int
{
return count($this->getFormFieldSchema());
}
Expand Down
Loading