Skip to content

Commit

Permalink
refactor(exceptions) use the plural
Browse files Browse the repository at this point in the history
  • Loading branch information
noelma committed Jul 31, 2023
1 parent eef2e78 commit a4f14ee
Show file tree
Hide file tree
Showing 39 changed files with 76 additions and 76 deletions.
6 changes: 3 additions & 3 deletions USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -1104,13 +1104,13 @@ Exception
try{
$req->select(...$fields)->from('user')->fetch();
}
catch(\Soosyze\Queryflatfile\Exception\Query\ColumnsNotFoundException $e) {
catch(\Soosyze\Queryflatfile\Exceptions\Query\ColumnsNotFoundException $e) {
// Exception levée si une des valeurs contenues dans $fields ne correspond à aucun champ
}
catch(\Soosyze\Queryflatfile\Exception\Query\TableNotFoundException $e) {
catch(\Soosyze\Queryflatfile\Exceptions\Query\TableNotFoundException $e) {
// Exception levée si $table user n'existe pas
}
catch(\Soosyze\Queryflatfile\Exception\Query\QueryException $e) {
catch(\Soosyze\Queryflatfile\Exceptions\Query\QueryException $e) {
// Exception levée dans les 2 cas grâce à l'héritage
}
```
Expand Down
2 changes: 1 addition & 1 deletion src/Concerns/Field/TryOrGetDate.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace Soosyze\Queryflatfile\Concerns\Field;

use Soosyze\Queryflatfile\Enums\CurentDefaultType;
use Soosyze\Queryflatfile\Exception\TableBuilder\ColumnsValueException;
use Soosyze\Queryflatfile\Exceptions\TableBuilder\ColumnsValueException;

/**
* @property string $name
Expand Down
10 changes: 5 additions & 5 deletions src/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

namespace Soosyze\Queryflatfile;

use Soosyze\Queryflatfile\Exception\Driver\DriverException;
use Soosyze\Queryflatfile\Exception\Driver\FileNotFoundException;
use Soosyze\Queryflatfile\Exception\Driver\FileNotReadableException;
use Soosyze\Queryflatfile\Exception\Driver\FileNotWritableException;
use Soosyze\Queryflatfile\Exceptions\Driver\DriverException;
use Soosyze\Queryflatfile\Exceptions\Driver\FileNotFoundException;
use Soosyze\Queryflatfile\Exceptions\Driver\FileNotReadableException;
use Soosyze\Queryflatfile\Exceptions\Driver\FileNotWritableException;

/**
* Implementation partiel Queryflatfile\DriverInterface.
Expand All @@ -27,7 +27,7 @@ abstract class Driver implements DriverInterface
*
* @codeCoverageIgnore has
*
* @throws Exception\Driver\ExtensionNotLoadedException
* @throws Exceptions\Driver\ExtensionNotLoadedException
*/
abstract public function checkExtension(): void;

Expand Down
14 changes: 7 additions & 7 deletions src/DriverInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ interface DriverInterface
* @param string $fileName Nom du fichier SANS l'extension.
* @param array $data Tableau associatif à enregistrer.
*
* @throws Exception\Driver\ExtensionNotLoadedException Si l'extension n'est pas chargée.
* @throws Exceptions\Driver\ExtensionNotLoadedException Si l'extension n'est pas chargée.
*
* @return bool TRUE si tous ce passe bien sinon FALSE.
*/
Expand All @@ -36,9 +36,9 @@ public function create(string $path, string $fileName, array $data = []): bool;
* @param string $path Chemin du fichier.
* @param string $fileName Nom du fichier SANS l'extension.
*
* @throws Exception\Driver\ExtensionNotLoadedException Si l'extension n'est pas chargée.
* @throws Exception\Driver\FileNotFoundException Si le fichier est introuvable.
* @throws Exception\Driver\FileNotReadableException Si le fichier n'a pas les droits suffisant pour être lu.
* @throws Exceptions\Driver\ExtensionNotLoadedException Si l'extension n'est pas chargée.
* @throws Exceptions\Driver\FileNotFoundException Si le fichier est introuvable.
* @throws Exceptions\Driver\FileNotReadableException Si le fichier n'a pas les droits suffisant pour être lu.
*
* @return array les données du fichier
*/
Expand All @@ -52,9 +52,9 @@ public function read(string $path, string $fileName): array;
* @param string $fileName Nom du fichier SANS l'extension.
* @param array $data Tableau associatif à enregistrer.
*
* @throws Exception\Driver\ExtensionNotLoadedException Si l'extension n'est pas chargée.
* @throws Exception\Driver\FileNotFoundException Si le fichier est introuvable.
* @throws Exception\Driver\FileNotWritableException Si le fichier n'a pas les droits suffisant pour être écrit.
* @throws Exceptions\Driver\ExtensionNotLoadedException Si l'extension n'est pas chargée.
* @throws Exceptions\Driver\FileNotFoundException Si le fichier est introuvable.
* @throws Exceptions\Driver\FileNotWritableException Si le fichier n'a pas les droits suffisant pour être écrit.
*
* @return bool TRUE si tous ce passe bien sinon FALSE.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Drivers/Igbinary.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace Soosyze\Queryflatfile\Drivers;

use Soosyze\Queryflatfile\Exception\Driver\ExtensionNotLoadedException;
use Soosyze\Queryflatfile\Exceptions\Driver\ExtensionNotLoadedException;

/**
* Manipule des données sérialisées avec l'extension igbinary
Expand Down
2 changes: 1 addition & 1 deletion src/Drivers/Json.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Soosyze\Queryflatfile\Drivers;

use Soosyze\Queryflatfile\Exception\Driver\ExtensionNotLoadedException;
use Soosyze\Queryflatfile\Exceptions\Driver\ExtensionNotLoadedException;

/**
* Manipule des données dans des fichiers de type JSON
Expand Down
2 changes: 1 addition & 1 deletion src/Drivers/MsgPack.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Soosyze\Queryflatfile\Drivers;

use Soosyze\Queryflatfile\Exception\Driver\ExtensionNotLoadedException;
use Soosyze\Queryflatfile\Exceptions\Driver\ExtensionNotLoadedException;

/**
* Manipule des données sérialisées avec l'extension msgpack
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
* @license https://github.com/soosyze/queryflatfile/blob/master/LICENSE (MIT License)
*/

namespace Soosyze\Queryflatfile\Exception\Driver;
namespace Soosyze\Queryflatfile\Exceptions\Driver;

/**
* Exception relative à l'utilisation du driver.
*
* @author Mathieu NOËL <mathieu@soosyze.com>
*/
class DriverException extends \Soosyze\Queryflatfile\Exception\Exception
class DriverException extends \Soosyze\Queryflatfile\Exceptions\Exception
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @license https://github.com/soosyze/queryflatfile/blob/master/LICENSE (MIT License)
*/

namespace Soosyze\Queryflatfile\Exception\Driver;
namespace Soosyze\Queryflatfile\Exceptions\Driver;

/**
* Exception levée lorsque l'extension du driver est non chargée.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @license https://github.com/soosyze/queryflatfile/blob/master/LICENSE (MIT License)
*/

namespace Soosyze\Queryflatfile\Exception\Driver;
namespace Soosyze\Queryflatfile\Exceptions\Driver;

/**
* Exception levée lorsque le fichier de stockage est absent.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @license https://github.com/soosyze/queryflatfile/blob/master/LICENSE (MIT License)
*/

namespace Soosyze\Queryflatfile\Exception\Driver;
namespace Soosyze\Queryflatfile\Exceptions\Driver;

/**
* Exception levée lorsque le fichier de stockage est non lisible.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @license https://github.com/soosyze/queryflatfile/blob/master/LICENSE (MIT License)
*/

namespace Soosyze\Queryflatfile\Exception\Driver;
namespace Soosyze\Queryflatfile\Exceptions\Driver;

/**
* Exception levée lorsque le fichier de stockage est non éditable.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @license https://github.com/soosyze/queryflatfile/blob/master/LICENSE (MIT License)
*/

namespace Soosyze\Queryflatfile\Exception;
namespace Soosyze\Queryflatfile\Exceptions;

/**
* Exception générale.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @license https://github.com/soosyze/queryflatfile/blob/master/LICENSE (MIT License)
*/

namespace Soosyze\Queryflatfile\Exception\Query;
namespace Soosyze\Queryflatfile\Exceptions\Query;

/**
* Exception levée lorsqu'une méthode attendue est absente.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @license https://github.com/soosyze/queryflatfile/blob/master/LICENSE (MIT License)
*/

namespace Soosyze\Queryflatfile\Exception\Query;
namespace Soosyze\Queryflatfile\Exceptions\Query;

/**
* Exception levée lorsque le champ ne trouve pas de correspondance.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @license https://github.com/soosyze/queryflatfile/blob/master/LICENSE (MIT License)
*/

namespace Soosyze\Queryflatfile\Exception\Query;
namespace Soosyze\Queryflatfile\Exceptions\Query;

/**
* Exception levée lors d'un mauvais type valeur pour le champ sélectionné.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @license https://github.com/soosyze/queryflatfile/blob/master/LICENSE (MIT License)
*/

namespace Soosyze\Queryflatfile\Exception\Query;
namespace Soosyze\Queryflatfile\Exceptions\Query;

/**
* Exception levée lorsqu'un opérateur WHERE n'existe pas.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
* @license https://github.com/soosyze/queryflatfile/blob/master/LICENSE (MIT License)
*/

namespace Soosyze\Queryflatfile\Exception\Query;
namespace Soosyze\Queryflatfile\Exceptions\Query;

/**
* Exception relative à l'utilisation des requêtes et du schéma.
*
* @author Mathieu NOËL <mathieu@soosyze.com>
*/
class QueryException extends \Soosyze\Queryflatfile\Exception\Exception
class QueryException extends \Soosyze\Queryflatfile\Exceptions\Exception
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @license https://github.com/soosyze/queryflatfile/blob/master/LICENSE (MIT License)
*/

namespace Soosyze\Queryflatfile\Exception\Query;
namespace Soosyze\Queryflatfile\Exceptions\Query;

/**
* Exception levée lorsqu'une table absente du schéma.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @license https://github.com/soosyze/queryflatfile/blob/master/LICENSE (MIT License)
*/

namespace Soosyze\Queryflatfile\Exception\TableBuilder;
namespace Soosyze\Queryflatfile\Exceptions\TableBuilder;

/**
* Exception levée lorsque aucun champ est sélectionné.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @license https://github.com/soosyze/queryflatfile/blob/master/LICENSE (MIT License)
*/

namespace Soosyze\Queryflatfile\Exception\TableBuilder;
namespace Soosyze\Queryflatfile\Exceptions\TableBuilder;

/**
* Exception levée lors d'un mauvais type valeur pour le champ sélectionné.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
* @license https://github.com/soosyze/queryflatfile/blob/master/LICENSE (MIT License)
*/

namespace Soosyze\Queryflatfile\Exception\TableBuilder;
namespace Soosyze\Queryflatfile\Exceptions\TableBuilder;

/**
* Exception relative à la construction d'une table.
*
* @author Mathieu NOËL <mathieu@soosyze.com>
*/
class TableBuilderException extends \Soosyze\Queryflatfile\Exception\Exception
class TableBuilderException extends \Soosyze\Queryflatfile\Exceptions\Exception
{
}
4 changes: 2 additions & 2 deletions src/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

use Soosyze\Queryflatfile\Enums\FieldType;
use Soosyze\Queryflatfile\Enums\TableExecutionType;
use Soosyze\Queryflatfile\Exception\TableBuilder\ColumnsValueException;
use Soosyze\Queryflatfile\Exception\TableBuilder\TableBuilderException;
use Soosyze\Queryflatfile\Exceptions\TableBuilder\ColumnsValueException;
use Soosyze\Queryflatfile\Exceptions\TableBuilder\TableBuilderException;

/**
* Pattern fluent pour la création et configuration des types de données.
Expand Down
2 changes: 1 addition & 1 deletion src/Fields/IncrementType.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

use Soosyze\Queryflatfile\Concerns\Field\ThrowInvalidType;
use Soosyze\Queryflatfile\Enums\FieldType;
use Soosyze\Queryflatfile\Exception\TableBuilder\ColumnsValueException;
use Soosyze\Queryflatfile\Exceptions\TableBuilder\ColumnsValueException;
use Soosyze\Queryflatfile\Field;

/**
Expand Down
10 changes: 5 additions & 5 deletions src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
use Soosyze\Queryflatfile\Enums\QueryExecutionType;
use Soosyze\Queryflatfile\Enums\SortType;
use Soosyze\Queryflatfile\Enums\UnionType;
use Soosyze\Queryflatfile\Exception\Query\BadFunctionException;
use Soosyze\Queryflatfile\Exception\Query\ColumnsNotFoundException;
use Soosyze\Queryflatfile\Exception\Query\OperatorNotFoundException;
use Soosyze\Queryflatfile\Exception\Query\QueryException;
use Soosyze\Queryflatfile\Exception\Query\TableNotFoundException;
use Soosyze\Queryflatfile\Exceptions\Query\BadFunctionException;
use Soosyze\Queryflatfile\Exceptions\Query\ColumnsNotFoundException;
use Soosyze\Queryflatfile\Exceptions\Query\OperatorNotFoundException;
use Soosyze\Queryflatfile\Exceptions\Query\QueryException;
use Soosyze\Queryflatfile\Exceptions\Query\TableNotFoundException;
use Soosyze\Queryflatfile\Field;
use Soosyze\Queryflatfile\Fields\IncrementType;

Expand Down
4 changes: 2 additions & 2 deletions src/RequestInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
namespace Soosyze\Queryflatfile;

use Soosyze\Queryflatfile\Enums\SortType;
use Soosyze\Queryflatfile\Exception\Query\BadFunctionException;
use Soosyze\Queryflatfile\Exception\TableBuilder\ColumnsNotFoundException;
use Soosyze\Queryflatfile\Exceptions\Query\BadFunctionException;
use Soosyze\Queryflatfile\Exceptions\TableBuilder\ColumnsNotFoundException;

/**
* Ensemble des fonctions nécessaires à une requête.
Expand Down
8 changes: 4 additions & 4 deletions src/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
use Soosyze\Queryflatfile\DriverInterface;
use Soosyze\Queryflatfile\Drivers\Json;
use Soosyze\Queryflatfile\Enums\TableExecutionType;
use Soosyze\Queryflatfile\Exception\Exception;
use Soosyze\Queryflatfile\Exception\Query\TableNotFoundException;
use Soosyze\Queryflatfile\Exception\TableBuilder\ColumnsNotFoundException;
use Soosyze\Queryflatfile\Exception\TableBuilder\ColumnsValueException;
use Soosyze\Queryflatfile\Exceptions\Exception;
use Soosyze\Queryflatfile\Exceptions\Query\TableNotFoundException;
use Soosyze\Queryflatfile\Exceptions\TableBuilder\ColumnsNotFoundException;
use Soosyze\Queryflatfile\Exceptions\TableBuilder\ColumnsValueException;
use Soosyze\Queryflatfile\Fields\DropType;
use Soosyze\Queryflatfile\Fields\IncrementType;
use Soosyze\Queryflatfile\Fields\RenameType;
Expand Down
2 changes: 1 addition & 1 deletion src/TableBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace Soosyze\Queryflatfile;

use Soosyze\Queryflatfile\Enums\FieldType;
use Soosyze\Queryflatfile\Exception\TableBuilder\TableBuilderException;
use Soosyze\Queryflatfile\Exceptions\TableBuilder\TableBuilderException;
use Soosyze\Queryflatfile\Fields\BoolType;
use Soosyze\Queryflatfile\Fields\CharType;
use Soosyze\Queryflatfile\Fields\DateTimeType;
Expand Down
2 changes: 1 addition & 1 deletion src/Where.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace Soosyze\Queryflatfile;

use Soosyze\Queryflatfile\Enums\ExpressionType;
use Soosyze\Queryflatfile\Exception\Query\OperatorNotFoundException;
use Soosyze\Queryflatfile\Exceptions\Query\OperatorNotFoundException;

/**
* Pattern fluent pour la création des clauses (conditions) de manipulation des données.
Expand Down
4 changes: 2 additions & 2 deletions src/WhereHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
namespace Soosyze\Queryflatfile;

use Soosyze\Queryflatfile\Enums\ExpressionType;
use Soosyze\Queryflatfile\Exception\Query\OperatorNotFoundException;
use Soosyze\Queryflatfile\Exception\Query\QueryException;
use Soosyze\Queryflatfile\Exceptions\Query\OperatorNotFoundException;
use Soosyze\Queryflatfile\Exceptions\Query\QueryException;

/**
* Pattern fluent pour la création des clauses (conditions) de manipulation des données.
Expand Down
6 changes: 3 additions & 3 deletions tests/Architecture/Extending/DriverExceptionExtending.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@
use Arkitect\Expression\ForClasses\ResideInOneOfTheseNamespaces;
use Arkitect\Rules\DSL\ArchRule;
use Arkitect\Rules\Rule;
use Soosyze\Queryflatfile\Exception\Driver\DriverException;
use Soosyze\Queryflatfile\Exceptions\Driver\DriverException;
use Soosyze\Queryflatfile\Tests\Architecture\BaseRule;

class DriverExceptionExtending extends BaseRule
{
public static function classSet(): ClassSet
{
return ClassSet::fromDir(self::$path . '/src/Exception/Driver');
return ClassSet::fromDir(self::$path . '/src/Exceptions/Driver');
}

public static function rule(): ArchRule
{
return Rule::allClasses()
->except(DriverException::class)
->that(new ResideInOneOfTheseNamespaces('Soosyze\Queryflatfile\Exception\Diver\*'))
->that(new ResideInOneOfTheseNamespaces('Soosyze\Queryflatfile\Exceptions\Diver\*'))
->should(new Extend(DriverException::class))
->because('we want uniform naming');
}
Expand Down

0 comments on commit a4f14ee

Please sign in to comment.