mirror of
https://github.com/doctrine/orm.git
synced 2026-03-25 15:32:18 +01:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a588555ecd | ||
|
|
7de84537f6 | ||
|
|
97f8325dad | ||
|
|
0ebd7052d7 | ||
|
|
5d73378b92 | ||
|
|
10572ec441 | ||
|
|
76278d801d | ||
|
|
ca80830b26 | ||
|
|
bcb4889a2c | ||
|
|
961da8b0cc |
23
.github/workflows/static-analysis.yml
vendored
23
.github/workflows/static-analysis.yml
vendored
@@ -1,12 +1,18 @@
|
||||
name: Static Analysis
|
||||
|
||||
name: "Static Analysis"
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- "*.x"
|
||||
push:
|
||||
branches:
|
||||
- "*.x"
|
||||
|
||||
jobs:
|
||||
static-analysis-phpstan:
|
||||
name: "PHPStan"
|
||||
runs-on: "ubuntu-latest"
|
||||
name: "Static Analysis with PHPStan"
|
||||
runs-on: "ubuntu-20.04"
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
@@ -22,17 +28,18 @@ jobs:
|
||||
with:
|
||||
coverage: "none"
|
||||
php-version: "${{ matrix.php-version }}"
|
||||
tools: cs2pr
|
||||
|
||||
- name: "Install dependencies with Composer"
|
||||
uses: "ramsey/composer-install@v1"
|
||||
with:
|
||||
dependency-versions: "highest"
|
||||
|
||||
- name: "Run a static analysis with phpstan/phpstan"
|
||||
run: "php vendor/bin/phpstan analyse --error-format=checkstyle | cs2pr"
|
||||
run: "vendor/bin/phpstan analyse"
|
||||
|
||||
static-analysis-psalm:
|
||||
name: "Psalm"
|
||||
runs-on: "ubuntu-latest"
|
||||
name: "Static Analysis with Psalm"
|
||||
runs-on: "ubuntu-20.04"
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
@@ -51,6 +58,8 @@ jobs:
|
||||
|
||||
- name: "Install dependencies with Composer"
|
||||
uses: "ramsey/composer-install@v1"
|
||||
with:
|
||||
dependency-versions: "highest"
|
||||
|
||||
- name: "Run a static analysis with vimeo/psalm"
|
||||
run: "vendor/bin/psalm --show-info=false --stats --output-format=github --threads=$(nproc)"
|
||||
|
||||
@@ -185,7 +185,7 @@ class EntityRepository implements ObjectRepository, Selectable
|
||||
* @param int|null $offset
|
||||
*
|
||||
* @psalm-param array<string, mixed> $criteria
|
||||
* @psalm-param list<string>|null $orderBy
|
||||
* @psalm-param array<string, string>|null $orderBy
|
||||
* @psalm-return list<T> The objects.
|
||||
*/
|
||||
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null)
|
||||
|
||||
@@ -748,7 +748,7 @@ class ClassMetadataInfo implements ClassMetadata
|
||||
*
|
||||
* @param object $entity
|
||||
*
|
||||
* @return array<string|int, mixed>
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function getIdentifierValues($entity)
|
||||
{
|
||||
|
||||
@@ -273,8 +273,8 @@ interface EntityPersister
|
||||
* @param int|null $limit
|
||||
* @param int|null $offset
|
||||
*
|
||||
* @psalm-param list<string>|null $orderBy
|
||||
* @psalm-param array<string, mixed> $criteria
|
||||
* @psalm-param array<string, string>|null $orderBy
|
||||
* @psalm-param array<string, mixed> $criteria
|
||||
*/
|
||||
public function loadAll(array $criteria = [], ?array $orderBy = null, $limit = null, $offset = null);
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ class Composite extends Base
|
||||
}
|
||||
|
||||
// Fixes DDC-1237: User may have added a where item containing nested expression (with "OR" or "AND")
|
||||
if (preg_match('/\s(OR|AND)\s/', $queryPart)) {
|
||||
if (preg_match('/\s(OR|AND)\s/i', $queryPart)) {
|
||||
return $this->preSeparator . $queryPart . $this->postSeparator;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\PersistentCollection;
|
||||
use Doctrine\Tests\IterableTester;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
use Exception;
|
||||
|
||||
use function assert;
|
||||
use function count;
|
||||
@@ -23,19 +22,25 @@ class AdvancedAssociationTest extends OrmFunctionalTestCase
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
try {
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(Phrase::class),
|
||||
$this->_em->getClassMetadata(PhraseType::class),
|
||||
$this->_em->getClassMetadata(Definition::class),
|
||||
$this->_em->getClassMetadata(Lemma::class),
|
||||
$this->_em->getClassMetadata(Type::class),
|
||||
]
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
// Swallow all exceptions. We do not test the schema tool here.
|
||||
}
|
||||
$this->_schemaTool->createSchema([
|
||||
$this->_em->getClassMetadata(Phrase::class),
|
||||
$this->_em->getClassMetadata(PhraseType::class),
|
||||
$this->_em->getClassMetadata(Definition::class),
|
||||
$this->_em->getClassMetadata(Lemma::class),
|
||||
$this->_em->getClassMetadata(Type::class),
|
||||
]);
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
$this->_schemaTool->dropSchema([
|
||||
$this->_em->getClassMetadata(Phrase::class),
|
||||
$this->_em->getClassMetadata(PhraseType::class),
|
||||
$this->_em->getClassMetadata(Definition::class),
|
||||
$this->_em->getClassMetadata(Lemma::class),
|
||||
$this->_em->getClassMetadata(Type::class),
|
||||
]);
|
||||
}
|
||||
|
||||
public function testIssue(): void
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Doctrine\Tests\ORM\Functional;
|
||||
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
|
||||
class QueryBuilderParenthesis extends OrmFunctionalTestCase
|
||||
class QueryBuilderParenthesisTest extends OrmFunctionalTestCase
|
||||
{
|
||||
protected function setUp(): void
|
||||
{
|
||||
@@ -36,6 +36,7 @@ class QueryBuilderParenthesis extends OrmFunctionalTestCase
|
||||
$queryBuilder->select('o')->from(QueryBuilderParenthesisEntity::class, 'o');
|
||||
$queryBuilder->andWhere('o.property3 = :value3')->setParameter('value3', 'x');
|
||||
$queryBuilder->andWhere('o.property1 = :value1 OR o.property2 = :value2');
|
||||
$queryBuilder->andWhere('o.property1 = :value1 or o.property2 = :value2');
|
||||
$queryBuilder->setParameter('value1', 'x');
|
||||
$queryBuilder->setParameter('value2', 'x');
|
||||
|
||||
@@ -46,7 +47,7 @@ class QueryBuilderParenthesis extends OrmFunctionalTestCase
|
||||
$dql = $query->getDQL();
|
||||
|
||||
$this->assertSame(
|
||||
'SELECT o FROM ' . QueryBuilderParenthesisEntity::class . ' o WHERE o.property3 = :value3 AND (o.property1 = :value1 OR o.property2 = :value2)',
|
||||
'SELECT o FROM ' . QueryBuilderParenthesisEntity::class . ' o WHERE o.property3 = :value3 AND (o.property1 = :value1 OR o.property2 = :value2) AND (o.property1 = :value1 or o.property2 = :value2)',
|
||||
$dql
|
||||
);
|
||||
}
|
||||
@@ -5,30 +5,34 @@ declare(strict_types=1);
|
||||
namespace Doctrine\Tests\ORM\Functional\Ticket;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\Tests\OrmFunctionalTestCase;
|
||||
use Exception;
|
||||
|
||||
use function assert;
|
||||
|
||||
/**
|
||||
* Functional tests for the Single Table Inheritance mapping strategy.
|
||||
*/
|
||||
class AdvancedAssociationTest extends OrmFunctionalTestCase
|
||||
class DDC69Test extends OrmFunctionalTestCase
|
||||
{
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
try {
|
||||
$this->_schemaTool->createSchema(
|
||||
[
|
||||
$this->_em->getClassMetadata(Lemma::class),
|
||||
$this->_em->getClassMetadata(Relation::class),
|
||||
$this->_em->getClassMetadata(RelationType::class),
|
||||
]
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
// Swallow all exceptions. We do not test the schema tool here.
|
||||
}
|
||||
$this->_schemaTool->createSchema([
|
||||
$this->_em->getClassMetadata(Lemma::class),
|
||||
$this->_em->getClassMetadata(Relation::class),
|
||||
$this->_em->getClassMetadata(RelationType::class),
|
||||
]);
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
$this->_schemaTool->dropSchema([
|
||||
$this->_em->getClassMetadata(Lemma::class),
|
||||
$this->_em->getClassMetadata(Relation::class),
|
||||
$this->_em->getClassMetadata(RelationType::class),
|
||||
]);
|
||||
}
|
||||
|
||||
public function testIssue(): void
|
||||
@@ -124,9 +128,8 @@ class Lemma
|
||||
*/
|
||||
private $lemma;
|
||||
|
||||
|
||||
/**
|
||||
* @var kateglo\application\utilities\collections\ArrayCollection
|
||||
* @var Collection<int, Relation>
|
||||
* @OneToMany(targetEntity="Relation", mappedBy="parent", cascade={"persist"})
|
||||
*/
|
||||
private $relations;
|
||||
@@ -167,7 +170,10 @@ class Lemma
|
||||
}
|
||||
}
|
||||
|
||||
public function getRelations(): kateglo\application\utilities\collections\ArrayCollection
|
||||
/**
|
||||
* @psalm-return Collection<int, Relation>
|
||||
*/
|
||||
public function getRelations(): Collection
|
||||
{
|
||||
return $this->relations;
|
||||
}
|
||||
@@ -288,7 +294,7 @@ class RelationType
|
||||
private $abbreviation;
|
||||
|
||||
/**
|
||||
* @var kateglo\application\utilities\collections\ArrayCollection
|
||||
* @var Collection<int, Relation>
|
||||
* @OneToMany(targetEntity="Relation", mappedBy="type", cascade={"persist"})
|
||||
*/
|
||||
private $relations;
|
||||
@@ -338,7 +344,10 @@ class RelationType
|
||||
}
|
||||
}
|
||||
|
||||
public function getRelations(): kateglo\application\utilities\collections\ArrayCollection
|
||||
/**
|
||||
* @psalm-return Collection<int, Relation>
|
||||
*/
|
||||
public function getRelations(): Collection
|
||||
{
|
||||
return $this->relations;
|
||||
}
|
||||
Reference in New Issue
Block a user