Skip to content

Commit c762735

Browse files
committed
Favor LogicException for missing classes & functions
1 parent 31f8cb9 commit c762735

File tree

21 files changed

+47
-26
lines changed

21 files changed

+47
-26
lines changed

src/Symfony/Component/BrowserKit/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public function getMaxRedirects()
118118
public function insulate($insulated = true)
119119
{
120120
if ($insulated && !class_exists('Symfony\\Component\\Process\\Process')) {
121-
throw new \RuntimeException('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.');
122122
}
123123

124124
$this->insulated = (bool) $insulated;

src/Symfony/Component/Config/Util/XmlUtils.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ private function __construct()
4747
public static function parse($content, $schemaOrCallable = null)
4848
{
4949
if (!\extension_loaded('dom')) {
50-
throw new \RuntimeException('Extension DOM is required.');
50+
throw new \LogicException('Extension DOM is required.');
5151
}
5252

5353
$internalErrors = libxml_use_internal_errors(true);

src/Symfony/Component/Console/Command/LockableTrait.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\Console\Command;
1313

1414
use Symfony\Component\Console\Exception\LogicException;
15-
use Symfony\Component\Console\Exception\RuntimeException;
1615
use Symfony\Component\Lock\Factory;
1716
use Symfony\Component\Lock\Lock;
1817
use Symfony\Component\Lock\Store\FlockStore;
@@ -36,7 +35,7 @@ trait LockableTrait
3635
private function lock($name = null, $blocking = false)
3736
{
3837
if (!class_exists(SemaphoreStore::class)) {
39-
throw new RuntimeException('To enable the locking feature you must install the symfony/lock component.');
38+
throw new LogicException('To enable the locking feature you must install the symfony/lock component.');
4039
}
4140

4241
if (null !== $this->lock) {

src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\DependencyInjection\Argument\ArgumentInterface;
1515
use Symfony\Component\DependencyInjection\ContainerBuilder;
1616
use Symfony\Component\DependencyInjection\Definition;
17+
use Symfony\Component\DependencyInjection\Exception\LogicException;
1718
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
1819
use Symfony\Component\DependencyInjection\ExpressionLanguage;
1920
use Symfony\Component\DependencyInjection\Reference;
@@ -197,7 +198,7 @@ private function getExpressionLanguage()
197198
{
198199
if (null === $this->expressionLanguage) {
199200
if (!class_exists(ExpressionLanguage::class)) {
200-
throw new RuntimeException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.');
201+
throw new LogicException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.');
201202
}
202203

203204
$providers = $this->container->getExpressionLanguageProviders();

src/Symfony/Component/DependencyInjection/ContainerBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1587,7 +1587,7 @@ private function getExpressionLanguage()
15871587
{
15881588
if (null === $this->expressionLanguage) {
15891589
if (!class_exists('Symfony\Component\ExpressionLanguage\ExpressionLanguage')) {
1590-
throw new RuntimeException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.');
1590+
throw new LogicException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.');
15911591
}
15921592
$this->expressionLanguage = new ExpressionLanguage(null, $this->expressionLanguageProviders);
15931593
}

src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1692,7 +1692,7 @@ private function getExpressionLanguage()
16921692
{
16931693
if (null === $this->expressionLanguage) {
16941694
if (!class_exists('Symfony\Component\ExpressionLanguage\ExpressionLanguage')) {
1695-
throw new RuntimeException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.');
1695+
throw new LogicException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.');
16961696
}
16971697
$providers = $this->container->getExpressionLanguageProviders();
16981698
$this->expressionLanguage = new ExpressionLanguage(null, $providers, function ($arg) {

src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument;
2020
use Symfony\Component\DependencyInjection\ContainerInterface;
2121
use Symfony\Component\DependencyInjection\Definition;
22+
use Symfony\Component\DependencyInjection\Exception\LogicException;
2223
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
2324
use Symfony\Component\DependencyInjection\Parameter;
2425
use Symfony\Component\DependencyInjection\Reference;
@@ -45,7 +46,7 @@ class YamlDumper extends Dumper
4546
public function dump(array $options = array())
4647
{
4748
if (!class_exists('Symfony\Component\Yaml\Dumper')) {
48-
throw new RuntimeException('Unable to dump the container as the Symfony Yaml Component is not installed.');
49+
throw new LogicException('Unable to dump the container as the Symfony Yaml Component is not installed.');
4950
}
5051

5152
if (null === $this->dumper) {

src/Symfony/Component/DependencyInjection/EnvVarProcessor.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\Config\Util\XmlUtils;
1515
use Symfony\Component\DependencyInjection\Exception\EnvNotFoundException;
16+
use Symfony\Component\DependencyInjection\Exception\LogicException;
1617
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
1718

1819
/**
@@ -180,7 +181,7 @@ public function getEnv($prefix, $name, \Closure $getEnv)
180181
private static function phpize($value)
181182
{
182183
if (!class_exists(XmlUtils::class)) {
183-
throw new RuntimeException('The Symfony Config component is required to cast env vars to "bool", "int" or "float".');
184+
throw new LogicException('The Symfony Config component is required to cast env vars to "bool", "int" or "float".');
184185
}
185186

186187
return XmlUtils::phpize($value);

src/Symfony/Component/DomCrawler/Crawler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1166,7 +1166,7 @@ private function createSubCrawler($nodes)
11661166
private function createCssSelectorConverter(): CssSelectorConverter
11671167
{
11681168
if (!\class_exists(CssSelectorConverter::class)) {
1169-
throw new \RuntimeException('To filter with a CSS selector, install the CssSelector component ("composer require symfony/css-selector"). Or use filterXpath instead.');
1169+
throw new \LogicException('To filter with a CSS selector, install the CssSelector component ("composer require symfony/css-selector"). Or use filterXpath instead.');
11701170
}
11711171

11721172
return new CssSelectorConverter($this->isHtml);
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Messenger\Exception;
13+
14+
/**
15+
* @author Roland Franssen <franssen.roland@gmail.com>
16+
*/
17+
class LogicException extends \LogicException implements ExceptionInterface
18+
{
19+
}

0 commit comments

Comments
 (0)