1212namespace Symfony \Component \BrowserKit ;
1313
1414use Symfony \Component \BrowserKit \Exception \BadMethodCallException ;
15+ use Symfony \Component \BrowserKit \Exception \InvalidArgumentException ;
16+ use Symfony \Component \BrowserKit \Exception \LogicException ;
17+ use Symfony \Component \BrowserKit \Exception \RuntimeException ;
1518use Symfony \Component \DomCrawler \Crawler ;
1619use Symfony \Component \DomCrawler \Form ;
1720use Symfony \Component \DomCrawler \Link ;
@@ -110,12 +113,12 @@ public function getMaxRedirects(): int
110113 *
111114 * @return void
112115 *
113- * @throws \RuntimeException When Symfony Process Component is not installed
116+ * @throws LogicException When Symfony Process Component is not installed
114117 */
115118 public function insulate (bool $ insulated = true )
116119 {
117120 if ($ insulated && !class_exists (\Symfony \Component \Process \Process::class)) {
118- throw new \ LogicException ('Unable to isolate requests as the Symfony Process Component is not installed. ' );
121+ throw new LogicException ('Unable to isolate requests as the Symfony Process Component is not installed. ' );
119122 }
120123
121124 $ this ->insulated = $ insulated ;
@@ -335,7 +338,7 @@ public function submitForm(string $button, array $fieldValues = [], string $meth
335338 $ buttonNode = $ this ->crawler ->selectButton ($ button );
336339
337340 if (0 === $ buttonNode ->count ()) {
338- throw new \ InvalidArgumentException (sprintf ('There is no button with "%s" as its content, id, value or name. ' , $ button ));
341+ throw new InvalidArgumentException (sprintf ('There is no button with "%s" as its content, id, value or name. ' , $ button ));
339342 }
340343
341344 $ form = $ buttonNode ->form ($ fieldValues , $ method );
@@ -459,7 +462,7 @@ protected function doRequestInProcess(object $request)
459462 }
460463
461464 if (!$ process ->isSuccessful () || !preg_match ('/^O\:\d+\:/ ' , $ process ->getOutput ())) {
462- throw new \ RuntimeException (sprintf ('OUTPUT: %s ERROR OUTPUT: %s. ' , $ process ->getOutput (), $ process ->getErrorOutput ()));
465+ throw new RuntimeException (sprintf ('OUTPUT: %s ERROR OUTPUT: %s. ' , $ process ->getOutput (), $ process ->getErrorOutput ()));
463466 }
464467
465468 return unserialize ($ process ->getOutput ());
@@ -477,11 +480,11 @@ abstract protected function doRequest(object $request);
477480 *
478481 * @param object $request An origin request instance
479482 *
480- * @throws \ LogicException When this abstract class is not implemented
483+ * @throws LogicException When this abstract class is not implemented
481484 */
482485 protected function getScript (object $ request )
483486 {
484- throw new \ LogicException ('To insulate requests, you need to override the getScript() method. ' );
487+ throw new LogicException ('To insulate requests, you need to override the getScript() method. ' );
485488 }
486489
487490 /**
@@ -556,18 +559,18 @@ public function reload(): Crawler
556559 /**
557560 * Follow redirects?
558561 *
559- * @throws \ LogicException If request was not a redirect
562+ * @throws LogicException If request was not a redirect
560563 */
561564 public function followRedirect (): Crawler
562565 {
563566 if (empty ($ this ->redirect )) {
564- throw new \ LogicException ('The request was not redirected. ' );
567+ throw new LogicException ('The request was not redirected. ' );
565568 }
566569
567570 if (-1 !== $ this ->maxRedirects ) {
568571 if ($ this ->redirectCount > $ this ->maxRedirects ) {
569572 $ this ->redirectCount = 0 ;
570- throw new \ LogicException (sprintf ('The maximum number (%d) of redirections was reached. ' , $ this ->maxRedirects ));
573+ throw new LogicException (sprintf ('The maximum number (%d) of redirections was reached. ' , $ this ->maxRedirects ));
571574 }
572575 }
573576
0 commit comments