Skip to content

Combine consecutive issets #29008

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode)
->end()
->end()
->validate()
->ifTrue(function ($v) { return isset($v['type']) && isset($v['service']); })
->ifTrue(function ($v) { return isset($v['type'], $v['service']); })
->thenInvalid('"type" and "service" cannot be used together.')
->end()
->validate()
Expand Down Expand Up @@ -610,19 +610,19 @@ private function addAssetsSection(ArrayNodeDefinition $rootNode)
->end()
->validate()
->ifTrue(function ($v) {
return isset($v['version_strategy']) && isset($v['version']);
return isset($v['version_strategy'], $v['version']);
})
->thenInvalid('You cannot use both "version_strategy" and "version" at the same time under "assets".')
->end()
->validate()
->ifTrue(function ($v) {
return isset($v['version_strategy']) && isset($v['json_manifest_path']);
return isset($v['version_strategy'], $v['json_manifest_path']);
})
->thenInvalid('You cannot use both "version_strategy" and "json_manifest_path" at the same time under "assets".')
->end()
->validate()
->ifTrue(function ($v) {
return isset($v['version']) && isset($v['json_manifest_path']);
return isset($v['version'], $v['json_manifest_path']);
})
->thenInvalid('You cannot use both "version" and "json_manifest_path" at the same time under "assets".')
->end()
Expand Down Expand Up @@ -654,19 +654,19 @@ private function addAssetsSection(ArrayNodeDefinition $rootNode)
->end()
->validate()
->ifTrue(function ($v) {
return isset($v['version_strategy']) && isset($v['version']);
return isset($v['version_strategy'], $v['version']);
})
->thenInvalid('You cannot use both "version_strategy" and "version" at the same time under "assets" packages.')
->end()
->validate()
->ifTrue(function ($v) {
return isset($v['version_strategy']) && isset($v['json_manifest_path']);
return isset($v['version_strategy'], $v['json_manifest_path']);
})
->thenInvalid('You cannot use both "version_strategy" and "json_manifest_path" at the same time under "assets" packages.')
->end()
->validate()
->ifTrue(function ($v) {
return isset($v['version']) && isset($v['json_manifest_path']);
return isset($v['version'], $v['json_manifest_path']);
})
->thenInvalid('You cannot use both "version" and "json_manifest_path" at the same time under "assets" packages.')
->end()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function getConfigTreeBuilder()
->booleanNode('allow_if_equal_granted_denied')->defaultTrue()->end()
->end()
->validate()
->ifTrue(function ($v) { return isset($v['strategy']) && isset($v['service']); })
->ifTrue(function ($v) { return isset($v['strategy'], $v['service']); })
->thenInvalid('"strategy" and "service" cannot be used together.')
->end()
->end()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public function load(array $configs, ContainerBuilder $container)
$config['extensions']
);

if (isset($config['autoescape_service']) && isset($config['autoescape_service_method'])) {
if (isset($config['autoescape_service'], $config['autoescape_service_method'])) {
$config['autoescape'] = array(new Reference($config['autoescape_service']), $config['autoescape_service_method']);
}
unset($config['autoescape_service'], $config['autoescape_service_method']);
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Debug/ExceptionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public function getContent(FlattenException $exception)
if ($trace['function']) {
$content .= sprintf('at <span class="trace-class">%s</span><span class="trace-type">%s</span><span class="trace-method">%s</span>(<span class="trace-arguments">%s</span>)', $this->formatClass($trace['class']), $trace['type'], $trace['function'], $this->formatArgs($trace['args']));
}
if (isset($trace['file']) && isset($trace['line'])) {
if (isset($trace['file'], $trace['line'])) {
$content .= $this->formatPath($trace['file'], $trace['line']);
}
$content .= "</td></tr>\n";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ private function parseCallable($callable, $parameter, $id, $file)
}

if (\is_array($callable)) {
if (isset($callable[0]) && isset($callable[1])) {
if (isset($callable[0], $callable[1])) {
return array($this->resolveServices($callable[0], $file), $callable[1]);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Filesystem/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ public function makePathRelative($endPath, $startPath)

// Find for which directory the common path stops
$index = 0;
while (isset($startPathArr[$index]) && isset($endPathArr[$index]) && $startPathArr[$index] === $endPathArr[$index]) {
while (isset($startPathArr[$index], $endPathArr[$index]) && $startPathArr[$index] === $endPathArr[$index]) {
++$index;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Form/FormFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public function createBuilderForProperty($class, $property, $data = null, array
if ($typeGuess) {
$attrs = array();
$typeGuessOptions = $typeGuess->getOptions();
if (isset($typeGuessOptions['attr']) && isset($options['attr'])) {
if (isset($typeGuessOptions['attr'], $options['attr'])) {
$attrs = array('attr' => array_merge($typeGuessOptions['attr'], $options['attr']));
}

Expand Down
8 changes: 4 additions & 4 deletions src/Symfony/Component/Form/FormRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ public function renderBlock(FormView $view, $blockName, array $variables = array
}

// Merge the passed with the existing attributes
if (isset($variables['attr']) && isset($scopeVariables['attr'])) {
if (isset($variables['attr'], $scopeVariables['attr'])) {
$variables['attr'] = array_replace($scopeVariables['attr'], $variables['attr']);
}

// Merge the passed with the exist *label* attributes
if (isset($variables['label_attr']) && isset($scopeVariables['label_attr'])) {
if (isset($variables['label_attr'], $scopeVariables['label_attr'])) {
$variables['label_attr'] = array_replace($scopeVariables['label_attr'], $variables['label_attr']);
}

Expand Down Expand Up @@ -227,12 +227,12 @@ public function searchAndRenderBlock(FormView $view, $blockNameSuffix, array $va
}

// Merge the passed with the existing attributes
if (isset($variables['attr']) && isset($scopeVariables['attr'])) {
if (isset($variables['attr'], $scopeVariables['attr'])) {
$variables['attr'] = array_replace($scopeVariables['attr'], $variables['attr']);
}

// Merge the passed with the exist *label* attributes
if (isset($variables['label_attr']) && isset($scopeVariables['label_attr'])) {
if (isset($variables['label_attr'], $scopeVariables['label_attr'])) {
$variables['label_attr'] = array_replace($scopeVariables['label_attr'], $variables['label_attr']);
}

Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Routing/Loader/YamlFileLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ protected function validate($config, $name, $path)
if ($extraKeys = array_diff(array_keys($config), self::$availableKeys)) {
throw new \InvalidArgumentException(sprintf('The routing file "%s" contains unsupported keys for "%s": "%s". Expected one of: "%s".', $path, $name, implode('", "', $extraKeys), implode('", "', self::$availableKeys)));
}
if (isset($config['resource']) && isset($config['path'])) {
if (isset($config['resource'], $config['path'])) {
throw new \InvalidArgumentException(sprintf('The routing file "%s" must not specify both the "resource" key and the "path" key for "%s". Choose between an import and a route definition.', $path, $name));
}
if (!isset($config['resource']) && isset($config['type'])) {
Expand All @@ -214,7 +214,7 @@ protected function validate($config, $name, $path)
if (!isset($config['resource']) && !isset($config['path'])) {
throw new \InvalidArgumentException(sprintf('You must define a "path" for the route "%s" in file "%s".', $name, $path));
}
if (isset($config['controller']) && isset($config['defaults']['_controller'])) {
if (isset($config['controller'], $config['defaults']['_controller'])) {
throw new \InvalidArgumentException(sprintf('The routing file "%s" must not specify both the "controller" key and the defaults key "_controller" for "%s".', $path, $name));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public function __construct($header)
$this->header = $header;
preg_match_all('/(\w+)=("((?:[^"\\\\]|\\\\.)+)"|([^\s,$]+))/', $header, $matches, PREG_SET_ORDER);
foreach ($matches as $match) {
if (isset($match[1]) && isset($match[3])) {
if (isset($match[1], $match[3])) {
$this->elements[$match[1]] = isset($match[4]) ? $match[4] : $match[3];
}
}
Expand Down
4 changes: 1 addition & 3 deletions src/Symfony/Component/Serializer/Encoder/ChainDecoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ public function supportsDecoding($format/*, array $context = array()*/)
*/
private function getDecoder($format, array $context)
{
if (isset($this->decoderByFormat[$format])
&& isset($this->decoders[$this->decoderByFormat[$format]])
) {
if (isset($this->decoderByFormat[$format], $this->decoders[$this->decoderByFormat[$format]])) {
return $this->decoders[$this->decoderByFormat[$format]];
}

Expand Down
4 changes: 1 addition & 3 deletions src/Symfony/Component/Serializer/Encoder/ChainEncoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ public function needsNormalization($format/*, array $context = array()*/)
*/
private function getEncoder($format, array $context)
{
if (isset($this->encoderByFormat[$format])
&& isset($this->encoders[$this->encoderByFormat[$format]])
) {
if (isset($this->encoderByFormat[$format], $this->encoders[$this->encoderByFormat[$format]])) {
return $this->encoders[$this->encoderByFormat[$format]];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function __construct($options = null)
throw new ConstraintDefinitionException(sprintf('The "%s" constraint requires either the "value" or "propertyPath" option to be set.', \get_class($this)));
}

if (isset($options['value']) && isset($options['propertyPath'])) {
if (isset($options['value'], $options['propertyPath'])) {
throw new ConstraintDefinitionException(sprintf('The "%s" constraint requires only one of the "value" or "propertyPath" options to be set, not both.', \get_class($this)));
}

Expand Down