Skip to content

Commit 7be7b45

Browse files
derrabusgreg0ire
andauthored
Merge 2.3.x into 2.4.x (#242)
* Assert AnnotationDriver works with winding paths This has been broken on the 3.0.x branch. Let us add a test that ensure this cannot be broken. * Whitelist Composer plugins used by this repository (#240) * Bump dev dependencies (#241) Co-authored-by: Grégoire Paris <[email protected]>
2 parents 6459755 + 178b942 commit 7be7b45

File tree

8 files changed

+34
-12
lines changed

8 files changed

+34
-12
lines changed

.github/workflows/coding-standards.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ jobs:
1414
name: "Coding Standards"
1515
uses: "doctrine/.github/.github/workflows/[email protected]"
1616
with:
17-
composer-root-version: "2.2"
18-
php-version: "7.4"
17+
composer-root-version: "2.3"
18+
php-version: "8.1"

.github/workflows/static-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ jobs:
1414
name: "Static Analysis"
1515
uses: "doctrine/.github/.github/workflows/[email protected]"
1616
with:
17-
composer-root-version: "2.2"
18-
php-version: "7.4"
17+
composer-root-version: "2.3"
18+
php-version: "8.1"

composer.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@
2929
},
3030
"require-dev": {
3131
"composer/package-versions-deprecated": "^1.11",
32-
"phpstan/phpstan": "1.2.0",
32+
"phpstan/phpstan": "1.4.6",
3333
"doctrine/annotations": "^1.0",
34-
"doctrine/coding-standard": "^6.0 || ^9.0",
34+
"doctrine/coding-standard": "^9.0",
3535
"doctrine/common": "^3.0",
36-
"phpunit/phpunit": "^7.5.20 || ^8.0 || ^9.0",
37-
"symfony/cache": "^4.4 || ^5.0 || ^6.0",
38-
"vimeo/psalm": "4.20.0"
36+
"phpunit/phpunit": "^7.5.20 || ^8.5 || ^9.5",
37+
"symfony/cache": "^4.4 || ^5.4 || ^6.0",
38+
"vimeo/psalm": "4.21.0"
3939
},
4040
"conflict": {
4141
"doctrine/annotations": "<1.0 || >=2.0",
42-
"doctrine/common": "<2.10@dev"
42+
"doctrine/common": "<2.10"
4343
},
4444
"autoload": {
4545
"psr-4": {
@@ -52,5 +52,10 @@
5252
"Doctrine\\Tests\\": "tests/Doctrine/Tests",
5353
"Doctrine\\Tests_PHP74\\": "tests/Doctrine/Tests_PHP74"
5454
}
55+
},
56+
"config": {
57+
"allow-plugins": {
58+
"dealerdirect/phpcodesniffer-composer-installer": true
59+
}
5560
}
5661
}

lib/Doctrine/Persistence/Mapping/Driver/AnnotationDriver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ public function getAllClassNames()
220220
foreach ($iterator as $file) {
221221
$sourceFile = $file[0];
222222

223-
if (! preg_match('(^phar:)i', $sourceFile)) {
223+
if (preg_match('(^phar:)i', $sourceFile) === 0) {
224224
$sourceFile = realpath($sourceFile);
225225
}
226226

phpcs.xml.dist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
<!-- Ignore warnings and show progress of the run -->
1010
<arg value="nps"/>
1111

12+
<config name="php_version" value="70100"/>
13+
1214
<file>lib</file>
1315
<file>tests</file>
1416

phpstan.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ includes:
33

44
parameters:
55
level: 7
6+
phpVersion: 80100
67

78
paths:
89
- lib

psalm.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0"?>
22
<psalm
33
errorLevel="3"
4+
phpVersion="8.1"
45
findUnusedPsalmSuppress="true"
56
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
67
xmlns="https://getpsalm.org/schema/config"

tests/Doctrine/Tests/Persistence/Mapping/AnnotationDriverTest.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@
77
use Doctrine\Persistence\Mapping\ClassMetadata;
88
use Doctrine\Persistence\Mapping\Driver\AnnotationDriver;
99
use Doctrine\TestClass;
10+
use Generator;
1011
use PHPUnit\Framework\TestCase;
1112

1213
class AnnotationDriverTest extends TestCase
1314
{
14-
public function testGetAllClassNames(): void
15+
/**
16+
* @dataProvider pathProvider
17+
*/
18+
public function testGetAllClassNames(string $path): void
1519
{
1620
$reader = new AnnotationReader();
1721
$driver = new SimpleAnnotationDriver($reader, [__DIR__ . '/_files/annotation']);
@@ -20,6 +24,15 @@ public function testGetAllClassNames(): void
2024

2125
self::assertSame([TestClass::class], $classes);
2226
}
27+
28+
/**
29+
* @return Generator<string, array{string}>
30+
*/
31+
public function pathProvider(): Generator
32+
{
33+
yield 'straigthforward path' => [__DIR__ . '/_files/annotation'];
34+
yield 'winding path' => [__DIR__ . '/../Mapping/_files/annotation'];
35+
}
2336
}
2437

2538
class SimpleAnnotationDriver extends AnnotationDriver

0 commit comments

Comments
 (0)