Skip to content

Commit 236c238

Browse files
authored
Merge pull request #49 from smoench/symfony-5-support
symfony 5 support
2 parents e43cc43 + 40c473b commit 236c238

30 files changed

+150
-251
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
"php": "^7.1",
1717
"ext-mongodb": "*",
1818
"mongodb/mongodb": "^1.4",
19-
"symfony/console": "^2.7|^3.4|^4",
20-
"symfony/yaml": "^2.7|^3.4|^4"
19+
"symfony/console": "^2.7 || ^3.4 || ^4.0 || ^5.0",
20+
"symfony/yaml": "^2.7 || ^3.4 || ^4.0 || ^5.0"
2121
},
2222
"require-dev": {
2323
"phpunit/phpunit": "^7.0",

demo/ConsoleApplication/Example/Migrations/TestAntiMattr/MongoDB/Version20140822185742.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Example\Migrations\TestAntiMattr\MongoDB;
44

55
use AntiMattr\MongoDB\Migrations\AbstractMigration;
6-
use \MongoDB\Database;
6+
use MongoDB\Database;
77

88
class Version20140822185742 extends AbstractMigration
99
{

demo/ConsoleApplication/Example/Migrations/TestAntiMattr/MongoDB/Version20140822185743.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Example\Migrations\TestAntiMattr\MongoDB;
44

55
use AntiMattr\MongoDB\Migrations\AbstractMigration;
6-
use \MongoDB\Database;
6+
use MongoDB\Database;
77

88
class Version20140822185743 extends AbstractMigration
99
{

demo/ConsoleApplication/Example/Migrations/TestAntiMattr/MongoDB/Version20140822185744.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Example\Migrations\TestAntiMattr\MongoDB;
44

55
use AntiMattr\MongoDB\Migrations\AbstractMigration;
6-
use \MongoDB\Database;
6+
use MongoDB\Database;
77

88
/**
99
* Auto-generated Migration: Please modify to your needs!

src/AntiMattr/MongoDB/Migrations/AbstractMigration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
use AntiMattr\MongoDB\Migrations\Exception\AbortException;
1515
use AntiMattr\MongoDB\Migrations\Exception\IrreversibleException;
1616
use AntiMattr\MongoDB\Migrations\Exception\SkipException;
17-
use \MongoDB\Collection;
18-
use \MongoDB\Database;
17+
use MongoDB\Collection;
18+
use MongoDB\Database;
1919

2020
/**
2121
* @author Matthew Fitzgerald <matthewfitz@gmail.com>

src/AntiMattr/MongoDB/Migrations/Collection/Statistics.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
namespace AntiMattr\MongoDB\Migrations\Collection;
1313

14-
use \MongoDB\Collection;
1514
use Exception;
15+
use MongoDB\Collection;
1616
use MongoDB\Database;
1717

1818
/**

src/AntiMattr/MongoDB/Migrations/Configuration/Configuration.php

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ class Configuration
103103
private $file;
104104

105105
/**
106-
* @param \MongoDB\Client $connection
107106
* @param \AntiMattr\MongoDB\Migrations\OutputWriter $outputWriter
108107
*/
109108
public function __construct(Client $connection, OutputWriter $outputWriter = null)
@@ -297,9 +296,6 @@ public function setFile($file)
297296
return $this;
298297
}
299298

300-
/**
301-
* @return string|null
302-
*/
303299
public function getFile(): ?string
304300
{
305301
return $this->file;
@@ -328,8 +324,6 @@ public function getMigratedVersions()
328324
*
329325
* @param string $version
330326
*
331-
* @return int
332-
*
333327
* @throws AntiMattr\MongoDB\Migrations\Exception\UnknownVersionException Throws exception if migration version does not exist
334328
* @throws DomainException If more than one version exists
335329
*/
@@ -347,9 +341,7 @@ public function getMigratedTimestamp($version): int
347341
}
348342

349343
if (count($result) > 1) {
350-
throw new \DomainException(
351-
'Unexpected duplicate version records in the database'
352-
);
344+
throw new \DomainException('Unexpected duplicate version records in the database');
353345
}
354346

355347
$returnVersion = $result[0];
@@ -448,9 +440,6 @@ public function registerMigration($version, $class)
448440
* Register an array of migrations. Each key of the array is the version and
449441
* the value is the migration class name.
450442
*
451-
*
452-
* @param array $migrations
453-
*
454443
* @return Version[]
455444
*/
456445
public function registerMigrations(array $migrations)
@@ -524,8 +513,6 @@ public function hasVersion($version)
524513
/**
525514
* Check if a version has been migrated or not yet.
526515
*
527-
* @param \AntiMattr\MongoDB\Migrations\Version $version
528-
*
529516
* @return bool
530517
*/
531518
public function hasVersionMigrated(Version $version)
@@ -563,6 +550,7 @@ public function getCurrentVersion()
563550
}
564551

565552
$version = $versions[0];
553+
566554
return $version['v'];
567555
}
568556

src/AntiMattr/MongoDB/Migrations/Configuration/ConfigurationBuilder.php

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -55,43 +55,25 @@ private function __construct()
5555
];
5656
}
5757

58-
/**
59-
* @return ConfigurationBuilder
60-
*/
6158
public static function create(): ConfigurationBuilder
6259
{
6360
return new static();
6461
}
6562

66-
/**
67-
* @param Client $connection
68-
*
69-
* @return ConfigurationBuilder
70-
*/
7163
public function setConnection(Client $connection): ConfigurationBuilder
7264
{
7365
$this->connection = $connection;
7466

7567
return $this;
7668
}
7769

78-
/**
79-
* @param OutputWriter $outputWriter
80-
*
81-
* @return ConfigurationBuilder
82-
*/
8370
public function setOutputWriter(OutputWriter $outputWriter): ConfigurationBuilder
8471
{
8572
$this->outputWriter = $outputWriter;
8673

8774
return $this;
8875
}
8976

90-
/**
91-
* @param string|null $configFile
92-
*
93-
* @return ConfigurationBuilder
94-
*/
9577
public function setOnDiskConfiguration(?string $configFile = null): ConfigurationBuilder
9678
{
9779
$this->configFile = $configFile;
@@ -120,12 +102,7 @@ public function setOnDiskConfiguration(?string $configFile = null): Configuratio
120102
break;
121103

122104
default:
123-
throw new \InvalidArgumentException(
124-
sprintf(
125-
'The specified config file should end in .xml or .yml/.yaml. Unrecognized extension [%s]',
126-
$fileExt
127-
)
128-
);
105+
throw new \InvalidArgumentException(sprintf('The specified config file should end in .xml or .yml/.yaml. Unrecognized extension [%s]', $fileExt));
129106
}
130107

131108
$this->configParams = array_merge($this->configParams, $diskConfig);
@@ -134,9 +111,6 @@ public function setOnDiskConfiguration(?string $configFile = null): Configuratio
134111
return $this;
135112
}
136113

137-
/**
138-
* @return Configuration
139-
*/
140114
public function build(): Configuration
141115
{
142116
$config = new Configuration($this->connection, $this->outputWriter);
@@ -177,11 +151,6 @@ public function build(): Configuration
177151
return $config;
178152
}
179153

180-
/**
181-
* @param string $configFile
182-
*
183-
* @return array
184-
*/
185154
private function loadXmlFile(string $configFile): array
186155
{
187156
$xml = simplexml_load_file($configFile);
@@ -225,11 +194,6 @@ private function loadXmlFile(string $configFile): array
225194

226195
/**
227196
* Get the path to the directory relative to the config file.
228-
*
229-
* @param string $configFile
230-
* @param string|null $directory
231-
*
232-
* @return string|null
233197
*/
234198
protected function getDirectoryRelativeToFile(string $configFile, ?string $directory = null): ?string
235199
{

src/AntiMattr/MongoDB/Migrations/Configuration/Timestamp.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ public function getTimestamp(): int
4949
);
5050

5151
if (!$this->t || !is_object($this->t)) {
52-
throw new \DomainException(
53-
'The timestamp to normalise must be one of ' . $supportedClasses . ' but it is not an object'
54-
);
52+
throw new \DomainException('The timestamp to normalise must be one of ' . $supportedClasses . ' but it is not an object');
5553
}
5654

5755
switch (get_class($this->t)) {
@@ -72,14 +70,9 @@ public function getTimestamp(): int
7270
return $this->t->getTimestamp();
7371
}
7472

75-
throw new \DomainException(
76-
'The normalised timestamp must be one of ' . $supportedClasses
77-
);
73+
throw new \DomainException('The normalised timestamp must be one of ' . $supportedClasses);
7874
}
7975

80-
/**
81-
* @return string
82-
*/
8376
public function __toString(): string
8477
{
8578
return (string) $this->getTimestamp();

src/AntiMattr/MongoDB/Migrations/Migration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
namespace AntiMattr\MongoDB\Migrations;
1313

1414
use AntiMattr\MongoDB\Migrations\Configuration\Configuration;
15-
use AntiMattr\MongoDB\Migrations\Exception\UnknownVersionException;
1615
use AntiMattr\MongoDB\Migrations\Exception\NoMigrationsToExecuteException;
16+
use AntiMattr\MongoDB\Migrations\Exception\UnknownVersionException;
1717

1818
/**
1919
* @author Matthew Fitzgerald <matthewfitz@gmail.com>

0 commit comments

Comments
 (0)