Skip to content

Commit 00b72c8

Browse files
Roelof Roosgrogy
Roelof Roos
authored andcommitted
Rename some exceptions to be more self-explanatory
1 parent d022109 commit 00b72c8

5 files changed

+12
-12
lines changed

src/Exceptions/NotImplementCallbackException.php renamed to src/Exceptions/CallbackNotImplementedException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
namespace PHP_Parallel_Lint\PhpParallelLint\Exceptions;
33

4-
class NotImplementCallbackException extends ParallelLintException
4+
class CallbackNotImplementedException extends ParallelLintException
55
{
66
protected $className;
77

src/Exceptions/NotExistsClassException.php renamed to src/Exceptions/ClassNotFoundException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
namespace PHP_Parallel_Lint\PhpParallelLint\Exceptions;
33

4-
class NotExistsClassException extends ParallelLintException
4+
class ClassNotFoundException extends ParallelLintException
55
{
66
protected $className;
77
protected $fileName;

src/Exceptions/NotExistsPathException.php renamed to src/Exceptions/PathNotFoundException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
namespace PHP_Parallel_Lint\PhpParallelLint\Exceptions;
33

4-
class NotExistsPathException extends ParallelLintException
4+
class PathNotFoundException extends ParallelLintException
55
{
66
protected $path;
77

src/Manager.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
use PHP_Parallel_Lint\PhpParallelLint\Contracts\SyntaxErrorCallback;
55
use PHP_Parallel_Lint\PhpParallelLint\Errors\SyntaxError;
6-
use PHP_Parallel_Lint\PhpParallelLint\Exceptions\NotExistsClassException;
7-
use PHP_Parallel_Lint\PhpParallelLint\Exceptions\NotExistsPathException;
8-
use PHP_Parallel_Lint\PhpParallelLint\Exceptions\NotImplementCallbackException;
6+
use PHP_Parallel_Lint\PhpParallelLint\Exceptions\ClassNotFoundException;
7+
use PHP_Parallel_Lint\PhpParallelLint\Exceptions\PathNotFoundException;
8+
use PHP_Parallel_Lint\PhpParallelLint\Exceptions\CallbackNotImplementedException;
99
use PHP_Parallel_Lint\PhpParallelLint\Exceptions\ParallelLintException;
1010
use PHP_Parallel_Lint\PhpParallelLint\Iterators\RecursiveDirectoryFilterIterator;
1111
use PHP_Parallel_Lint\PhpParallelLint\Outputs\CheckstyleOutput;
@@ -146,7 +146,7 @@ protected function gitBlame(Result $result, Settings $settings)
146146
* @param array $extensions
147147
* @param array $excluded
148148
* @return array
149-
* @throws NotExistsPathException
149+
* @throws PathNotFoundException
150150
*/
151151
protected function getFilesFromPaths(array $paths, array $extensions, array $excluded = array())
152152
{
@@ -175,7 +175,7 @@ protected function getFilesFromPaths(array $paths, array $extensions, array $exc
175175
$files[] = (string) $directoryFile;
176176
}
177177
} else {
178-
throw new NotExistsPathException($path);
178+
throw new PathNotFoundException($path);
179179
}
180180
}
181181

@@ -192,20 +192,20 @@ protected function createSyntaxErrorCallback(Settings $settings)
192192

193193
$fullFilePath = realpath($settings->syntaxErrorCallbackFile);
194194
if ($fullFilePath === false) {
195-
throw new NotExistsPathException($settings->syntaxErrorCallbackFile);
195+
throw new PathNotFoundException($settings->syntaxErrorCallbackFile);
196196
}
197197

198198
require_once $fullFilePath;
199199

200200
$expectedClassName = basename($fullFilePath, '.php');
201201
if (!class_exists($expectedClassName)) {
202-
throw new NotExistsClassException($expectedClassName, $settings->syntaxErrorCallbackFile);
202+
throw new ClassNotFoundException($expectedClassName, $settings->syntaxErrorCallbackFile);
203203
}
204204

205205
$callbackInstance = new $expectedClassName;
206206

207207
if (!($callbackInstance instanceof SyntaxErrorCallback)) {
208-
throw new NotImplementCallbackException($expectedClassName);
208+
throw new CallbackNotImplementedException($expectedClassName);
209209
}
210210

211211
return $callbackInstance;

tests/Manager.run.phpt

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ManagerRunTest extends Tester\TestCase
2121
$manager = $this->getManager($settings);
2222
Assert::exception(function () use ($manager, $settings) {
2323
$manager->run($settings);
24-
}, '\PHP_Parallel_Lint\PhpParallelLint\Exceptions\NotExistsPathException');
24+
}, '\PHP_Parallel_Lint\PhpParallelLint\Exceptions\PathNotFoundException');
2525
}
2626

2727
public function testFilesNotFound()

0 commit comments

Comments
 (0)