-
-
Notifications
You must be signed in to change notification settings - Fork 391
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #725 from Majkl578/specialized-exceptions
Throw only specialized package-only exceptions
- Loading branch information
Showing
35 changed files
with
405 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
lib/Doctrine/Migrations/Configuration/Connection/Loader/Exception/InvalidConfiguration.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Migrations\Configuration\Connection\Loader\Exception; | ||
|
||
use InvalidArgumentException; | ||
|
||
final class InvalidConfiguration extends InvalidArgumentException implements LoaderException | ||
{ | ||
public static function invalidArrayConfiguration() : self | ||
{ | ||
return new self('The connection file has to return an array with database configuration parameters.'); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
lib/Doctrine/Migrations/Configuration/Connection/Loader/Exception/LoaderException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Migrations\Configuration\Connection\Loader\Exception; | ||
|
||
use Doctrine\Migrations\Exception\MigrationException; | ||
|
||
interface LoaderException extends MigrationException | ||
{ | ||
} |
15 changes: 15 additions & 0 deletions
15
lib/Doctrine/Migrations/Configuration/Exception/FileNotFound.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Migrations\Configuration\Exception; | ||
|
||
use InvalidArgumentException; | ||
|
||
final class FileNotFound extends InvalidArgumentException implements ConfigurationException | ||
{ | ||
public static function new() : self | ||
{ | ||
return new self('Given config file does not exist'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Migrations\Exception; | ||
|
||
use RuntimeException; | ||
|
||
final class NoTablesFound extends RuntimeException implements MigrationException | ||
{ | ||
public static function new() : self | ||
{ | ||
return new self('Your database schema does not contain any tables.'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Migrations\Exception; | ||
|
||
use RuntimeException; | ||
|
||
final class RollupFailed extends RuntimeException implements MigrationException | ||
{ | ||
public static function noMigrationsFound() : self | ||
{ | ||
return new self('No migrations found.'); | ||
} | ||
|
||
public static function tooManyMigrations() : self | ||
{ | ||
return new self('Too many migrations.'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Migrations\Finder\Exception; | ||
|
||
interface FinderException | ||
{ | ||
} |
16 changes: 16 additions & 0 deletions
16
lib/Doctrine/Migrations/Finder/Exception/InvalidDirectory.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Migrations\Finder\Exception; | ||
|
||
use InvalidArgumentException; | ||
use function sprintf; | ||
|
||
final class InvalidDirectory extends InvalidArgumentException implements FinderException | ||
{ | ||
public static function new(string $directory) : self | ||
{ | ||
return new self(sprintf('Cannot load migrations from "%s" because it is not a valid directory', $directory)); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
lib/Doctrine/Migrations/Finder/Exception/NameIsReserved.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Migrations\Finder\Exception; | ||
|
||
use InvalidArgumentException; | ||
use const PHP_EOL; | ||
use function sprintf; | ||
|
||
final class NameIsReserved extends InvalidArgumentException implements FinderException | ||
{ | ||
public static function new(string $version) : self | ||
{ | ||
return new self(sprintf( | ||
'Cannot load a migrations with the name "%s" because it is a reserved number by Doctrine Migrations.' | ||
. PHP_EOL | ||
. "It's used to revert all migrations including the first one.", | ||
$version | ||
)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
lib/Doctrine/Migrations/Generator/Exception/GeneratorException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Migrations\Generator\Exception; | ||
|
||
use Doctrine\Migrations\Exception\MigrationException; | ||
|
||
interface GeneratorException extends MigrationException | ||
{ | ||
} |
26 changes: 26 additions & 0 deletions
26
lib/Doctrine/Migrations/Generator/Exception/InvalidTemplateSpecified.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Migrations\Generator\Exception; | ||
|
||
use InvalidArgumentException; | ||
use function sprintf; | ||
|
||
final class InvalidTemplateSpecified extends InvalidArgumentException implements GeneratorException | ||
{ | ||
public static function notFoundOrNotReadable(string $path) : self | ||
{ | ||
return new self(sprintf('The specified template "%s" cannot be found or is not readable.', $path)); | ||
} | ||
|
||
public static function notReadable(string $path) : self | ||
{ | ||
return new self(sprintf('The specified template "%s" could not be read.', $path)); | ||
} | ||
|
||
public static function empty(string $path) : self | ||
{ | ||
return new self(sprintf('The specified template "%s" is empty.', $path)); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
lib/Doctrine/Migrations/Generator/Exception/NoChangesDetected.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Migrations\Generator\Exception; | ||
|
||
use RuntimeException; | ||
|
||
final class NoChangesDetected extends RuntimeException implements GeneratorException | ||
{ | ||
public static function new() : self | ||
{ | ||
return new self('No changes detected in your mapping information.'); | ||
} | ||
} |
Oops, something went wrong.