Skip to content

Commit

Permalink
Upgrade to php 8.1 (#80)
Browse files Browse the repository at this point in the history
* fix function signature

* more signature #[\ReturnTypeWillChange]
  • Loading branch information
OlivierLamyCanuel committed Jan 31, 2023
1 parent 203b84b commit c85d667
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -1906,6 +1906,7 @@ private function callValidators($value, ValidationField $field) {
* @link http://php.net/manual/en/jsonserializable.jsonserialize.php
* @link http://json-schema.org/
*/
#[\ReturnTypeWillChange]
public function jsonSerialize() {
$seen = [$this];
return $this->jsonSerializeInternal($seen);
Expand Down Expand Up @@ -2080,6 +2081,7 @@ public function setID(string $id) {
* @return boolean true on success or false on failure.
* @link http://php.net/manual/en/arrayaccess.offsetexists.php
*/
#[\ReturnTypeWillChange]
public function offsetExists($offset) {
return isset($this->schema[$offset]);
}
Expand All @@ -2091,6 +2093,7 @@ public function offsetExists($offset) {
* @return mixed Can return all value types.
* @link http://php.net/manual/en/arrayaccess.offsetget.php
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset) {
return isset($this->schema[$offset]) ? $this->schema[$offset] : null;
}
Expand All @@ -2102,6 +2105,7 @@ public function offsetGet($offset) {
* @param mixed $value The value to set.
* @link http://php.net/manual/en/arrayaccess.offsetset.php
*/
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value) {
$this->schema[$offset] = $value;
}
Expand All @@ -2112,6 +2116,7 @@ public function offsetSet($offset, $value) {
* @param mixed $offset The offset to unset.
* @link http://php.net/manual/en/arrayaccess.offsetunset.php
*/
#[\ReturnTypeWillChange]
public function offsetUnset($offset) {
unset($this->schema[$offset]);
}
Expand Down
1 change: 1 addition & 0 deletions src/Validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,7 @@ public function getConcatMessage($field = null, string $sep = ' ', bool $punctua
* which is a value of any type other than a resource.
* @link http://php.net/manual/en/jsonserializable.jsonserialize.php
*/
#[\ReturnTypeWillChange]
public function jsonSerialize() {
$errors = [];

Expand Down
1 change: 1 addition & 0 deletions src/ValidationException.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public function __construct(Validation $validation) {
* @return mixed data which can be serialized by <b>json_encode</b>,
* which is a value of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize() {
return $this->validation->jsonSerialize();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/StringValidationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public function testPattern($str, $code = '', $pattern = '^[a-z]o+$') {
if (!empty($code)) {
$this->fail("'$str' shouldn't validate against a pattern of $pattern.");
} else {
$this->assertRegExp("/{$pattern}/", $str);
$this->assertMatchesRegularExpression("/{$pattern}/", $str);
}
} catch (ValidationException $ex) {
$this->assertFieldHasError($ex->getValidation(), 'str', $code);
Expand Down

0 comments on commit c85d667

Please sign in to comment.