Skip to content

Commit 735b6c5

Browse files
Merge pull request #59 from mpalourdio/opcache.load_comments
opcache.load_comments has been removed from PHP 7
2 parents c8927ad + 0a706d3 commit 735b6c5

File tree

4 files changed

+25
-15
lines changed

4 files changed

+25
-15
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ php:
1111
- 5.4
1212
- 5.5
1313
- 5.6
14+
- 7
1415
- hhvm
1516

1617
before_script:

lib/Doctrine/Common/Annotations/AnnotationReader.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,14 @@ public function __construct()
162162
throw AnnotationException::optimizerPlusSaveComments();
163163
}
164164

165+
if (PHP_VERSION_ID < 70000) {
166+
if (extension_loaded('Zend Optimizer+') && (ini_get('zend_optimizerplus.load_comments') === "0" || ini_get('opcache.load_comments') === "0")) {
167+
throw AnnotationException::optimizerPlusLoadComments();
168+
}
165169

166-
if (extension_loaded('Zend Optimizer+') && (ini_get('zend_optimizerplus.load_comments') === "0" || ini_get('opcache.load_comments') === "0")) {
167-
throw AnnotationException::optimizerPlusLoadComments();
168-
}
169-
170-
if (extension_loaded('Zend OPcache') && ini_get('opcache.load_comments') == 0) {
171-
throw AnnotationException::optimizerPlusLoadComments();
170+
if (extension_loaded('Zend OPcache') && ini_get('opcache.load_comments') == 0) {
171+
throw AnnotationException::optimizerPlusLoadComments();
172+
}
172173
}
173174

174175
AnnotationRegistry::registerFile(__DIR__ . '/Annotation/IgnoreAnnotation.php');

tests/Doctrine/Tests/Common/Annotations/DocParserTest.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,6 +1180,11 @@ public function testCastNegativeFloat()
11801180

11811181
public function testReservedKeywordsInAnnotations()
11821182
{
1183+
if (PHP_VERSION_ID >= 70000) {
1184+
$this->markTestSkipped('This test requires PHP 5.6 or lower.');
1185+
}
1186+
require 'ReservedKeywordsClasses.php';
1187+
11831188
$parser = $this->createTestParser();
11841189

11851190
$result = $parser->parse('@Doctrine\Tests\Common\Annotations\True');
@@ -1356,15 +1361,6 @@ class Marker {
13561361
public $value;
13571362
}
13581363

1359-
/** @Annotation */
1360-
class True {}
1361-
1362-
/** @Annotation */
1363-
class False {}
1364-
1365-
/** @Annotation */
1366-
class Null {}
1367-
13681364
namespace Doctrine\Tests\Common\Annotations\FooBar;
13691365

13701366
/** @Annotation */
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
namespace Doctrine\Tests\Common\Annotations;
4+
5+
/** @Annotation */
6+
class True {}
7+
8+
/** @Annotation */
9+
class False {}
10+
11+
/** @Annotation */
12+
class Null {}

0 commit comments

Comments
 (0)