Skip to content

Commit c431d34

Browse files
authored
Merge pull request #21 from kagg-design/php-8.4
PHP 8.1 - 8.4 compatibility
2 parents 0bf4a35 + 09bbea6 commit c431d34

File tree

14 files changed

+35
-22
lines changed

14 files changed

+35
-22
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
strategy:
99
matrix:
1010
os: [ubuntu-latest, windows-latest]
11-
php-version: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
11+
php-version: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
1212
name: PHP ${{ matrix.php-version }} on ${{ matrix.os }}
1313

1414
steps:

bin/update-tests

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This file updates tests according to the phpunit library used for current php version, or php version in 1st argument.
33
# Usage:
44
# update-tests - to update tests according to the phpunit library used for current php version.
5-
# update-tests x.x - to update tests according to the phpunit library used for specific php version x.x, where x.x = 5.6|7.0|7.1|7.2|7.3|7.4|8.0.
5+
# update-tests x.x - to update tests according to the phpunit library used for specific php version x.x, where x.x = 5.6|7.0|7.1|7.2|7.3|7.4|8.0|8.1|8.2|8.3|8.4.
66

77
# Directory with phpunit tests.
88
TEST_DIR="tests"
@@ -14,7 +14,7 @@ else
1414
fi
1515

1616
if [[ $1 == '' && $DEV_MODE != '1' ]]; then
17-
echo "Script works with composer in dev mode only."
17+
# Script works with composer in dev mode only.
1818
exit 0
1919
fi
2020

@@ -52,7 +52,7 @@ elif [[ $PHP_VERSION == '7.1' ]]; then
5252
PHP_UNIT='7.5'
5353
elif [[ $PHP_VERSION == '7.2' ]]; then
5454
PHP_UNIT='8.5'
55-
elif [[ $PHP_VERSION == '7.3' || $PHP_VERSION == '7.4' || $PHP_VERSION == '8.0' ]]; then
55+
elif [[ $PHP_VERSION == '7.3' || $PHP_VERSION == '7.4' || $PHP_VERSION == '8.0' || $PHP_VERSION == '8.1' || $PHP_VERSION == '8.2' || $PHP_VERSION == '8.3' || $PHP_VERSION == '8.4' ]]; then
5656
PHP_UNIT='9.5'
5757
fi
5858

changelog.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ All notable changes to this project will be documented in this file. This projec
33

44
## [Unreleased][unreleased]
55

6+
## [1.5.0]
7+
### Added
8+
- Support for PHP 8.4.
9+
10+
### Changed
11+
- The minimum required PHP version is now 7.2.
12+
613
## [1.4.0]
714
### Added
815
- PHP 8 compatibility and test coverage (thanks @kagg-design)
@@ -21,7 +28,7 @@ All notable changes to this project will be documented in this file. This projec
2128

2229
## [1.3.7]
2330
### Fixed
24-
- issue that would generate en excpetion when providing an empty configuration to the `FunctionMocker::init` method
31+
- issue that would generate en exception when providing an empty configuration to the `FunctionMocker::init` method
2532

2633
## [1.3.6]
2734
### Fixed

composer.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
],
1111
"minimum-stability": "stable",
1212
"require": {
13-
"phpunit/phpunit": "5.7 - 9.5",
14-
"antecedent/patchwork": "^2.0",
15-
"lucatume/args": "^1.0"
13+
"php": ">=7.1",
14+
"phpunit/phpunit": "7.5 - 9.6",
15+
"antecedent/patchwork": "^2.2.0",
16+
"lucatume/args": "^1.0.1"
1617
},
1718
"autoload": {
1819
"psr-0": {

src/functions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* @see \Patchwork\configure()
1515
*
1616
*/
17-
function init(array $options = null) {
17+
function init(?array $options = null) {
1818
FunctionMocker::init($options);
1919
}
2020

src/tad/FunctionMocker/Call/Logger/LoggerInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
interface LoggerInterface
66
{
77

8-
public function called(array $args = null);
8+
public function called(?array $args = null);
99
}

src/tad/FunctionMocker/Call/Logger/SpyCallLogger.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ public function __construct()
2222
: '\\PHPUnit\\Framework\\Constraint\\Constraint';
2323
}
2424

25-
public function called(array $args = null)
25+
public function called(?array $args = null)
2626
{
2727
$this->calls[] = CallTrace::fromArguments($args);
2828
}
2929

30-
public function getCallTimes(array $args = null)
30+
public function getCallTimes(?array $args = null)
3131
{
3232
$calls = $this->calls;
3333
if ($args) {

src/tad/FunctionMocker/Call/Verifier/InstanceMethodCallVerifier.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ private function realWasCalledTimes( $times ) {
4343
*
4444
* @return array
4545
*/
46-
protected function getCallTimesWithArgs( $methodName, array $args = null ) {
46+
protected function getCallTimesWithArgs( $methodName, ?array $args = null ) {
4747
$invocations = $this->getInvocations();
4848
$callTimes = 0;
4949
array_map( function ( $invocation ) use ( &$callTimes, $args, $methodName ) {

src/tad/FunctionMocker/CallTrace.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class CallTrace
77

88
protected $args;
99

10-
public static function fromArguments(array $args = null)
10+
public static function fromArguments(?array $args = null)
1111
{
1212
$instance = new self;
1313
$instance->args = $args ? $args : array();

src/tad/FunctionMocker/FunctionMocker.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public static function setUp() {
5454
*
5555
* @see \Patchwork\configure()
5656
*/
57-
public static function init(array $options = null, $forceReinit = false) {
57+
public static function init(?array $options = null, $forceReinit = false) {
5858
if (!$forceReinit && self::$didInit) {
5959
return;
6060
}
@@ -300,7 +300,7 @@ private static function getIndexedReplacements($return) {
300300
*
301301
* @return mixed
302302
*/
303-
public static function callOriginal(array $args = null) {
303+
public static function callOriginal(?array $args = null) {
304304
return \Patchwork\relay($args);
305305
}
306306

@@ -367,7 +367,7 @@ public static function forge($class) {
367367
*
368368
* @throws \RuntimeException If the Patchwork configuration file or the checksum file could not be written.
369369
*/
370-
public static function writePatchworkConfig(array $options = null, $destinationFolder) {
370+
public static function writePatchworkConfig(?array $options = null, $destinationFolder = '') {
371371
$options = self::getPatchworkConfiguration($options, $destinationFolder);
372372

373373
$configFileContents = json_encode($options);

0 commit comments

Comments
 (0)