Skip to content

Commit 9cfdc7e

Browse files
committed
fix code to work with php 7.2
1 parent 51d92d6 commit 9cfdc7e

File tree

5 files changed

+19
-16
lines changed

5 files changed

+19
-16
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"minimum-stability": "dev",
1414
"prefer-stable": true,
1515
"require": {
16-
"php": "7.1.*",
16+
"php": "^7.1",
1717
"doctrine/common": "^2.4",
1818
"doctrine/annotations": "^1.2",
1919
"doctrine/data-fixtures": "^1.0",

lib/Doctrine/ODM/PHPCR/Id/IdException.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public static function noIdentificationParameters($document, $parent, $nodename)
1414
'may not be empty in document of class "%s"',
1515
$parent,
1616
$nodename,
17-
ClassUtils::getClass($document)
17+
$document ? ClassUtils::getClass($document) : 'null'
1818
);
1919

2020
return new self($message);
@@ -25,7 +25,7 @@ public static function noIdNoParent($document, $parent)
2525
$message = sprintf(
2626
'Property "%s" mapped as ParentDocument may not be empty in document of class "%s"',
2727
$parent,
28-
ClassUtils::getClass($document)
28+
$document ? ClassUtils::getClass($document) : 'null'
2929
);
3030

3131
return new self($message);
@@ -36,7 +36,7 @@ public static function noIdNoName($document, $fieldName)
3636
$message = sprintf(
3737
'NodeName property "%s" may not be empty in document of class "%s"',
3838
$fieldName,
39-
ClassUtils::getClass($document)
39+
$document ? ClassUtils::getClass($document) : 'null'
4040
);
4141

4242
return new self($message);
@@ -49,7 +49,7 @@ public static function parentIdCouldNotBeDetermined($document, $parent, $parentO
4949
'ParentDocument property "%s" of document of class "%s" contains an ' .
5050
'object for which no ID could be found',
5151
$parent,
52-
ClassUtils::getClass($document),
52+
$document ? ClassUtils::getClass($document) : 'null',
5353
$parentType
5454
);
5555

@@ -61,7 +61,7 @@ public static function illegalName($document, $fieldName, $nodeName)
6161
$message = sprintf(
6262
'NodeName property "%s" of document "%s" contains the illegal PHPCR value "%s".',
6363
$fieldName,
64-
ClassUtils::getClass($document),
64+
$document ? ClassUtils::getClass($document) : 'null',
6565
$nodeName
6666
);
6767

@@ -78,7 +78,7 @@ public static function conflictingChildName(
7878
$message = sprintf(
7979
'%s discovered as new child of %s in field "%s" has a node name ' .
8080
'mismatch. The mapping says "%s" but the child was assigned "%s".',
81-
ClassUtils::getClass($childDocument),
81+
$childDocument ? ClassUtils::getClass($childDocument) : 'null',
8282
$parentId,
8383
$parentFieldName,
8484
$fieldNodeName,

tests/Doctrine/Tests/ODM/PHPCR/Functional/FindTypeValidationTest.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
namespace Doctrine\Tests\ODM\PHPCR\Functional;
44

5-
use Doctrine\ODM\PHPCR\Id\RepositoryIdInterface;
6-
use Doctrine\ODM\PHPCR\DocumentRepository;
7-
use Doctrine\ODM\PHPCR\Exception\InvalidArgumentException;
5+
use Doctrine\Tests\ODM\PHPCR\PHPCRFunctionalTestCase;
86
use PHPCR\PropertyType;
97
use Doctrine\ODM\PHPCR\Mapping\Annotations as PHPCRODM;
108

@@ -13,7 +11,7 @@
1311
*
1412
* @group functional
1513
*/
16-
class FindTypeValidationTest extends \Doctrine\Tests\ODM\PHPCR\PHPCRFunctionalTestCase
14+
class FindTypeValidationTest extends PHPCRFunctionalTestCase
1715
{
1816
/**
1917
* @var \Doctrine\ODM\PHPCR\DocumentManager
@@ -114,7 +112,7 @@ public function testNotInstanceOf()
114112
{
115113
$user = $this->dm->find('Doctrine\Tests\ODM\PHPCR\Functional\TypeTeamUser', '/functional/user');
116114

117-
$this->assertTrue(null === $user, get_class($user));
115+
$this->assertTrue(null === $user, is_object($user) ? get_class($user) : $user);
118116
}
119117

120118
/**
@@ -126,7 +124,7 @@ public function testCacheNotInstanceOf()
126124
$this->assertInstanceOf($this->type, $user);
127125

128126
$user = $this->dm->find('Doctrine\Tests\ODM\PHPCR\Functional\TypeTeamUser', '/functional/user');
129-
$this->assertTrue(null === $user, get_class($user));
127+
$this->assertTrue(null === $user, is_object($user) ? get_class($user) : $user);
130128
}
131129

132130
/**

tests/Doctrine/Tests/ODM/PHPCR/Id/ParentIdGeneratorTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
class ParentIdGeneratorTest extends \PHPUnit_Framework_TestCase
99
{
1010
/**
11-
* @covers Doctrine\ODM\PHPCR\Id\ParentIdGenerator::generate
11+
* @covers \Doctrine\ODM\PHPCR\Id\ParentIdGenerator::generate
1212
*/
1313
public function testGenerate()
1414
{
@@ -34,7 +34,7 @@ public function testGenerate()
3434
}
3535

3636
/**
37-
* @covers Doctrine\ODM\PHPCR\Id\ParentIdGenerator::generate
37+
* @covers \Doctrine\ODM\PHPCR\Id\ParentIdGenerator::generate
3838
*/
3939
public function testGenerateNoParent()
4040
{
@@ -48,7 +48,7 @@ public function testGenerateNoParent()
4848
}
4949

5050
/**
51-
* @covers Doctrine\ODM\PHPCR\Id\ParentIdGenerator::generate
51+
* @covers \Doctrine\ODM\PHPCR\Id\ParentIdGenerator::generate
5252
*/
5353
public function testGenerateNoName()
5454
{

tests/Doctrine/Tests/ODM/PHPCR/Tools/Command/DocumentConvertTranslationCommandTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ public function testCommand()
6060
->with('Document\MyClass', array('en'), array(), 'none')
6161
->will($this->returnValue(false))
6262
;
63+
$this->converter
64+
->expects($this->any())
65+
->method('getLastNotices')
66+
->will($this->returnValue(array()))
67+
;
6368

6469
$this->mockSession
6570
->expects($this->once())

0 commit comments

Comments
 (0)