Skip to content

Commit

Permalink
check php version instead of method_exists
Browse files Browse the repository at this point in the history
  • Loading branch information
connorhu committed Feb 6, 2024
1 parent ac7f0c4 commit 437e9b6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions tests/Query/DbTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use PHPUnit\Framework\TestCase;
use Symfony\Component\Cache\Adapter\ArrayAdapter;

use function method_exists;
use const PHP_VERSION_ID;

class DbTestCase extends TestCase
{
Expand All @@ -21,7 +21,7 @@ class DbTestCase extends TestCase

public function setUp(): void
{
if (method_exists(ORMSetup::class, 'createDefaultAnnotationDriver')) {
if (PHP_VERSION_ID < 80000) {
$this->configuration = new Configuration();
$this->configuration->setMetadataDriverImpl(ORMSetup::createDefaultAnnotationDriver([__DIR__ . '/../../Entities']));
} else {
Expand Down
5 changes: 3 additions & 2 deletions tests/Types/CarbonDateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
use Symfony\Component\Cache\Adapter\ArrayAdapter;

use function assert;
use function method_exists;

use const PHP_VERSION_ID;

/**
* Test type that maps an SQL DATETIME/TIMESTAMP to a Carbon/Carbon object.
Expand All @@ -41,7 +42,7 @@ public static function setUpBeforeClass(): void

public function setUp(): void
{
if (method_exists(ORMSetup::class, 'createDefaultAnnotationDriver')) {
if (PHP_VERSION_ID < 80000) {
$config = new Configuration();
$config->setMetadataDriverImpl(ORMSetup::createDefaultAnnotationDriver([__DIR__ . '/../../Entities']));
} else {
Expand Down
5 changes: 3 additions & 2 deletions tests/Types/ZendDateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
use Zend_Date;

use function assert;
use function method_exists;

use const PHP_VERSION_ID;

/**
* Test type that maps an SQL DATETIME/TIMESTAMP to a Zend_Date object.
Expand All @@ -36,7 +37,7 @@ public static function setUpBeforeClass(): void

public function setUp(): void
{
if (method_exists(ORMSetup::class, 'createDefaultAnnotationDriver')) {
if (PHP_VERSION_ID < 80000) {
$config = new Configuration();
$config->setMetadataDriverImpl(ORMSetup::createDefaultAnnotationDriver([__DIR__ . '/../../Entities']));
} else {
Expand Down

0 comments on commit 437e9b6

Please sign in to comment.