Skip to content

Commit

Permalink
Merge pull request #2469 from IonBazan/feature/php-7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
greg0ire authored Sep 30, 2022
2 parents db2e608 + 1e8b62c commit 74c477f
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 29 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"phpbench/phpbench": "^1.0.0",
"phpstan/phpstan": "^1.4.6",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^9",
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "^3.5",
"symfony/cache": "^4.4 || ^5.0 || ^6.0",
"vimeo/psalm": "^4.20.0"
Expand Down
3 changes: 1 addition & 2 deletions lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -2597,8 +2597,7 @@ private function checkDuplicateMapping(array $mapping): void

private function isTypedProperty(string $name): bool
{
return PHP_VERSION_ID >= 70400
&& $this->reflClass->hasProperty($name)
return $this->reflClass->hasProperty($name)
&& $this->reflClass->getProperty($name)->hasType();
}

Expand Down
16 changes: 2 additions & 14 deletions tests/Doctrine/ODM/MongoDB/Tests/Functional/FunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,28 +52,16 @@

use function assert;
use function bcscale;
use function bcsqrt;
use function min;
use function strlen;
use function version_compare;

use const PHP_VERSION;

class FunctionalTest extends BaseTest
{
/** @var int */
private $initialScale;
private int $initialScale;

public function setUp(): void
{
parent::setUp();

if (version_compare('7.3.0', PHP_VERSION, '<=')) {
$this->initialScale = bcscale(2);
} else {
$this->initialScale = min(0, strlen(bcsqrt('2')) - 2);
bcscale(2);
}
$this->initialScale = bcscale(2);
}

public function tearDown(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
use Documents74\GH2310Embedded;
use MongoDB\BSON\ObjectId;

/**
* @requires PHP 7.4
*/
class GH2310Test extends BaseTest
{
public function testFindWithNullableEmbeddedAfterUpsert(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@

use function assert;

/**
* @requires PHP 7.4
*/
class TypedPropertiesTest extends BaseTest
{
public function testPersistNew(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,6 @@ public function testIdentifier(ClassMetadata $class): ClassMetadata
return $class;
}

/**
* @requires PHP >= 7.4
*/
public function testFieldTypeFromReflection(): void
{
$class = $this->dm->getClassMetadata(UserTyped::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,6 @@ public function testFieldIsNullable(): void
$this->assertFalse($cm->isNullable('name'), 'By default a field should not be nullable.');
}

/**
* @requires PHP >= 7.4
*/
public function testFieldTypeFromReflection(): void
{
$cm = new ClassMetadata(UserTyped::class);
Expand Down

0 comments on commit 74c477f

Please sign in to comment.