mirror of
https://github.com/doctrine/DoctrineMongoODMModule.git
synced 2026-03-23 22:32:11 +01:00
upgraded from PHPStan 1.12 to 2.0
This commit is contained in:
@@ -63,12 +63,12 @@
|
||||
"require-dev": {
|
||||
"doctrine/coding-standard": "^12.0.0",
|
||||
"doctrine/persistence": "^2.5.7 || ^3.4.0",
|
||||
"jangregor/phpstan-prophecy": "^1.0.2",
|
||||
"jangregor/phpstan-prophecy": "^2.0.0",
|
||||
"laminas/laminas-developer-tools": "^2.9.0",
|
||||
"laminas/laminas-hydrator": "^4.16.0",
|
||||
"laminas/laminas-session": "^2.22.1",
|
||||
"phpspec/prophecy-phpunit": "^2.3.0",
|
||||
"phpstan/phpstan": "^1.12.13",
|
||||
"phpstan/phpstan": "^2.0.4",
|
||||
"phpunit/phpunit": "^10.5.40"
|
||||
},
|
||||
"suggest": {
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
parameters:
|
||||
level: 6
|
||||
checkGenericClassInNonGenericObjectType: false
|
||||
paths:
|
||||
- src
|
||||
- tests
|
||||
ignoreErrors:
|
||||
- '#Method class@anonymous/tests/Assets/CustomRepositoryFactory.*has parameter.*with no type specified#'
|
||||
-
|
||||
identifier: missingType.generics
|
||||
- '#defaultDocumentRepositoryClassName with type .* is not subtype of native type string#'
|
||||
- '#Method .*Configuration::getDefaultDocumentRepositoryClassName\(\) never returns null#'
|
||||
includes:
|
||||
- vendor/jangregor/phpstan-prophecy/extension.neon
|
||||
|
||||
@@ -27,7 +27,7 @@ final class Configuration extends AbstractOptions
|
||||
/**
|
||||
* Automatic generation of proxies (disable for production!)
|
||||
*
|
||||
* @psalm-var MongoDbConfiguration::AUTOGENERATE_*
|
||||
* @phpstan-var MongoDbConfiguration::AUTOGENERATE_*
|
||||
*/
|
||||
protected int $generateProxies = MongoDbConfiguration::AUTOGENERATE_EVAL;
|
||||
|
||||
@@ -44,7 +44,7 @@ final class Configuration extends AbstractOptions
|
||||
/**
|
||||
* Automatic generation of hydrators (disable for production!)
|
||||
*
|
||||
* @psalm-var MongoDbConfiguration::AUTOGENERATE_*
|
||||
* @phpstan-var MongoDbConfiguration::AUTOGENERATE_*
|
||||
*/
|
||||
protected int $generateHydrators = MongoDbConfiguration::AUTOGENERATE_ALWAYS;
|
||||
|
||||
@@ -61,7 +61,7 @@ final class Configuration extends AbstractOptions
|
||||
/**
|
||||
* Persistent collection generation strategy.
|
||||
*
|
||||
* @psalm-var MongoDbConfiguration::AUTOGENERATE_*
|
||||
* @phpstan-var MongoDbConfiguration::AUTOGENERATE_*
|
||||
*/
|
||||
protected int $generatePersistentCollections = MongoDbConfiguration::AUTOGENERATE_ALWAYS;
|
||||
|
||||
@@ -135,7 +135,7 @@ final class Configuration extends AbstractOptions
|
||||
return 'doctrine.driver.' . $this->driver;
|
||||
}
|
||||
|
||||
/** @psalm-param MongoDbConfiguration::AUTOGENERATE_* $generateProxies */
|
||||
/** @phpstan-param MongoDbConfiguration::AUTOGENERATE_* $generateProxies */
|
||||
public function setGenerateProxies(int $generateProxies): self
|
||||
{
|
||||
$this->generateProxies = $generateProxies;
|
||||
@@ -143,7 +143,7 @@ final class Configuration extends AbstractOptions
|
||||
return $this;
|
||||
}
|
||||
|
||||
/** @psalm-return MongoDbConfiguration::AUTOGENERATE_* */
|
||||
/** @phpstan-return MongoDbConfiguration::AUTOGENERATE_* */
|
||||
public function getGenerateProxies(): int
|
||||
{
|
||||
return $this->generateProxies;
|
||||
@@ -185,13 +185,13 @@ final class Configuration extends AbstractOptions
|
||||
return $this->proxyNamespace;
|
||||
}
|
||||
|
||||
/** @psalm-return MongoDbConfiguration::AUTOGENERATE_* */
|
||||
/** @phpstan-return MongoDbConfiguration::AUTOGENERATE_* */
|
||||
public function getGenerateHydrators(): int
|
||||
{
|
||||
return $this->generateHydrators;
|
||||
}
|
||||
|
||||
/** @psalm-param MongoDbConfiguration::AUTOGENERATE_* $generateHydrators */
|
||||
/** @phpstan-param MongoDbConfiguration::AUTOGENERATE_* $generateHydrators */
|
||||
public function setGenerateHydrators(int $generateHydrators): self
|
||||
{
|
||||
$this->generateHydrators = $generateHydrators;
|
||||
@@ -223,13 +223,13 @@ final class Configuration extends AbstractOptions
|
||||
return $this;
|
||||
}
|
||||
|
||||
/** @psalm-return MongoDbConfiguration::AUTOGENERATE_* */
|
||||
/** @phpstan-return MongoDbConfiguration::AUTOGENERATE_* */
|
||||
public function getGeneratePersistentCollections(): int
|
||||
{
|
||||
return $this->generatePersistentCollections;
|
||||
}
|
||||
|
||||
/** @psalm-param MongoDbConfiguration::AUTOGENERATE_* $generatePersistentCollections */
|
||||
/** @phpstan-param MongoDbConfiguration::AUTOGENERATE_* $generatePersistentCollections */
|
||||
public function setGeneratePersistentCollections(int $generatePersistentCollections): self
|
||||
{
|
||||
$this->generatePersistentCollections = (int) $generatePersistentCollections;
|
||||
@@ -325,7 +325,7 @@ final class Configuration extends AbstractOptions
|
||||
return $this->logger;
|
||||
}
|
||||
|
||||
/** @psalm-return class-string<ClassMetadataFactory>|null */
|
||||
/** @phpstan-return class-string<ClassMetadataFactory>|null */
|
||||
public function getClassMetadataFactoryName(): string|null
|
||||
{
|
||||
return $this->classMetadataFactoryName;
|
||||
@@ -362,7 +362,7 @@ final class Configuration extends AbstractOptions
|
||||
return $this;
|
||||
}
|
||||
|
||||
/** @psalm-return class-string<ObjectRepository<object>> */
|
||||
/** @phpstan-return class-string<ObjectRepository<object>> */
|
||||
public function getDefaultDocumentRepositoryClassName(): string|null
|
||||
{
|
||||
return $this->defaultDocumentRepositoryClassName;
|
||||
|
||||
@@ -31,7 +31,7 @@ class CustomRepositoryFactory implements RepositoryFactory
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @psalm-return mixed[]
|
||||
* @phpstan-return mixed[]
|
||||
*/
|
||||
public function findAll(): array
|
||||
{
|
||||
@@ -41,10 +41,14 @@ class CustomRepositoryFactory implements RepositoryFactory
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @psalm-return mixed[]
|
||||
* @phpstan-return mixed[]
|
||||
*/
|
||||
public function findBy(array $criteria, array|null $orderBy = null, $limit = null, $offset = null): array
|
||||
{
|
||||
public function findBy(
|
||||
array $criteria,
|
||||
array|null $orderBy = null,
|
||||
int|null $limit = null,
|
||||
int|null $offset = null,
|
||||
): array {
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -56,7 +60,7 @@ class CustomRepositoryFactory implements RepositoryFactory
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @psalm-return string */
|
||||
/** @phpstan-return string */
|
||||
public function getClassName(): string
|
||||
{
|
||||
return stdClass::class;
|
||||
|
||||
@@ -20,8 +20,6 @@ use DoctrineMongoODMModuleTest\Assets\CustomRepositoryFactory;
|
||||
use DoctrineMongoODMModuleTest\Assets\CustomType;
|
||||
use Laminas\ServiceManager\ServiceManager;
|
||||
|
||||
use function assert;
|
||||
|
||||
final class ConfigurationFactoryTest extends AbstractTestCase
|
||||
{
|
||||
public function testCreation(): void
|
||||
@@ -97,8 +95,6 @@ final class ConfigurationFactoryTest extends AbstractTestCase
|
||||
$factory = new ConfigurationFactory('odm_test');
|
||||
$config = $factory($serviceLocator, Config::class);
|
||||
|
||||
assert($config instanceof Config);
|
||||
|
||||
$this->assertInstanceOf(Config::class, $config);
|
||||
|
||||
$this->assertEquals(CacheAdapter::wrap($metadataCache), $config->getMetadataCache());
|
||||
|
||||
@@ -8,8 +8,6 @@ use DoctrineMongoODMModuleTest\AbstractTestCase;
|
||||
use DoctrineMongoODMModuleTest\Assets\CustomDocumentRepository;
|
||||
use DoctrineMongoODMModuleTest\Assets\Document\Simple;
|
||||
|
||||
use function assert;
|
||||
|
||||
final class CustomDefaultRepositoryTest extends AbstractTestCase
|
||||
{
|
||||
public function testCustomDefaultRepository(): void
|
||||
@@ -19,7 +17,6 @@ final class CustomDefaultRepositoryTest extends AbstractTestCase
|
||||
$repository = $documentManager->getRepository(Simple::class);
|
||||
|
||||
$this->assertInstanceOf(CustomDocumentRepository::class, $repository);
|
||||
assert($repository instanceof CustomDocumentRepository);
|
||||
$this->assertTrue($repository->isCustomDefaultDocumentRepository());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user