Skip to content

Commit

Permalink
Init php8.1 compatibility
Browse files Browse the repository at this point in the history
This marks the start of the php 8.1 compatbility work. We'll have a new
major version after the compat-work and refactorings are done within the
source, so the <php8.1 support will continue in the 3.x branch
  • Loading branch information
usox committed Dec 7, 2021
1 parent 6f02a2d commit bba50fe
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
fail-fast: false
matrix:
os: ['ubuntu-latest']
php-versions: [7.3, 7.4, 8.0]
php-versions: [8.1]
steps:
- name: Set locales
run: |
Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,18 @@
Requirements
============

To use PHPTAL in your projects, you will require PHP 7.3 or later.
See the compatibility table below for supported php versions.

If you want to use the builtin internationalisation system (I18N), the php-gettext extension must be installed or compiled into PHP (`--with-gettext`).

Compatibility
=============

| PHPTAL-Version | PHP-Version(s) |
|----------------|----------------|
| 3.x | 7.3, 7.4, 8.0 |
| master | 8.1 |

Composer install (recommended)
==============================

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"ext-dom": "*",
"ext-gettext": "*",
"ext-simplexml": "*",
"php": "^7.3||^8.0",
"php": "^8.1",
"symfony/polyfill-mbstring": "^1.12"
},
"require-dev": {
Expand All @@ -55,7 +55,7 @@
},
"config": {
"platform": {
"php": "7.3"
"php": "8.1"
},
"bin-dir": "bin",
"sort-packages": true
Expand Down
5 changes: 2 additions & 3 deletions src/RepeatController.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public function __construct($source)
*
* @return Mixed The current element value
*/
public function current()
public function current(): mixed
{
return $this->current;
}
Expand All @@ -143,8 +143,7 @@ public function current()
*
* @return String/Int The current element key
*/
public function key()
{
public function key(): mixed {
return $this->key;
}

Expand Down
14 changes: 7 additions & 7 deletions tests/Testhelper/LogIteratorCalls.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,31 +42,31 @@ public function __construct($arr)
}
}

public function current()
public function current(): mixed
{
$this->log .= "current\n";
return $this->i->current();
}

public function next()
public function next(): void
{
$this->log .= "next\n";
return $this->i->next();
$this->i->next();
}

public function key()
public function key(): mixed
{
$this->log .= "key\n";
return $this->i->key();
}

public function rewind()
public function rewind(): void
{
$this->log .= "rewind\n";
return $this->i->rewind();
$this->i->rewind();
}

public function valid()
public function valid(): bool
{
$this->log .= "valid\n";
return $this->i->valid();
Expand Down
4 changes: 1 addition & 3 deletions tests/Testhelper/MyArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@ public function push($value): void

/**
* @param string $index
*
* @return mixed
*/
public function offsetGet($index)
public function offsetGet($index): mixed
{
return $this->values[$index];
}
Expand Down
3 changes: 1 addition & 2 deletions tests/Testhelper/MyIterable.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,9 @@ public function key(): int
/**
* @return int
*/
public function next(): int
public function next(): void
{
$this->index++;
return $this->index;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/Testhelper/MyIterableThrowsOnSize.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class MyIterableThrowsOnSize extends MyIterable implements Countable
/**
* @throws SizeCalledException
*/
public function count()
public function count(): int
{
throw new SizeCalledException('count() called');
}
Expand Down

0 comments on commit bba50fe

Please sign in to comment.