Skip to content

Commit

Permalink
Improve PHP-8 compatibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
gabordemooij committed Mar 1, 2021
1 parent 1bfa8b5 commit fe76169
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 6 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ language: php
env:
global:
- XDEBUG_MODE=coverage

services:
- mysql
- postgresql


matrix:
include:
- php: 5.3
Expand All @@ -23,6 +29,8 @@ matrix:
dist: trusty
- php: 7.4
dist: trusty
- php: 8.0
dist: xenial


before_script:
Expand Down
2 changes: 1 addition & 1 deletion RedBeanPHP/DuplicationManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ public function __construct( ToolBox $toolbox )
public function camelfy( $array, $dolphinMode = FALSE ) {
$newArray = array();
foreach( $array as $key => $element ) {
$newKey = preg_replace_callback( '/_(\w)/', function( &$matches ){
$newKey = preg_replace_callback( '/_(\w)/', function( $matches ){
return strtoupper( $matches[1] );
}, $key);

Expand Down
2 changes: 1 addition & 1 deletion testing/RedUNIT/Base/Finding.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public function testPreloadingOwnListWithMulti()
asrt(count($book->noLoad()->ownPageList),2);
asrt($book->title,"book{$i}");
$pages = $book->noLoad()->ownPageList;
usort($pages, function($a,$b){ return $a->title > $b->title; });
usort($pages, function($a,$b){ return strcmp( $a->title, $b->title ); });
$first = reset($pages);
asrt( $first->title, "1/$i" );
$last = end($pages);
Expand Down
2 changes: 1 addition & 1 deletion testing/RedUNIT/Base/Misc.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ public function testBeautifulColumnNames()
asrt( ( $town->name == 'BeautyVille' ), TRUE );
testpack( 'Accept datetime objects.' );
$cal = R::dispense( 'calendar' );
$cal->when = new\DateTime( '2000-01-01', new\DateTimeZone( 'Pacific/Nauru' ) );
$cal->when = new \DateTime( '2000-01-01', new \DateTimeZone( 'Pacific/Nauru' ) );
asrt( $cal->when, '2000-01-01 00:00:00' );
testpack( 'Affected rows test' );
$currentDriver = $this->currentlyActiveDriverID;
Expand Down
2 changes: 1 addition & 1 deletion testing/RedUNIT/Base/Typechecking.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function testTypes()
$bean->bool2 = TRUE;
$bean->text = 'abc';
$bean->null = null;
$bean->datetime = new\DateTime( 'NOW', new\DateTimeZone( 'Europe/Amsterdam' ) );
$bean->datetime = new \DateTime( 'NOW', new \DateTimeZone( 'Europe/Amsterdam' ) );
$id = R::store( $bean );
asrt( is_int( $id ), TRUE );
asrt( is_float( $bean->float ), TRUE );
Expand Down
4 changes: 2 additions & 2 deletions testing/RedUNIT/Blackhole/Misc.php
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ public function testTransactionInFacade()
R::transaction( function () use ( $bean ) {
R::store( $bean );
R::transaction( function () {
throw new\Exception();
throw new \Exception();
} );
} );
} catch (\Exception $e ) {
Expand All @@ -376,7 +376,7 @@ public function testTransactionInFacade()
R::transaction( function () use ( $bean ) {
R::transaction( function () use ( $bean ) {
R::store( $bean );
throw new\Exception();
throw new \Exception();
} );
} );
} catch (\Exception $e ) {
Expand Down

0 comments on commit fe76169

Please sign in to comment.