33
44namespace JakubBoucek \ComposerConsistency ;
55
6- use RuntimeException ;
6+ use LogicException ;
77
88/**
99 * Class Checker
@@ -43,7 +43,7 @@ public function __construct(string $rootDir, ?string $vendorDir = null)
4343 * If `/vendor` is not comply requirements, checker throws an Exception
4444 * @param string $rootDir
4545 * @param string|null $vendorDir
46- * @throws RuntimeException
46+ * @throws ComposerInconsitencyException
4747 */
4848 public static function validateReqs (string $ rootDir , ?string $ vendorDir = null ): void
4949 {
@@ -54,12 +54,12 @@ public static function validateReqs(string $rootDir, ?string $vendorDir = null):
5454 /**
5555 * Check validity of required packages in vendor
5656 * If `/vendor` is not comply requirements, checker throws an Exception
57- * @throws RuntimeException
57+ * @throws ComposerInconsitencyException
5858 */
5959 public function validate (): void
6060 {
6161 if ($ this ->isReqsValid () === false ) {
62- throw new RuntimeException (
62+ throw new ComposerInconsitencyException (
6363 'Composer has no consitent vendor directory with project requirements, call `composer install` '
6464 );
6565 }
@@ -69,7 +69,7 @@ public function validate(): void
6969 /**
7070 * If vendor is not comply requirements, checker return `false`
7171 * @return bool
72- * @throws RuntimeException
72+ * @throws LogicException
7373 */
7474 public function isReqsValid (): bool
7575 {
@@ -111,8 +111,7 @@ public function setStrictReqs(bool $strictReqs): self
111111
112112 /**
113113 * @return array
114- * @throws FileReadException
115- * @throws RuntimeException
114+ * @throws LogicException
116115 */
117116 protected function loadReqs (): array
118117 {
@@ -130,8 +129,7 @@ protected function loadReqs(): array
130129
131130 /**
132131 * @return array
133- * @throws FileReadException
134- * @throws RuntimeException
132+ * @throws LogicException
135133 */
136134 protected function loadReqsFile (): array
137135 {
@@ -141,8 +139,7 @@ protected function loadReqsFile(): array
141139
142140 /**
143141 * @return array
144- * @throws FileReadException
145- * @throws RuntimeException
142+ * @throws LogicException
146143 */
147144 protected function loadInstalled (): array
148145 {
@@ -160,8 +157,7 @@ protected function loadInstalled(): array
160157
161158 /**
162159 * @return array
163- * @throws FileReadException
164- * @throws RuntimeException
160+ * @throws LogicException
165161 */
166162 protected function loadInstalledFile (): array
167163 {
@@ -172,8 +168,7 @@ protected function loadInstalledFile(): array
172168 /**
173169 * @param string $filename
174170 * @return array
175- * @throws FileReadException
176- * @throws RuntimeException
171+ * @throws LogicException
177172 */
178173 protected function readJsonFile (string $ filename ): array
179174 {
@@ -203,15 +198,15 @@ protected function readFile(string $file): string
203198 /**
204199 * @param string $json
205200 * @return array
206- * @throws RuntimeException
201+ * @throws LogicException
207202 * @link https://doc.nette.org/en/3.0/json
208203 */
209204 protected function parseJsonArray (string $ json ): array
210205 {
211206 $ value = json_decode ($ json , true , 512 , JSON_BIGINT_AS_STRING | JSON_THROW_ON_ERROR );
212207 if (is_array ($ value ) === false ) {
213208 $ type = gettype ($ value );
214- throw new RuntimeException ("Expected Json-serialized Array, but $ type instead. " );
209+ throw new LogicException ("Expected Json-serialized Array, but $ type instead. " );
215210 }
216211 return $ value ;
217212 }
0 commit comments