Skip to content

Commit

Permalink
Require PHPStan 1.10
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Jan 14, 2023
1 parent 4534559 commit 1f2a2ab
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 23 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
],
"require": {
"php": "^7.2 || ^8.0",
"phpstan/phpstan": "^1.9.11"
"phpstan/phpstan": "^1.10"
},
"conflict": {
"doctrine/collections": "<1.0",
Expand Down
14 changes: 2 additions & 12 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
parameters:
ignoreErrors:
-
message: "#^Parameter \\#1 \\$entityName of class Doctrine\\\\ORM\\\\Mapping\\\\ClassMetadata constructor expects class\\-string\\<T of object\\>, string given\\.$#"
count: 1
path: src/Doctrine/Mapping/ClassMetadataFactory.php

-
message: "#^Calling PHPStan\\\\Type\\\\ParserNodeTypeToPHPStanType\\:\\:resolve\\(\\) is not covered by backward compatibility promise\\. The method might change in a minor PHPStan version\\.$#"
count: 1
Expand All @@ -26,14 +21,9 @@ parameters:
path: src/Rules/Doctrine/ORM/EntityRelationRule.php

-
message: "#^Calling PHPStan\\\\Analyser\\\\MutatingScope\\:\\:enterNamespace\\(\\) is not covered by backward compatibility promise\\. The method might change in a minor PHPStan version\\.$#"
count: 1
path: src/Type/Doctrine/QueryBuilder/OtherMethodQueryBuilderParser.php

-
message: "#^Call to method getProperty\\(\\) on an unknown class PHPStan\\\\BetterReflection\\\\Reflection\\\\Adapter\\\\ReflectionEnum\\.$#"
message: "#^PHPDoc tag @var with type class\\-string is not subtype of native type 'Doctrine\\\\\\\\Bundle…'\\.$#"
count: 1
path: src/Rules/Gedmo/PropertiesExtension.php
path: src/Stubs/Doctrine/StubFilesExtensionLoader.php

-
message: "#^Accessing PHPStan\\\\Rules\\\\DeadCode\\\\UnusedPrivatePropertyRule\\:\\:class is not covered by backward compatibility promise\\. The class might change in a minor PHPStan version\\.$#"
Expand Down
13 changes: 3 additions & 10 deletions src/Type/Doctrine/ObjectMetadataResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
namespace PHPStan\Type\Doctrine;

use Doctrine\Common\Annotations\AnnotationException;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\MappingException;
use Doctrine\Persistence\Mapping\ClassMetadataFactory;
use Doctrine\Persistence\ObjectManager;
use PHPStan\Doctrine\Mapping\ClassMetadataFactory;
use PHPStan\ShouldNotHappenException;
use ReflectionException;
use function class_exists;
Expand All @@ -24,7 +23,7 @@ final class ObjectMetadataResolver
/** @var ObjectManager|false|null */
private $objectManager;

/** @var ClassMetadataFactory<ClassMetadata<object>>|null */
/** @var ClassMetadataFactory|null */
private $metadataFactory;

public function __construct(
Expand Down Expand Up @@ -88,9 +87,6 @@ public function isTransient(string $className): bool
}
}

/**
* @return ClassMetadataFactory<ClassMetadata<object>>
*/
private function getMetadataFactory(): ?ClassMetadataFactory
{
if ($this->metadataFactory !== null) {
Expand All @@ -101,10 +97,7 @@ private function getMetadataFactory(): ?ClassMetadataFactory
return null;
}

/** @var ClassMetadataFactory<ClassMetadata<object>> $metadataFactory */
$metadataFactory = new \PHPStan\Doctrine\Mapping\ClassMetadataFactory();

return $this->metadataFactory = $metadataFactory;
return $this->metadataFactory = new ClassMetadataFactory();
}

/**
Expand Down

0 comments on commit 1f2a2ab

Please sign in to comment.