Merge branch '2.7' into 2.8

* 2.7:
  [minor] SCA
This commit is contained in:
Nicolas Grekas 2018-04-20 11:59:25 +02:00
commit 8c5fe4461b
7 changed files with 8 additions and 13 deletions

View File

@ -97,11 +97,10 @@ class TemplateFinder implements TemplateFinderInterface
private function findTemplatesInBundle(BundleInterface $bundle)
{
$name = $bundle->getName();
$templates = array_merge(
$templates = array_unique(array_merge(
$this->findTemplatesInFolder($bundle->getPath().'/Resources/views'),
$this->findTemplatesInFolder($this->rootDir.'/'.$name.'/views')
);
$templates = array_unique($templates);
));
foreach ($templates as $i => $template) {
$templates[$i] = $template->set('bundle', $name);

View File

@ -160,7 +160,7 @@ class CodeHelper extends Helper
$file = trim($file);
$fileStr = $file;
if (0 === strpos($fileStr, $this->rootDir)) {
$fileStr = str_replace($this->rootDir, '', str_replace('\\', '/', $fileStr));
$fileStr = str_replace(array('\\', $this->rootDir), array('/', ''), $fileStr);
$fileStr = htmlspecialchars($fileStr, $flags, $this->charset);
$fileStr = sprintf('<abbr title="%s">kernel.root_dir</abbr>/%s', htmlspecialchars($this->rootDir, $flags, $this->charset), $fileStr);
}

View File

@ -109,7 +109,7 @@ class JsonDescriptor extends Descriptor
{
return array(
'name' => '--'.$option->getName(),
'shortcut' => $option->getShortcut() ? '-'.implode('|-', explode('|', $option->getShortcut())) : '',
'shortcut' => $option->getShortcut() ? '-'.str_replace('|', '|-', $option->getShortcut()) : '',
'accept_value' => $option->acceptValue(),
'is_value_required' => $option->isValueRequired(),
'is_multiple' => $option->isArray(),

View File

@ -50,7 +50,7 @@ class MarkdownDescriptor extends Descriptor
$this->write(
'**'.$option->getName().':**'."\n\n"
.'* Name: `--'.$option->getName().'`'."\n"
.'* Shortcut: '.($option->getShortcut() ? '`-'.implode('|-', explode('|', $option->getShortcut())).'`' : '<none>')."\n"
.'* Shortcut: '.($option->getShortcut() ? '`-'.str_replace('|', '|-', $option->getShortcut()).'`' : '<none>')."\n"
.'* Accept value: '.($option->acceptValue() ? 'yes' : 'no')."\n"
.'* Is value required: '.($option->isValueRequired() ? 'yes' : 'no')."\n"
.'* Is multiple: '.($option->isArray() ? 'yes' : 'no')."\n"

View File

@ -223,7 +223,7 @@ class XmlDescriptor extends Descriptor
$pos = strpos($option->getShortcut(), '|');
if (false !== $pos) {
$objectXML->setAttribute('shortcut', '-'.substr($option->getShortcut(), 0, $pos));
$objectXML->setAttribute('shortcuts', '-'.implode('|-', explode('|', $option->getShortcut())));
$objectXML->setAttribute('shortcuts', '-'.str_replace('|', '|-', $option->getShortcut()));
} else {
$objectXML->setAttribute('shortcut', $option->getShortcut() ? '-'.$option->getShortcut() : '');
}

View File

@ -195,7 +195,7 @@ class InputOption
*
* @return bool
*/
public function equals(InputOption $option)
public function equals(self $option)
{
return $option->getName() === $this->getName()
&& $option->getShortcut() === $this->getShortcut()

View File

@ -162,10 +162,6 @@ class LazyLoadingMetadataFactory implements MetadataFactoryInterface
$class = ltrim(is_object($value) ? get_class($value) : $value, '\\');
if (class_exists($class) || interface_exists($class)) {
return true;
}
return false;
return class_exists($class) || interface_exists($class, false);
}
}