diff --git a/.gitignore b/.gitignore
index b9c41bf..29e58dc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,4 +3,5 @@ vendor/
.idea/
phpunit.xml
phpcs.xml
+.phpcs-cache
build
diff --git a/.travis.yml b/.travis.yml
index cb2e99c..135b084 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -77,7 +77,7 @@ script:
- docker vendor/bin/doctrine-module odm:schema:create
- docker vendor/bin/doctrine-module odm:schema:drop
- if [[ $TEST_COVERAGE == 'true' ]]; then php vendor/bin/phpunit --coverage-clover build/logs/clover.xml ; else php vendor/bin/phpunit ; fi
- - if [[ $CS_CHECK == 'true' ]]; then php vendor/bin/phpcs --standard=PSR2 ./src/ ./tests/ ./config/ ; fi
+ - if [[ $CS_CHECK == 'true' ]]; then php vendor/bin/phpcs ; fi
after_script:
- if [[ $TEST_COVERAGE == 'true' ]]; then php vendor/bin/php-coveralls -v ; fi
diff --git a/composer.json b/composer.json
index 2de3ccd..3a7928d 100644
--- a/composer.json
+++ b/composer.json
@@ -62,6 +62,7 @@
"symfony/var-dumper": "^5.1"
},
"require-dev": {
+ "doctrine/coding-standard": "^8.2",
"laminas/laminas-console": "^2.8",
"laminas/laminas-developer-tools": "^2.0",
"laminas/laminas-i18n": "^2.10.1",
@@ -71,8 +72,7 @@
"laminas/laminas-serializer": "^2.9.1",
"laminas/laminas-session": "^2.9.1",
"laminas/laminas-view": "^2.11.4",
- "phpunit/phpunit": "^8.5.2",
- "squizlabs/php_codesniffer": "^3.5"
+ "phpunit/phpunit": "^8.5.2"
},
"autoload": {
"psr-4": {
diff --git a/composer.lock b/composer.lock
index 8205f54..1e03e8c 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "e1df0b3eca795f4acdcd082c1707bb81",
+ "content-hash": "4f8ce788fad268ea13f270cdce99cd99",
"packages": [
{
"name": "composer/package-versions-deprecated",
@@ -3840,6 +3840,123 @@
}
],
"packages-dev": [
+ {
+ "name": "dealerdirect/phpcodesniffer-composer-installer",
+ "version": "v0.7.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git",
+ "reference": "e8d808670b8f882188368faaf1144448c169c0b7"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/e8d808670b8f882188368faaf1144448c169c0b7",
+ "reference": "e8d808670b8f882188368faaf1144448c169c0b7",
+ "shasum": ""
+ },
+ "require": {
+ "composer-plugin-api": "^1.0 || ^2.0",
+ "php": ">=5.3",
+ "squizlabs/php_codesniffer": "^2 || ^3 || 4.0.x-dev"
+ },
+ "require-dev": {
+ "composer/composer": "*",
+ "phpcompatibility/php-compatibility": "^9.0",
+ "sensiolabs/security-checker": "^4.1.0"
+ },
+ "type": "composer-plugin",
+ "extra": {
+ "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin"
+ },
+ "autoload": {
+ "psr-4": {
+ "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Franck Nijhof",
+ "email": "franck.nijhof@dealerdirect.com",
+ "homepage": "http://www.frenck.nl",
+ "role": "Developer / IT Manager"
+ }
+ ],
+ "description": "PHP_CodeSniffer Standards Composer Installer Plugin",
+ "homepage": "http://www.dealerdirect.com",
+ "keywords": [
+ "PHPCodeSniffer",
+ "PHP_CodeSniffer",
+ "code quality",
+ "codesniffer",
+ "composer",
+ "installer",
+ "phpcs",
+ "plugin",
+ "qa",
+ "quality",
+ "standard",
+ "standards",
+ "style guide",
+ "stylecheck",
+ "tests"
+ ],
+ "time": "2020-06-25T14:57:39+00:00"
+ },
+ {
+ "name": "doctrine/coding-standard",
+ "version": "8.2.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/doctrine/coding-standard.git",
+ "reference": "529d385bb3790431080493c0fe7adaec39df368a"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/doctrine/coding-standard/zipball/529d385bb3790431080493c0fe7adaec39df368a",
+ "reference": "529d385bb3790431080493c0fe7adaec39df368a",
+ "shasum": ""
+ },
+ "require": {
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7",
+ "php": "^7.1 || ^8.0",
+ "slevomat/coding-standard": "^6.3.9",
+ "squizlabs/php_codesniffer": "^3.5.5"
+ },
+ "type": "phpcodesniffer-standard",
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Benjamin Eberlei",
+ "email": "kontakt@beberlei.de"
+ },
+ {
+ "name": "Steve Müller",
+ "email": "st.mueller@dzh-online.de"
+ }
+ ],
+ "description": "The Doctrine Coding Standard is a set of PHPCS rules applied to all Doctrine projects.",
+ "homepage": "https://www.doctrine-project.org/projects/coding-standard.html",
+ "keywords": [
+ "checks",
+ "code",
+ "coding",
+ "cs",
+ "doctrine",
+ "rules",
+ "sniffer",
+ "sniffs",
+ "standard",
+ "style"
+ ],
+ "time": "2020-10-25T14:56:19+00:00"
+ },
{
"name": "laminas/laminas-console",
"version": "2.8.0",
@@ -4735,6 +4852,55 @@
],
"time": "2020-09-29T09:10:42+00:00"
},
+ {
+ "name": "phpstan/phpdoc-parser",
+ "version": "0.4.9",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phpstan/phpdoc-parser.git",
+ "reference": "98a088b17966bdf6ee25c8a4b634df313d8aa531"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/98a088b17966bdf6ee25c8a4b634df313d8aa531",
+ "reference": "98a088b17966bdf6ee25c8a4b634df313d8aa531",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.1 || ^8.0"
+ },
+ "require-dev": {
+ "consistence/coding-standard": "^3.5",
+ "ergebnis/composer-normalize": "^2.0.2",
+ "jakub-onderka/php-parallel-lint": "^0.9.2",
+ "phing/phing": "^2.16.0",
+ "phpstan/extension-installer": "^1.0",
+ "phpstan/phpstan": "^0.12.26",
+ "phpstan/phpstan-strict-rules": "^0.12",
+ "phpunit/phpunit": "^6.3",
+ "slevomat/coding-standard": "^4.7.2",
+ "symfony/process": "^4.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "0.4-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "PHPStan\\PhpDocParser\\": [
+ "src/"
+ ]
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "description": "PHPDoc parser with support for nullable, intersection and generic types",
+ "time": "2020-08-03T20:32:43+00:00"
+ },
{
"name": "phpunit/php-code-coverage",
"version": "7.0.10",
@@ -5743,6 +5909,63 @@
"homepage": "https://github.com/sebastianbergmann/version",
"time": "2016-10-03T07:35:21+00:00"
},
+ {
+ "name": "slevomat/coding-standard",
+ "version": "6.4.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/slevomat/coding-standard.git",
+ "reference": "696dcca217d0c9da2c40d02731526c1e25b65346"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/696dcca217d0c9da2c40d02731526c1e25b65346",
+ "reference": "696dcca217d0c9da2c40d02731526c1e25b65346",
+ "shasum": ""
+ },
+ "require": {
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7",
+ "php": "^7.1 || ^8.0",
+ "phpstan/phpdoc-parser": "0.4.5 - 0.4.9",
+ "squizlabs/php_codesniffer": "^3.5.6"
+ },
+ "require-dev": {
+ "phing/phing": "2.16.3",
+ "php-parallel-lint/php-parallel-lint": "1.2.0",
+ "phpstan/phpstan": "0.12.48",
+ "phpstan/phpstan-deprecation-rules": "0.12.5",
+ "phpstan/phpstan-phpunit": "0.12.16",
+ "phpstan/phpstan-strict-rules": "0.12.5",
+ "phpunit/phpunit": "7.5.20|8.5.5|9.4.0"
+ },
+ "type": "phpcodesniffer-standard",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "6.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "SlevomatCodingStandard\\": "SlevomatCodingStandard"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "description": "Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.",
+ "funding": [
+ {
+ "url": "https://github.com/kukulich",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/slevomat/coding-standard",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2020-10-05T12:39:37+00:00"
+ },
{
"name": "squizlabs/php_codesniffer",
"version": "3.5.8",
diff --git a/phpcs.xml.dist b/phpcs.xml.dist
index eb4b60a..d95d81e 100644
--- a/phpcs.xml.dist
+++ b/phpcs.xml.dist
@@ -4,25 +4,16 @@
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
config
src
tests
-
\ No newline at end of file
+
diff --git a/src/DoctrineMongoODMModule/Collector/MongoLoggerCollector.php b/src/DoctrineMongoODMModule/Collector/MongoLoggerCollector.php
index ca83691..abe4753 100644
--- a/src/DoctrineMongoODMModule/Collector/MongoLoggerCollector.php
+++ b/src/DoctrineMongoODMModule/Collector/MongoLoggerCollector.php
@@ -8,6 +8,7 @@
use Laminas\DeveloperTools\Collector\AutoHideInterface;
use Laminas\DeveloperTools\Collector\CollectorInterface;
use Laminas\Mvc\MvcEvent;
+
use function count;
/**
@@ -66,7 +67,7 @@ public function canHide()
return empty($this->mongoLogger->queries);
}
- public function getQueryCount() : int
+ public function getQueryCount(): int
{
return count($this->mongoLogger->queries);
}
@@ -74,12 +75,12 @@ public function getQueryCount() : int
/**
* @return mixed[]
*/
- public function getQueries() : array
+ public function getQueries(): array
{
return $this->mongoLogger->queries;
}
- public function getQueryTime() : float
+ public function getQueryTime(): float
{
return 0.0;
}
diff --git a/src/DoctrineMongoODMModule/Logging/DebugStack.php b/src/DoctrineMongoODMModule/Logging/DebugStack.php
index 6474f20..16f90e0 100644
--- a/src/DoctrineMongoODMModule/Logging/DebugStack.php
+++ b/src/DoctrineMongoODMModule/Logging/DebugStack.php
@@ -8,6 +8,7 @@
use MongoDB\Driver\Monitoring\CommandFailedEvent;
use MongoDB\Driver\Monitoring\CommandStartedEvent;
use MongoDB\Driver\Monitoring\CommandSucceededEvent;
+
use function MongoDB\Driver\Monitoring\addSubscriber;
use function MongoDB\Driver\Monitoring\removeSubscriber;
diff --git a/src/DoctrineMongoODMModule/Logging/EchoLogger.php b/src/DoctrineMongoODMModule/Logging/EchoLogger.php
index f5e6529..386e3e2 100644
--- a/src/DoctrineMongoODMModule/Logging/EchoLogger.php
+++ b/src/DoctrineMongoODMModule/Logging/EchoLogger.php
@@ -12,6 +12,7 @@
use function MongoDB\Driver\Monitoring\addSubscriber;
use function MongoDB\Driver\Monitoring\removeSubscriber;
+use function sprintf;
/**
* A logger that logs to the standard output using echo/var_dump.
@@ -25,22 +26,22 @@ public function __construct()
$this->register();
}
- public function register() : void
+ public function register(): void
{
addSubscriber($this);
}
- public function unregister() : void
+ public function unregister(): void
{
removeSubscriber($this);
}
- public function commandFailed(CommandFailedEvent $event)
+ public function commandFailed(CommandFailedEvent $event): void
{
echo $event->getError()->getTraceAsString();
}
- public function commandStarted(CommandStartedEvent $event)
+ public function commandStarted(CommandStartedEvent $event): void
{
VarDumper::dump(
[
@@ -50,7 +51,7 @@ public function commandStarted(CommandStartedEvent $event)
);
}
- public function commandSucceeded(CommandSucceededEvent $event)
+ public function commandSucceeded(CommandSucceededEvent $event): void
{
echo sprintf("%s\n%s", $event->getRequestId(), $event->getCommandName());
}
diff --git a/src/DoctrineMongoODMModule/Module.php b/src/DoctrineMongoODMModule/Module.php
index c9d2c21..8e544b8 100644
--- a/src/DoctrineMongoODMModule/Module.php
+++ b/src/DoctrineMongoODMModule/Module.php
@@ -21,17 +21,17 @@
*/
class Module
{
- public function init(ModuleManagerInterface $manager) : void
+ public function init(ModuleManagerInterface $manager): void
{
$events = $manager->getEventManager();
// Initialize logger collector once the profiler is initialized itself
- $events->attach('profiler_init', static function (EventInterface $e) use ($manager) : void {
+ $events->attach('profiler_init', static function (EventInterface $e) use ($manager): void {
$manager->getEvent()->getParam('ServiceManager')->get('doctrine.mongo_logger_collector.odm_default');
});
$events->getSharedManager()->attach('doctrine', 'loadCli.post', [$this, 'loadCli']);
}
- public function loadCli(EventInterface $event) : void
+ public function loadCli(EventInterface $event): void
{
$commands = [
new Command\QueryCommand(),
@@ -70,7 +70,7 @@ public function loadCli(EventInterface $event) : void
/**
* {@inheritDoc}
*/
- public function getConfig() : array
+ public function getConfig(): array
{
return include __DIR__ . '/../../config/module.config.php';
}
@@ -78,7 +78,7 @@ public function getConfig() : array
/**
* {@inheritDoc}
*/
- public function getServiceConfig() : array
+ public function getServiceConfig(): array
{
return [
'invokables' => [
diff --git a/src/DoctrineMongoODMModule/Options/Configuration.php b/src/DoctrineMongoODMModule/Options/Configuration.php
index 7f220a2..5c4f4ef 100644
--- a/src/DoctrineMongoODMModule/Options/Configuration.php
+++ b/src/DoctrineMongoODMModule/Options/Configuration.php
@@ -149,7 +149,7 @@ public function setDriver(string $driver)
return $this;
}
- public function getDriver() : string
+ public function getDriver(): string
{
return 'doctrine.driver.' . $this->driver;
}
@@ -164,7 +164,7 @@ public function setGenerateProxies(int $generateProxies)
return $this;
}
- public function getGenerateProxies() : int
+ public function getGenerateProxies(): int
{
return $this->generateProxies;
}
@@ -179,7 +179,7 @@ public function setMetadataCache(string $metadataCache)
return $this;
}
- public function getMetadataCache() : string
+ public function getMetadataCache(): string
{
return 'doctrine.cache.' . $this->metadataCache;
}
@@ -194,7 +194,7 @@ public function setProxyDir(string $proxyDir)
return $this;
}
- public function getProxyDir() : string
+ public function getProxyDir(): string
{
return $this->proxyDir;
}
@@ -209,24 +209,24 @@ public function setProxyNamespace(string $proxyNamespace)
return $this;
}
- public function getProxyNamespace() : string
+ public function getProxyNamespace(): string
{
return $this->proxyNamespace;
}
- public function getGenerateHydrators() : int
+ public function getGenerateHydrators(): int
{
return $this->generateHydrators;
}
- public function setGenerateHydrators(int $generateHydrators) : Configuration
+ public function setGenerateHydrators(int $generateHydrators): Configuration
{
$this->generateHydrators = $generateHydrators;
return $this;
}
- public function getHydratorDir() : string
+ public function getHydratorDir(): string
{
return $this->hydratorDir;
}
@@ -241,7 +241,7 @@ public function setHydratorDir(string $hydratorDir)
return $this;
}
- public function getHydratorNamespace() : string
+ public function getHydratorNamespace(): string
{
return $this->hydratorNamespace;
}
@@ -256,7 +256,7 @@ public function setHydratorNamespace(string $hydratorNamespace)
return $this;
}
- public function getGeneratePersistentCollections() : int
+ public function getGeneratePersistentCollections(): int
{
return $this->generatePersistentCollections;
}
@@ -271,7 +271,7 @@ public function setGeneratePersistentCollections(int $generatePersistentCollecti
return $this;
}
- public function getPersistentCollectionDir() : string
+ public function getPersistentCollectionDir(): string
{
return $this->persistentCollectionDir;
}
@@ -286,7 +286,7 @@ public function setPersistentCollectionDir(string $persistentCollectionDir)
return $this;
}
- public function getPersistentCollectionNamespace() : string
+ public function getPersistentCollectionNamespace(): string
{
return $this->persistentCollectionNamespace;
}
@@ -301,7 +301,7 @@ public function setPersistentCollectionNamespace(string $persistentCollectionNam
return $this;
}
- public function getPersistentCollectionFactory() : ?string
+ public function getPersistentCollectionFactory(): ?string
{
return $this->persistentCollectionFactory;
}
@@ -318,7 +318,7 @@ public function setPersistentCollectionFactory($persistentCollectionFactory)
return $this;
}
- public function getPersistentCollectionGenerator() : ?string
+ public function getPersistentCollectionGenerator(): ?string
{
return $this->persistentCollectionGenerator;
}
@@ -333,7 +333,7 @@ public function setPersistentCollectionGenerator(?string $persistentCollectionGe
return $this;
}
- public function getDefaultDb() : ?string
+ public function getDefaultDb(): ?string
{
return $this->defaultDb;
}
@@ -355,7 +355,7 @@ public function setDefaultDb(?string $defaultDb)
/**
* @return mixed[]
*/
- public function getFilters() : array
+ public function getFilters(): array
{
return $this->filters;
}
@@ -372,30 +372,24 @@ public function setFilters(array $filters)
return $this;
}
- /**
- * @param string|null $logger
- */
- public function setLogger($logger) : self
+ public function setLogger(?string $logger): self
{
$this->logger = $logger;
return $this;
}
- /**
- * @return string|null
- */
- public function getLogger()
+ public function getLogger(): ?string
{
return $this->logger;
}
- public function getClassMetadataFactoryName() : ?string
+ public function getClassMetadataFactoryName(): ?string
{
return $this->classMetadataFactoryName;
}
- public function setClassMetadataFactoryName(?string $classMetadataFactoryName) : void
+ public function setClassMetadataFactoryName(?string $classMetadataFactoryName): void
{
$this->classMetadataFactoryName = (string) $classMetadataFactoryName;
}
@@ -403,7 +397,7 @@ public function setClassMetadataFactoryName(?string $classMetadataFactoryName) :
/**
* @param mixed[] $types
*/
- public function setTypes(array $types) : void
+ public function setTypes(array $types): void
{
$this->types = $types;
}
@@ -411,29 +405,29 @@ public function setTypes(array $types) : void
/**
* @return mixed[]
*/
- public function getTypes() : array
+ public function getTypes(): array
{
return $this->types;
}
- public function getRepositoryFactory() : ?string
+ public function getRepositoryFactory(): ?string
{
return $this->repositoryFactory;
}
- public function setRepositoryFactory(?string $repositoryFactory) : Configuration
+ public function setRepositoryFactory(?string $repositoryFactory): Configuration
{
$this->repositoryFactory = (string) $repositoryFactory;
return $this;
}
- public function getDefaultDocumentRepositoryClassName() : string
+ public function getDefaultDocumentRepositoryClassName(): string
{
return $this->defaultDocumentRepositoryClassName;
}
- public function setDefaultDocumentRepositoryClassName(string $defaultDocumentRepositoryClassName) : self
+ public function setDefaultDocumentRepositoryClassName(string $defaultDocumentRepositoryClassName): self
{
$this->defaultDocumentRepositoryClassName = $defaultDocumentRepositoryClassName;
diff --git a/src/DoctrineMongoODMModule/Options/Connection.php b/src/DoctrineMongoODMModule/Options/Connection.php
index 333cda7..742387f 100644
--- a/src/DoctrineMongoODMModule/Options/Connection.php
+++ b/src/DoctrineMongoODMModule/Options/Connection.php
@@ -69,72 +69,72 @@ class Connection extends AbstractOptions
*/
protected $driverOptions = [];
- public function getServer() : string
+ public function getServer(): string
{
return $this->server;
}
- public function setServer(?string $server) : Connection
+ public function setServer(?string $server): Connection
{
$this->server = (string) $server;
return $this;
}
- public function getPort() : string
+ public function getPort(): string
{
return $this->port;
}
- public function setPort(?string $port) : Connection
+ public function setPort(?string $port): Connection
{
$this->port = (string) $port;
return $this;
}
- public function getUser() : ?string
+ public function getUser(): ?string
{
return $this->user;
}
- public function setUser(?string $user) : Connection
+ public function setUser(?string $user): Connection
{
$this->user = (string) $user;
return $this;
}
- public function getPassword() : ?string
+ public function getPassword(): ?string
{
return $this->password;
}
- public function setPassword(?string $password) : self
+ public function setPassword(?string $password): self
{
$this->password = (string) $password;
return $this;
}
- public function getDbname() : string
+ public function getDbname(): string
{
return $this->dbname;
}
- public function setDbname(?string $dbname) : Connection
+ public function setDbname(?string $dbname): Connection
{
$this->dbname = (string) $dbname;
return $this;
}
- public function getConnectionString() : ?string
+ public function getConnectionString(): ?string
{
return $this->connectionString;
}
- public function setConnectionString(?string $connectionString) : Connection
+ public function setConnectionString(?string $connectionString): Connection
{
$this->connectionString = (string) $connectionString;
@@ -144,7 +144,7 @@ public function setConnectionString(?string $connectionString) : Connection
/**
* @return mixed[]
*/
- public function getOptions() : array
+ public function getOptions(): array
{
return $this->options;
}
@@ -152,7 +152,7 @@ public function getOptions() : array
/**
* @param mixed[] $options
*/
- public function setOptions(array $options) : Connection
+ public function setOptions(array $options): Connection
{
$this->options = $options;
@@ -162,7 +162,7 @@ public function setOptions(array $options) : Connection
/**
* @return mixed[]
*/
- public function getDriverOptions() : array
+ public function getDriverOptions(): array
{
return $this->driverOptions;
}
@@ -170,7 +170,7 @@ public function getDriverOptions() : array
/**
* @param mixed[] $driverOptions
*/
- public function setDriverOptions(array $driverOptions) : Connection
+ public function setDriverOptions(array $driverOptions): Connection
{
$this->driverOptions = $driverOptions;
diff --git a/src/DoctrineMongoODMModule/Options/DocumentManager.php b/src/DoctrineMongoODMModule/Options/DocumentManager.php
index a2709ff..ed5838e 100644
--- a/src/DoctrineMongoODMModule/Options/DocumentManager.php
+++ b/src/DoctrineMongoODMModule/Options/DocumentManager.php
@@ -43,14 +43,14 @@ class DocumentManager extends AbstractOptions
/**
* @param mixed $configuration
*/
- public function setConfiguration($configuration) : self
+ public function setConfiguration($configuration): self
{
$this->configuration = (string) $configuration;
return $this;
}
- public function getConfiguration() : string
+ public function getConfiguration(): string
{
return 'doctrine.configuration.' . $this->configuration;
}
@@ -58,19 +58,19 @@ public function getConfiguration() : string
/**
* @param mixed $connection
*/
- public function setConnection($connection) : self
+ public function setConnection($connection): self
{
$this->connection = (string) $connection;
return $this;
}
- public function getConnection() : string
+ public function getConnection(): string
{
return 'doctrine.connection.' . $this->connection;
}
- public function getEventManager() : string
+ public function getEventManager(): string
{
return 'doctrine.eventmanager.' . $this->eventManager;
}
@@ -78,7 +78,7 @@ public function getEventManager() : string
/**
* @param mixed $eventManager
*/
- public function setEventManager($eventManager) : self
+ public function setEventManager($eventManager): self
{
$this->eventManager = (string) $eventManager;
diff --git a/src/DoctrineMongoODMModule/Options/MongoLoggerCollector.php b/src/DoctrineMongoODMModule/Options/MongoLoggerCollector.php
index aecdddd..3febb6f 100644
--- a/src/DoctrineMongoODMModule/Options/MongoLoggerCollector.php
+++ b/src/DoctrineMongoODMModule/Options/MongoLoggerCollector.php
@@ -22,7 +22,7 @@ class MongoLoggerCollector extends AbstractOptions
/** @var string|null service name of the Logger to be used */
protected $mongoLogger;
- public function setName(string $name) : void
+ public function setName(string $name): void
{
$this->name = (string) $name;
}
@@ -30,12 +30,12 @@ public function setName(string $name) : void
/**
* Name of the collector
*/
- public function getName() : string
+ public function getName(): string
{
return $this->name;
}
- public function setConfiguration(?string $configuration) : void
+ public function setConfiguration(?string $configuration): void
{
$this->configuration = $configuration ? (string) $configuration : null;
}
@@ -43,12 +43,12 @@ public function setConfiguration(?string $configuration) : void
/**
* Configuration service name (where to set the logger)
*/
- public function getConfiguration() : string
+ public function getConfiguration(): string
{
return $this->configuration ?? 'doctrine.configuration.odm_default';
}
- public function setMongoLogger(?string $mongoLogger) : void
+ public function setMongoLogger(?string $mongoLogger): void
{
$this->mongoLogger = $mongoLogger ? (string) $mongoLogger : null;
}
@@ -56,7 +56,7 @@ public function setMongoLogger(?string $mongoLogger) : void
/**
* Logger service name
*/
- public function getMongoLogger() : ?string
+ public function getMongoLogger(): ?string
{
return $this->mongoLogger;
}
diff --git a/src/DoctrineMongoODMModule/Service/AbstractFactory.php b/src/DoctrineMongoODMModule/Service/AbstractFactory.php
index 52b50a9..64a9040 100644
--- a/src/DoctrineMongoODMModule/Service/AbstractFactory.php
+++ b/src/DoctrineMongoODMModule/Service/AbstractFactory.php
@@ -8,6 +8,7 @@
use Interop\Container\ContainerInterface;
use Laminas\Stdlib\AbstractOptions;
use RuntimeException;
+
use function sprintf;
// phpcs:disable SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming
@@ -18,7 +19,7 @@ abstract class AbstractFactory extends DoctrineModuleAbstractFactory
/**
* {@inheritDoc}
*/
- public function getOptions(ContainerInterface $container, $key, $name = null) : AbstractOptions
+ public function getOptions(ContainerInterface $container, $key, $name = null): AbstractOptions
{
if ($name === null) {
$name = $this->getName();
diff --git a/src/DoctrineMongoODMModule/Service/ConfigurationFactory.php b/src/DoctrineMongoODMModule/Service/ConfigurationFactory.php
index 744e6a2..da58e16 100644
--- a/src/DoctrineMongoODMModule/Service/ConfigurationFactory.php
+++ b/src/DoctrineMongoODMModule/Service/ConfigurationFactory.php
@@ -118,7 +118,7 @@ public function createService(ServiceLocatorInterface $container)
return $this($container, Configuration::class);
}
- public function getOptionsClass() : string
+ public function getOptionsClass(): string
{
return Options\Configuration::class;
}
diff --git a/src/DoctrineMongoODMModule/Service/ConnectionFactory.php b/src/DoctrineMongoODMModule/Service/ConnectionFactory.php
index 5b4e53f..7c9a92b 100644
--- a/src/DoctrineMongoODMModule/Service/ConnectionFactory.php
+++ b/src/DoctrineMongoODMModule/Service/ConnectionFactory.php
@@ -10,9 +10,11 @@
use Interop\Container\ContainerInterface;
use Laminas\ServiceManager\ServiceLocatorInterface;
use MongoDB\Client;
+
use function assert;
use function strpos;
use function substr;
+
use const PHP_INT_MAX;
/**
@@ -92,7 +94,7 @@ public function createService(ServiceLocatorInterface $container)
/**
* Get the class name of the options associated with this factory.
*/
- public function getOptionsClass() : string
+ public function getOptionsClass(): string
{
return Options\Connection::class;
}
diff --git a/src/DoctrineMongoODMModule/Service/DoctrineObjectHydratorFactory.php b/src/DoctrineMongoODMModule/Service/DoctrineObjectHydratorFactory.php
index 1a4409d..31461a2 100644
--- a/src/DoctrineMongoODMModule/Service/DoctrineObjectHydratorFactory.php
+++ b/src/DoctrineMongoODMModule/Service/DoctrineObjectHydratorFactory.php
@@ -7,11 +7,12 @@
use Doctrine\Laminas\Hydrator\DoctrineObject;
use Doctrine\ODM\MongoDB\DocumentManager;
use Psr\Container\ContainerInterface;
+
use function assert;
class DoctrineObjectHydratorFactory
{
- public function __invoke(ContainerInterface $container) : DoctrineObject
+ public function __invoke(ContainerInterface $container): DoctrineObject
{
$documentManager = $container->get('doctrine.documentmanager.odm_default');
assert($documentManager instanceof DocumentManager);
diff --git a/src/DoctrineMongoODMModule/Service/DocumentManagerFactory.php b/src/DoctrineMongoODMModule/Service/DocumentManagerFactory.php
index 141507c..d3df501 100644
--- a/src/DoctrineMongoODMModule/Service/DocumentManagerFactory.php
+++ b/src/DoctrineMongoODMModule/Service/DocumentManagerFactory.php
@@ -42,7 +42,7 @@ public function createService(ServiceLocatorInterface $container)
/**
* Get the class name of the options associated with this factory.
*/
- public function getOptionsClass() : string
+ public function getOptionsClass(): string
{
return Options\DocumentManager::class;
}
diff --git a/src/DoctrineMongoODMModule/Service/MongoLoggerCollectorFactory.php b/src/DoctrineMongoODMModule/Service/MongoLoggerCollectorFactory.php
index f23f6a5..2cd46b3 100644
--- a/src/DoctrineMongoODMModule/Service/MongoLoggerCollectorFactory.php
+++ b/src/DoctrineMongoODMModule/Service/MongoLoggerCollectorFactory.php
@@ -4,15 +4,13 @@
namespace DoctrineMongoODMModule\Service;
-use Doctrine\ODM\MongoDB\Configuration;
use DoctrineMongoODMModule\Collector\MongoLoggerCollector;
use DoctrineMongoODMModule\Logging\DebugStack;
-use DoctrineMongoODMModule\Logging\LoggerChain;
use DoctrineMongoODMModule\Options;
use Interop\Container\ContainerInterface;
use Laminas\ServiceManager\ServiceLocatorInterface;
+
use function assert;
-use function MongoDB\Driver\Monitoring\addSubscriber;
/**
* Mongo Logger Configuration ServiceManager factory
@@ -57,7 +55,7 @@ public function createService(ServiceLocatorInterface $container)
return $this($container, MongoLoggerCollector::class);
}
- public function getOptionsClass() : string
+ public function getOptionsClass(): string
{
return Options\MongoLoggerCollector::class;
}
diff --git a/tests/DoctrineMongoODMModuleTest/AbstractTest.php b/tests/DoctrineMongoODMModuleTest/AbstractTest.php
index 97449ea..eb47634 100644
--- a/tests/DoctrineMongoODMModuleTest/AbstractTest.php
+++ b/tests/DoctrineMongoODMModuleTest/AbstractTest.php
@@ -21,18 +21,18 @@ abstract class AbstractTest extends TestCase
/** @var mixed $serviceManager */
protected $serviceManager;
- protected function setUp() : void
+ protected function setUp(): void
{
$this->application = Application::init(ServiceManagerFactory::getConfiguration());
$this->serviceManager = $this->application->getServiceManager();
}
- public function getDocumentManager() : DocumentManager
+ public function getDocumentManager(): DocumentManager
{
return $this->serviceManager->get('doctrine.documentmanager.odm_default');
}
- protected function tearDown() : void
+ protected function tearDown(): void
{
try {
$connection = $this->getDocumentManager()->getClient();
diff --git a/tests/DoctrineMongoODMModuleTest/Assets/CustomRepositoryFactory.php b/tests/DoctrineMongoODMModuleTest/Assets/CustomRepositoryFactory.php
index 151dce0..2306c50 100644
--- a/tests/DoctrineMongoODMModuleTest/Assets/CustomRepositoryFactory.php
+++ b/tests/DoctrineMongoODMModuleTest/Assets/CustomRepositoryFactory.php
@@ -16,7 +16,7 @@ class CustomRepositoryFactory implements RepositoryFactory
* @param DocumentManager $documentManager The DocumentManager instance.
* @param string $documentName The name of the document.
*/
- public function getRepository(DocumentManager $documentManager, string $documentName) : ObjectRepository
+ public function getRepository(DocumentManager $documentManager, string $documentName): ObjectRepository
{
}
}
diff --git a/tests/DoctrineMongoODMModuleTest/Assets/DefaultDocumentRepository.php b/tests/DoctrineMongoODMModuleTest/Assets/DefaultDocumentRepository.php
index 5b4c558..bd838b1 100644
--- a/tests/DoctrineMongoODMModuleTest/Assets/DefaultDocumentRepository.php
+++ b/tests/DoctrineMongoODMModuleTest/Assets/DefaultDocumentRepository.php
@@ -8,7 +8,7 @@
class DefaultDocumentRepository extends DocumentRepository
{
- public function isCustomDefaultDocumentRepository() : bool
+ public function isCustomDefaultDocumentRepository(): bool
{
return true;
}
diff --git a/tests/DoctrineMongoODMModuleTest/Assets/Document/Annotation.php b/tests/DoctrineMongoODMModuleTest/Assets/Document/Annotation.php
index 9d2b709..b083805 100644
--- a/tests/DoctrineMongoODMModuleTest/Assets/Document/Annotation.php
+++ b/tests/DoctrineMongoODMModuleTest/Assets/Document/Annotation.php
@@ -44,7 +44,7 @@ public function getName()
/**
* @param mixed $name
*/
- public function setName($name) : void
+ public function setName($name): void
{
$this->name = (string) $name;
}
diff --git a/tests/DoctrineMongoODMModuleTest/Assets/Document/Simple.php b/tests/DoctrineMongoODMModuleTest/Assets/Document/Simple.php
index 41390a7..0f96031 100644
--- a/tests/DoctrineMongoODMModuleTest/Assets/Document/Simple.php
+++ b/tests/DoctrineMongoODMModuleTest/Assets/Document/Simple.php
@@ -42,7 +42,7 @@ public function getName()
/**
* @param mixed $name
*/
- public function setName($name) : void
+ public function setName($name): void
{
$this->name = (string) $name;
}
diff --git a/tests/DoctrineMongoODMModuleTest/Doctrine/AnnotationTest.php b/tests/DoctrineMongoODMModuleTest/Doctrine/AnnotationTest.php
index a6771f7..f0bff25 100644
--- a/tests/DoctrineMongoODMModuleTest/Doctrine/AnnotationTest.php
+++ b/tests/DoctrineMongoODMModuleTest/Doctrine/AnnotationTest.php
@@ -8,7 +8,7 @@
class AnnotationTest extends AbstractTest
{
- public function testAnnotation() : void
+ public function testAnnotation(): void
{
self::markTestIncomplete();
$documentManager = $this->getDocumentManager();
diff --git a/tests/DoctrineMongoODMModuleTest/Doctrine/AuthenticationAdapterFactoryTest.php b/tests/DoctrineMongoODMModuleTest/Doctrine/AuthenticationAdapterFactoryTest.php
index 3f6b340..5a8a602 100644
--- a/tests/DoctrineMongoODMModuleTest/Doctrine/AuthenticationAdapterFactoryTest.php
+++ b/tests/DoctrineMongoODMModuleTest/Doctrine/AuthenticationAdapterFactoryTest.php
@@ -8,9 +8,9 @@
class AuthenticationAdapterFactoryTest extends AbstractTest
{
- public function testAuthenticationAdapterFactory() : void
+ public function testAuthenticationAdapterFactory(): void
{
$adapter = $this->serviceManager->get('doctrine.authenticationadapter.odm_default');
- $this->assertInstanceOf('Laminas\Authentication\Adapter\AdapterInterface', $adapter);
+ self::assertInstanceOf('Laminas\Authentication\Adapter\AdapterInterface', $adapter);
}
}
diff --git a/tests/DoctrineMongoODMModuleTest/Doctrine/AuthenticationServiceFactoryTest.php b/tests/DoctrineMongoODMModuleTest/Doctrine/AuthenticationServiceFactoryTest.php
index ff28336..0217bb5 100644
--- a/tests/DoctrineMongoODMModuleTest/Doctrine/AuthenticationServiceFactoryTest.php
+++ b/tests/DoctrineMongoODMModuleTest/Doctrine/AuthenticationServiceFactoryTest.php
@@ -8,9 +8,9 @@
class AuthenticationServiceFactoryTest extends AbstractTest
{
- public function testAuthenticationServiceFactory() : void
+ public function testAuthenticationServiceFactory(): void
{
$authenticationService = $this->serviceManager->get('doctrine.authenticationservice.odm_default');
- $this->assertInstanceOf('Laminas\Authentication\AuthenticationService', $authenticationService);
+ self::assertInstanceOf('Laminas\Authentication\AuthenticationService', $authenticationService);
}
}
diff --git a/tests/DoctrineMongoODMModuleTest/Doctrine/AuthenticationStorageFactoryTest.php b/tests/DoctrineMongoODMModuleTest/Doctrine/AuthenticationStorageFactoryTest.php
index 49b7900..09b5e5c 100644
--- a/tests/DoctrineMongoODMModuleTest/Doctrine/AuthenticationStorageFactoryTest.php
+++ b/tests/DoctrineMongoODMModuleTest/Doctrine/AuthenticationStorageFactoryTest.php
@@ -8,9 +8,9 @@
class AuthenticationStorageFactoryTest extends AbstractTest
{
- public function testAuthenticationStorageFactory() : void
+ public function testAuthenticationStorageFactory(): void
{
$storage = $this->serviceManager->get('doctrine.authenticationstorage.odm_default');
- $this->assertInstanceOf('Laminas\Authentication\Storage\StorageInterface', $storage);
+ self::assertInstanceOf('Laminas\Authentication\Storage\StorageInterface', $storage);
}
}
diff --git a/tests/DoctrineMongoODMModuleTest/Doctrine/CliTest.php b/tests/DoctrineMongoODMModuleTest/Doctrine/CliTest.php
index 4303849..ec41f03 100644
--- a/tests/DoctrineMongoODMModuleTest/Doctrine/CliTest.php
+++ b/tests/DoctrineMongoODMModuleTest/Doctrine/CliTest.php
@@ -27,6 +27,7 @@
use Laminas\EventManager\SharedEventManagerInterface;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Application;
+
use function assert;
/**
@@ -42,7 +43,7 @@ class CliTest extends TestCase
/** @var DocumentManager */
protected $documentManager;
- protected function setUp() : void
+ protected function setUp(): void
{
$serviceManager = ServiceManagerFactory::getServiceManager();
@@ -58,7 +59,7 @@ protected function setUp() : void
$sharedEventManager->attach(
'doctrine',
'loadCli.post',
- static function () use (&$invocations) : void {
+ static function () use (&$invocations): void {
$invocations += 1;
}
);
@@ -70,7 +71,7 @@ static function () use (&$invocations) : void {
self::assertSame(1, $invocations);
}
- public function testValidHelpers() : void
+ public function testValidHelpers(): void
{
$helperSet = $this->cli->getHelperSet();
@@ -81,7 +82,7 @@ public function testValidHelpers() : void
self::assertSame($this->documentManager, $dmHelper->getDocumentManager());
}
- public function testValidCommands() : void
+ public function testValidCommands(): void
{
self::assertInstanceOf(
'Doctrine\ODM\MongoDB\Tools\Console\Command\GenerateHydratorsCommand',
diff --git a/tests/DoctrineMongoODMModuleTest/Doctrine/ConfigurationFactoryTest.php b/tests/DoctrineMongoODMModuleTest/Doctrine/ConfigurationFactoryTest.php
index c0a8e24..f9374f4 100644
--- a/tests/DoctrineMongoODMModuleTest/Doctrine/ConfigurationFactoryTest.php
+++ b/tests/DoctrineMongoODMModuleTest/Doctrine/ConfigurationFactoryTest.php
@@ -6,7 +6,7 @@
use Doctrine\Common\Cache\Cache;
use Doctrine\ODM\MongoDB\APM\CommandLoggerInterface;
-use Doctrine\ODM\MongoDB\Configuration;
+use Doctrine\ODM\MongoDB\Configuration as Config;
use Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionFactory;
use Doctrine\ODM\MongoDB\PersistentCollection\PersistentCollectionGenerator;
use Doctrine\ODM\MongoDB\Types\Type;
@@ -22,7 +22,7 @@
final class ConfigurationFactoryTest extends AbstractTest
{
- public function testCreation() : void
+ public function testCreation(): void
{
$serviceLocator = new ServiceManager();
$serviceLocator->setService(
@@ -65,17 +65,15 @@ public function testCreation() : void
'metadata_cache' => 'stubbed_metadatacache',
'driver' => 'stubbed_driver',
- 'generate_proxies' => $proxyGenerate = Configuration::AUTOGENERATE_EVAL,
- 'proxy_dir' => $proxyDir = 'dir/proxy',
+ 'generate_proxies' => $proxyGenerate = Config::AUTOGENERATE_EVAL,
+ 'proxy_dir' => $proxyDir = 'dir/proxy',
'proxy_namespace' => $proxyNamespace = 'ns\proxy',
- 'generate_hydrators' => $hydratorGenerate = Configuration::AUTOGENERATE_ALWAYS,
- 'hydrator_dir' => $hydratorDir = 'dir/hydrator',
- 'hydrator_namespace' => $hydratorNamespace = 'ns\hydrator',
- // phpcs:disable Generic.Files.LineLength
- 'generate_persistent_collections' => $collectionGenerate = Configuration::AUTOGENERATE_EVAL,
- // phpcs:enable Generic.Files.LineLength
- 'persistent_collection_dir' => $collectionDir = 'dir/collection',
+ 'generate_hydrators' => $hydratorGenerate = Config::AUTOGENERATE_ALWAYS,
+ 'hydrator_dir' => $hydratorDir = 'dir/hydrator',
+ 'hydrator_namespace' => $hydratorNamespace = 'ns\hydrator',
+ 'generate_persistent_collections' => $collectionGenerate = Config::AUTOGENERATE_EVAL,
+ 'persistent_collection_dir' => $collectionDir = 'dir/collection',
'persistent_collection_namespace' => $collectionNamespace = 'ns\collection',
'persistent_collection_factory' => PersistentCollectionFactory::class,
'persistent_collection_generator' => PersistentCollectionGenerator::class,
@@ -97,18 +95,18 @@ public function testCreation() : void
$factory = new ConfigurationFactory('odm_test');
$config = $factory->createService($serviceLocator);
- assert($config instanceof Configuration);
+ assert($config instanceof Config);
- self::assertInstanceOf(Configuration::class, $config);
+ self::assertInstanceOf(Config::class, $config);
self::assertSame($metadataCache, $config->getMetadataCacheImpl());
self::assertSame($mappingDriver, $config->getMetadataDriverImpl());
- self::assertSame(Configuration::AUTOGENERATE_EVAL, $config->getAutoGenerateProxyClasses());
+ self::assertSame(Config::AUTOGENERATE_EVAL, $config->getAutoGenerateProxyClasses());
self::assertSame($proxyDir, $config->getProxyDir());
self::assertSame($proxyNamespace, $config->getProxyNamespace());
- self::assertSame($config->getAutoGenerateHydratorClasses(), Configuration::AUTOGENERATE_ALWAYS);
+ self::assertSame($config->getAutoGenerateHydratorClasses(), Config::AUTOGENERATE_ALWAYS);
self::assertSame($hydratorDir, $config->getHydratorDir());
self::assertSame($hydratorNamespace, $config->getHydratorNamespace());
diff --git a/tests/DoctrineMongoODMModuleTest/Doctrine/ConnectionFactoryTest.php b/tests/DoctrineMongoODMModuleTest/Doctrine/ConnectionFactoryTest.php
index 56789c5..cafdccc 100644
--- a/tests/DoctrineMongoODMModuleTest/Doctrine/ConnectionFactoryTest.php
+++ b/tests/DoctrineMongoODMModuleTest/Doctrine/ConnectionFactoryTest.php
@@ -19,7 +19,7 @@ class ConnectionFactoryTest extends AbstractTest
/** @var mixed[] $connectionFactory */
private $connectionFactory = [];
- protected function setUp() : void
+ protected function setUp(): void
{
parent::setup();
$this->serviceManager->setAllowOverride(true);
@@ -29,7 +29,7 @@ protected function setUp() : void
$this->connectionFactory = new ConnectionFactory('odm_default');
}
- public function testConnectionStringOverwritesOtherConnectionSettings() : void
+ public function testConnectionStringOverwritesOtherConnectionSettings(): void
{
$connectionString = 'mongodb://localhost:27017';
$connectionConfig = [
@@ -50,7 +50,7 @@ public function testConnectionStringOverwritesOtherConnectionSettings() : void
self::assertEquals($connectionString, (string) $connection);
}
- public function testConnectionStringShouldAllowMultipleHosts() : void
+ public function testConnectionStringShouldAllowMultipleHosts(): void
{
$unreachablePort = 56000;
$connectionString = 'mongodb://localhost:' . $unreachablePort . ',localhost:27017';
@@ -66,7 +66,7 @@ public function testConnectionStringShouldAllowMultipleHosts() : void
self::assertEquals($connectionString, (string) $connection);
}
- public function testConnectionStringShouldAllowUnixSockets() : void
+ public function testConnectionStringShouldAllowUnixSockets(): void
{
$connectionString = 'mongodb://%2Ftmp%2Fmongodb-27017.sock';
$connectionConfig = [
@@ -81,7 +81,7 @@ public function testConnectionStringShouldAllowUnixSockets() : void
self::assertEquals($connectionString, (string) $connection);
}
- public function testDbNameShouldSetDefaultDB() : void
+ public function testDbNameShouldSetDefaultDB(): void
{
$dbName = 'foo_db';
$connectionConfig = [
@@ -99,7 +99,7 @@ public function testDbNameShouldSetDefaultDB() : void
self::assertEquals($dbName, $configuration->getDefaultDB());
}
- public function testDbNameShouldNotOverrideExplicitDefaultDB() : void
+ public function testDbNameShouldNotOverrideExplicitDefaultDB(): void
{
$defaultDB = 'foo_db';
$connectionConfig = [
@@ -116,7 +116,7 @@ public function testDbNameShouldNotOverrideExplicitDefaultDB() : void
self::assertEquals($defaultDB, $configuration->getDefaultDB());
}
- public function testConnectionStringShouldSetDefaultDB() : void
+ public function testConnectionStringShouldSetDefaultDB(): void
{
$dbName = 'foo_db';
$connectionString = 'mongodb://localhost:27017/' . $dbName;
@@ -135,7 +135,7 @@ public function testConnectionStringShouldSetDefaultDB() : void
self::assertEquals($dbName, $configuration->getDefaultDB());
}
- public function testConnectionStringWithOptionsShouldSetDefaultDB() : void
+ public function testConnectionStringWithOptionsShouldSetDefaultDB(): void
{
$dbName = 'foo_db';
$connectionString = 'mongodb://localhost:27017/' . $dbName;
@@ -154,7 +154,7 @@ public function testConnectionStringWithOptionsShouldSetDefaultDB() : void
self::assertEquals($dbName, $configuration->getDefaultDB());
}
- private function getConfiguration() : Configuration
+ private function getConfiguration(): Configuration
{
return $this->serviceManager->get('doctrine.configuration.odm_default');
}
diff --git a/tests/DoctrineMongoODMModuleTest/Doctrine/CustomDefaultRepositoryTest.php b/tests/DoctrineMongoODMModuleTest/Doctrine/CustomDefaultRepositoryTest.php
index f07448d..c4400fb 100644
--- a/tests/DoctrineMongoODMModuleTest/Doctrine/CustomDefaultRepositoryTest.php
+++ b/tests/DoctrineMongoODMModuleTest/Doctrine/CustomDefaultRepositoryTest.php
@@ -10,7 +10,7 @@
final class CustomDefaultRepositoryTest extends AbstractTest
{
- public function testCustomDefaultRepository() : void
+ public function testCustomDefaultRepository(): void
{
$documentManager = $this->getDocumentManager();
diff --git a/tests/DoctrineMongoODMModuleTest/Doctrine/DoctrineObjectHydratorFactoryTest.php b/tests/DoctrineMongoODMModuleTest/Doctrine/DoctrineObjectHydratorFactoryTest.php
index e38989f..010b695 100644
--- a/tests/DoctrineMongoODMModuleTest/Doctrine/DoctrineObjectHydratorFactoryTest.php
+++ b/tests/DoctrineMongoODMModuleTest/Doctrine/DoctrineObjectHydratorFactoryTest.php
@@ -8,32 +8,32 @@
use Doctrine\ODM\MongoDB\DocumentManager;
use DoctrineMongoODMModule\Service\DoctrineObjectHydratorFactory;
use Laminas\ServiceManager\ServiceLocatorInterface;
+use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
-use PHPUnit_Framework_MockObject_MockObject;
class DoctrineObjectHydratorFactoryTest extends TestCase
{
- /** @var ServiceLocatorInterface|PHPUnit_Framework_MockObject_MockObject */
+ /** @var ServiceLocatorInterface|MockObject */
protected $services;
- protected function setUp() : void
+ protected function setUp(): void
{
parent::setUp();
$this->services = $this->createMock(ServiceLocatorInterface::class);
$this->services
- ->expects($this->once())
+ ->expects(self::once())
->method('get')
->with('doctrine.documentmanager.odm_default')
->willReturn($this->prophesize(DocumentManager::class)->reveal());
}
- public function testReturnsHydratorInstance() : void
+ public function testReturnsHydratorInstance(): void
{
$factory = new DoctrineObjectHydratorFactory();
- $hydrator = $factory($this->services, DoctrineObject::class);
+ $hydrator = $factory($this->services);
- $this->assertInstanceOf(DoctrineObject::class, $hydrator);
+ self::assertInstanceOf(DoctrineObject::class, $hydrator);
}
}
diff --git a/tests/DoctrineMongoODMModuleTest/Doctrine/DocumentManagerTest.php b/tests/DoctrineMongoODMModuleTest/Doctrine/DocumentManagerTest.php
index 691dbe1..5b119c6 100644
--- a/tests/DoctrineMongoODMModuleTest/Doctrine/DocumentManagerTest.php
+++ b/tests/DoctrineMongoODMModuleTest/Doctrine/DocumentManagerTest.php
@@ -12,7 +12,7 @@ final class DocumentManagerTest extends AbstractTest
/** @var mixed[] $configuration */
private $configuration = [];
- protected function setUp() : void
+ protected function setUp(): void
{
parent::setup();
$this->serviceManager->setAllowOverride(true);
@@ -23,14 +23,14 @@ protected function setUp() : void
$this->serviceManager->setService('doctrine.eventmanager.odm_default', null);
}
- public function testDocumentManager() : void
+ public function testDocumentManager(): void
{
$documentManager = $this->getDocumentManager();
self::assertInstanceOf(DocumentManager::class, $documentManager);
}
- public function testShouldSetEventManager() : void
+ public function testShouldSetEventManager(): void
{
$eventManagerConfig = [
'odm_default' => [
diff --git a/tests/DoctrineMongoODMModuleTest/Doctrine/ModuleTest.php b/tests/DoctrineMongoODMModuleTest/Doctrine/ModuleTest.php
index 2230dd8..c5d622a 100644
--- a/tests/DoctrineMongoODMModuleTest/Doctrine/ModuleTest.php
+++ b/tests/DoctrineMongoODMModuleTest/Doctrine/ModuleTest.php
@@ -11,17 +11,17 @@
class ModuleTest extends TestCase
{
- public function testOdmDefaultIsUsedAsTheDocumentManagerIfNoneIsProvided() : void
+ public function testOdmDefaultIsUsedAsTheDocumentManagerIfNoneIsProvided(): void
{
$documentManager = $this->getMockbuilder('Doctrine\ODM\MongoDB\DocumentManager')
->disableOriginalConstructor()
->getMock();
$serviceManager = $this->createMock('Laminas\ServiceManager\ServiceManager');
- $serviceManager->expects($this->once())
+ $serviceManager->expects(self::once())
->method('get')
->with('doctrine.documentmanager.odm_default')
- ->will($this->returnValue($documentManager));
+ ->will(self::returnValue($documentManager));
$application = new Application();
$event = new Event('loadCli.post', $application, ['ServiceManager' => $serviceManager]);
@@ -29,10 +29,10 @@ public function testOdmDefaultIsUsedAsTheDocumentManagerIfNoneIsProvided() : voi
$module = new Module();
$module->loadCli($event);
- $this->assertSame($documentManager, $application->getHelperSet()->get('documentManager')->getDocumentManager());
+ self::assertSame($documentManager, $application->getHelperSet()->get('documentManager')->getDocumentManager());
}
- public function testDocumentManagerUsedCanBeSpecifiedInCommandLineArgument() : void
+ public function testDocumentManagerUsedCanBeSpecifiedInCommandLineArgument(): void
{
$argvBackup = $_SERVER['argv'];
@@ -41,10 +41,10 @@ public function testDocumentManagerUsedCanBeSpecifiedInCommandLineArgument() : v
->getMock();
$serviceManager = $this->createMock('Laminas\ServiceManager\ServiceManager');
- $serviceManager->expects($this->once())
+ $serviceManager->expects(self::once())
->method('get')
->with('doctrine.documentmanager.some_other_name')
- ->will($this->returnValue($documentManager));
+ ->will(self::returnValue($documentManager));
$application = new Application();
$event = new Event('loadCli.post', $application, ['ServiceManager' => $serviceManager]);
@@ -56,6 +56,6 @@ public function testDocumentManagerUsedCanBeSpecifiedInCommandLineArgument() : v
$_SERVER['argv'] = $argvBackup;
- $this->assertSame($documentManager, $application->getHelperSet()->get('documentManager')->getDocumentManager());
+ self::assertSame($documentManager, $application->getHelperSet()->get('documentManager')->getDocumentManager());
}
}
diff --git a/tests/DoctrineMongoODMModuleTest/Doctrine/MongoLoggerCollectorFactoryTest.php b/tests/DoctrineMongoODMModuleTest/Doctrine/MongoLoggerCollectorFactoryTest.php
index eccd89c..1184289 100644
--- a/tests/DoctrineMongoODMModuleTest/Doctrine/MongoLoggerCollectorFactoryTest.php
+++ b/tests/DoctrineMongoODMModuleTest/Doctrine/MongoLoggerCollectorFactoryTest.php
@@ -10,14 +10,14 @@
class MongoLoggerCollectorFactoryTest extends AbstractTest
{
- public function testCreateService() : void
+ public function testCreateService(): void
{
$collector = $this->serviceManager->get('doctrine.mongo_logger_collector.odm_default');
self::assertInstanceOf(MongoLoggerCollector::class, $collector);
}
- public function testCreateServiceWithLegacyCreateServiceMethod() : void
+ public function testCreateServiceWithLegacyCreateServiceMethod(): void
{
$factory = new MongoLoggerCollectorFactory('odm_default');
diff --git a/tests/DoctrineMongoODMModuleTest/Doctrine/MongoLoggerCollectorTest.php b/tests/DoctrineMongoODMModuleTest/Doctrine/MongoLoggerCollectorTest.php
index 65eddeb..eb2622e 100644
--- a/tests/DoctrineMongoODMModuleTest/Doctrine/MongoLoggerCollectorTest.php
+++ b/tests/DoctrineMongoODMModuleTest/Doctrine/MongoLoggerCollectorTest.php
@@ -15,40 +15,40 @@ class MongoLoggerCollectorTest extends TestCase
/** @var MongoLoggerCollector */
private $collector;
- protected function setUp() : void
+ protected function setUp(): void
{
$this->logger = new DebugStack();
$this->collector = new MongoLoggerCollector($this->logger, 'my-logger');
}
- public function testGetName() : void
+ public function testGetName(): void
{
self::assertSame('my-logger', $this->collector->getName());
}
- public function testPriority() : void
+ public function testPriority(): void
{
self::assertSame(10, $this->collector->getPriority());
}
- public function testCanHideIfQueryCountIsZero() : void
+ public function testCanHideIfQueryCountIsZero(): void
{
self::assertTrue($this->collector->canHide());
}
- public function testCannotHideIfQueriesAreLogged() : void
+ public function testCannotHideIfQueriesAreLogged(): void
{
$this->logger->queries = ['foo'];
self::assertFalse($this->collector->canHide());
}
- public function testDefaultQueryCount() : void
+ public function testDefaultQueryCount(): void
{
self::assertSame(0, $this->collector->getQueryCount());
}
- public function testQueryCount() : void
+ public function testQueryCount(): void
{
$this->logger->queries = [
'first query',
@@ -58,7 +58,7 @@ public function testQueryCount() : void
self::assertSame(2, $this->collector->getQueryCount());
}
- public function testGetQueries() : void
+ public function testGetQueries(): void
{
$queries = [
'first query',
@@ -70,7 +70,7 @@ public function testGetQueries() : void
self::assertSame($queries, $this->collector->getQueries());
}
- public function testQueryTimeIsZero() : void
+ public function testQueryTimeIsZero(): void
{
self::assertSame(0.0, $this->collector->getQueryTime());
}
diff --git a/tests/DoctrineMongoODMModuleTest/Doctrine/PersistTest.php b/tests/DoctrineMongoODMModuleTest/Doctrine/PersistTest.php
index c07e5bb..0529925 100644
--- a/tests/DoctrineMongoODMModuleTest/Doctrine/PersistTest.php
+++ b/tests/DoctrineMongoODMModuleTest/Doctrine/PersistTest.php
@@ -6,11 +6,12 @@
use DoctrineMongoODMModuleTest\AbstractTest;
use DoctrineMongoODMModuleTest\Assets\Document\Simple;
+
use function get_class;
class PersistTest extends AbstractTest
{
- public function testPersist() : void
+ public function testPersist(): void
{
$documentManager = $this->getDocumentManager();
@@ -24,6 +25,6 @@ public function testPersist() : void
$repository = $documentManager->getRepository(get_class($simple));
$simple = $repository->find($id);
- $this->assertEquals('lucy', $simple->getName());
+ self::assertEquals('lucy', $simple->getName());
}
}
diff --git a/tests/DoctrineMongoODMModuleTest/ServiceManagerFactory.php b/tests/DoctrineMongoODMModuleTest/ServiceManagerFactory.php
index 184695e..725500a 100644
--- a/tests/DoctrineMongoODMModuleTest/ServiceManagerFactory.php
+++ b/tests/DoctrineMongoODMModuleTest/ServiceManagerFactory.php
@@ -7,6 +7,7 @@
use Laminas\ModuleManager\ModuleManager;
use Laminas\Mvc\Service\ServiceManagerConfig;
use Laminas\ServiceManager\ServiceManager;
+
use function assert;
/**
@@ -19,7 +20,7 @@ class ServiceManagerFactory
/**
* @return mixed[]
*/
- public static function getConfiguration() : array
+ public static function getConfiguration(): array
{
return include __DIR__ . '/../TestConfiguration.php';
}
@@ -29,7 +30,7 @@ public static function getConfiguration() : array
*
* @param mixed[]|null $configuration
*/
- public static function getServiceManager(?array $configuration = null) : ServiceManager
+ public static function getServiceManager(?array $configuration = null): ServiceManager
{
$configuration = $configuration ?: static::getConfiguration();
$serviceManager = new ServiceManager();