Skip to content

Commit 9f40e7f

Browse files
ruudkondrejmirtes
authored andcommitted
Use different data fixture for entityRepositoryDynamicReturn test on PHP 7.1
1 parent f3fba3b commit 9f40e7f

11 files changed

+427
-1
lines changed

phpstan.neon

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ includes:
99
parameters:
1010
excludePaths:
1111
- tests/*/data/*
12+
- tests/*/data-php-*/*
1213

1314
ignoreErrors:
1415
-

tests/DoctrineIntegration/ORM/EntityManagerIntegrationTest.php

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ public function dataTopics(): array
1414
{
1515
return [
1616
['entityManagerDynamicReturn'],
17-
['entityRepositoryDynamicReturn'],
1817
['entityManagerMergeReturn'],
1918
['customRepositoryUsage'],
2019
['queryBuilder'],
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace PHPStan\DoctrineIntegration\ORM;
4+
5+
use PHPStan\Testing\LevelsTestCase;
6+
7+
final class EntityRepositoryDynamicReturnIntegrationTest extends LevelsTestCase
8+
{
9+
10+
/**
11+
* @return string[][]
12+
*/
13+
public function dataTopics(): array
14+
{
15+
return [
16+
['entityRepositoryDynamicReturn'],
17+
];
18+
}
19+
20+
public function getDataPath(): string
21+
{
22+
if (PHP_MAJOR_VERSION === 7 && PHP_MINOR_VERSION === 1) {
23+
return __DIR__ . '/data-php-7.1';
24+
}
25+
26+
return __DIR__ . '/data';
27+
}
28+
29+
public function getPhpStanExecutablePath(): string
30+
{
31+
return __DIR__ . '/../../../vendor/phpstan/phpstan/phpstan';
32+
}
33+
34+
public function getPhpStanConfigPath(): string
35+
{
36+
return __DIR__ . '/phpstan.neon';
37+
}
38+
39+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[
2+
{
3+
"message": "Call to method Doctrine\\ORM\\EntityRepository<PHPStan\\DoctrineIntegration\\ORM\\EntityRepositoryDynamicReturn\\MyEntity>::findOneBy() - entity PHPStan\\DoctrineIntegration\\ORM\\EntityRepositoryDynamicReturn\\MyEntity does not have a field named $blah.",
4+
"line": 94,
5+
"ignorable": true
6+
},
7+
{
8+
"message": "Call to method Doctrine\\ORM\\EntityRepository<PHPStan\\DoctrineIntegration\\ORM\\EntityRepositoryDynamicReturn\\MyEntity>::findBy() - entity PHPStan\\DoctrineIntegration\\ORM\\EntityRepositoryDynamicReturn\\MyEntity does not have a field named $blah.",
9+
"line": 116,
10+
"ignorable": true
11+
},
12+
{
13+
"message": "Method Doctrine\\ORM\\EntityRepository<object>::createQueryBuilder() invoked with 0 parameters, 1-2 required.",
14+
"line": 239,
15+
"ignorable": true
16+
},
17+
{
18+
"message": "Could not analyse QueryBuilder with unknown beginning.",
19+
"line": 241,
20+
"ignorable": true
21+
}
22+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
[
2+
{
3+
"message": "Call to an undefined method PHPStan\\DoctrineIntegration\\ORM\\EntityRepositoryDynamicReturn\\MyEntity::doSomethingElse().",
4+
"line": 89,
5+
"ignorable": true
6+
},
7+
{
8+
"message": "Call to an undefined method PHPStan\\DoctrineIntegration\\ORM\\EntityRepositoryDynamicReturn\\MyEntity::doSomethingElse().",
9+
"line": 101,
10+
"ignorable": true
11+
},
12+
{
13+
"message": "Call to an undefined method PHPStan\\DoctrineIntegration\\ORM\\EntityRepositoryDynamicReturn\\MyEntity::doSomethingElse().",
14+
"line": 110,
15+
"ignorable": true
16+
},
17+
{
18+
"message": "Call to an undefined method PHPStan\\DoctrineIntegration\\ORM\\EntityRepositoryDynamicReturn\\MyEntity::doSomethingElse().",
19+
"line": 120,
20+
"ignorable": true
21+
},
22+
{
23+
"message": "Call to an undefined method PHPStan\\DoctrineIntegration\\ORM\\EntityRepositoryDynamicReturn\\MyEntity::doSomethingElse().",
24+
"line": 142,
25+
"ignorable": true
26+
},
27+
{
28+
"message": "Call to an undefined method Doctrine\\ORM\\EntityRepository<PHPStan\\DoctrineIntegration\\ORM\\EntityRepositoryDynamicReturn\\MyEntity>::findByNonexistent().",
29+
"line": 148,
30+
"ignorable": true
31+
},
32+
{
33+
"message": "Call to an undefined method PHPStan\\DoctrineIntegration\\ORM\\EntityRepositoryDynamicReturn\\MyEntity::doSomethingElse().",
34+
"line": 160,
35+
"ignorable": true
36+
},
37+
{
38+
"message": "Call to an undefined method Doctrine\\ORM\\EntityRepository<PHPStan\\DoctrineIntegration\\ORM\\EntityRepositoryDynamicReturn\\MyEntity>::findOneByNonexistent().",
39+
"line": 165,
40+
"ignorable": true
41+
},
42+
{
43+
"message": "Call to an undefined method Doctrine\\ORM\\EntityRepository<PHPStan\\DoctrineIntegration\\ORM\\EntityRepositoryDynamicReturn\\MyEntity>::countByNonexistent().",
44+
"line": 174,
45+
"ignorable": true
46+
}
47+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[
2+
{
3+
"message": "Strict comparison using === between int and 'foo' will always evaluate to false.",
4+
"line": 171,
5+
"ignorable": true
6+
}
7+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[
2+
{
3+
"message": "Parameter #1 $className of method Doctrine\\Persistence\\ObjectManager::getRepository() expects class-string<nonexistentClass>, string given.",
4+
"line": 212,
5+
"ignorable": true
6+
}
7+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[
2+
{
3+
"message": "Property PHPStan\\DoctrineIntegration\\ORM\\EntityRepositoryDynamicReturn\\Example::$repository with generic class Doctrine\\ORM\\EntityRepository does not specify its types: TEntityClass",
4+
"line": 16,
5+
"ignorable": true
6+
},
7+
{
8+
"message": "Class PHPStan\\DoctrineIntegration\\ORM\\EntityRepositoryDynamicReturn\\Bug180Repository extends generic class Doctrine\\ORM\\EntityRepository but does not specify its types: TEntityClass",
9+
"line": 232,
10+
"ignorable": true
11+
}
12+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
[
2+
{
3+
"message": "Call to an undefined method object::doSomething().",
4+
"line": 31,
5+
"ignorable": true
6+
},
7+
{
8+
"message": "Call to an undefined method object::doSomethingElse().",
9+
"line": 32,
10+
"ignorable": true
11+
},
12+
{
13+
"message": "Call to an undefined method object::doSomething().",
14+
"line": 43,
15+
"ignorable": true
16+
},
17+
{
18+
"message": "Call to an undefined method object::doSomethingElse().",
19+
"line": 44,
20+
"ignorable": true
21+
},
22+
{
23+
"message": "Call to an undefined method object::doSomething().",
24+
"line": 52,
25+
"ignorable": true
26+
},
27+
{
28+
"message": "Call to an undefined method object::doSomethingElse().",
29+
"line": 53,
30+
"ignorable": true
31+
},
32+
{
33+
"message": "Call to an undefined method object::doSomething().",
34+
"line": 62,
35+
"ignorable": true
36+
},
37+
{
38+
"message": "Call to an undefined method object::doSomethingElse().",
39+
"line": 63,
40+
"ignorable": true
41+
}
42+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[
2+
{
3+
"message": "Cannot cast mixed to int.",
4+
"line": 241,
5+
"ignorable": true
6+
}
7+
]

0 commit comments

Comments
 (0)