Skip to content

Commit

Permalink
Merge branch 3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
deguif committed Oct 8, 2020
2 parents b7af516 + 3af3dd1 commit 7df8901
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 16 deletions.
1 change: 1 addition & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ return PhpCsFixer\Config::create()
'header_comment' => ['header' => $header],
'full_opening_tag' => false,
'list_syntax' => ['syntax' => 'short'],
'native_constant_invocation' => true,
'native_function_invocation' => true,
'yoda_style' => false,
])
Expand Down
14 changes: 7 additions & 7 deletions Command/BaseBootstrapSymlinkCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public static function checkSymlink($symlinkTarget, $symlinkName, $forceSymlink
if (!$forceSymlink) {
throw new \Exception(\sprintf('Symlink "%s" points to "%s" instead of "%s"', $symlinkName, $linkTarget, $symlinkTarget));
}
if (\strtoupper(\substr(PHP_OS, 0, 3)) === 'WIN' && \is_dir($linkTarget)) {
if (\strtoupper(\substr(\PHP_OS, 0, 3)) === 'WIN' && \is_dir($linkTarget)) {
\rmdir($symlinkName);
} else {
\unlink($symlinkName);
Expand Down Expand Up @@ -126,7 +126,7 @@ public static function createMirror($symlinkTarget, $symlinkName)
$filesystem = new Filesystem();
$filesystem->mkdir($symlinkName);
$filesystem->mirror(
$symlinkName.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.$symlinkTarget,
$symlinkName.\DIRECTORY_SEPARATOR.'..'.\DIRECTORY_SEPARATOR.$symlinkTarget,
$symlinkName,
null,
['copy_on_windows' => true, 'delete' => true, 'override' => true]
Expand Down Expand Up @@ -168,8 +168,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
} elseif (false !== $composer = ComposerAdapter::getComposer($input, $output)) {
$cmanager = new ComposerPathFinder($composer);
$options = [
'targetSuffix' => DIRECTORY_SEPARATOR.$this->bootstrapInstallPath.static::$targetSuffix,
'sourcePrefix' => '..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR,
'targetSuffix' => \DIRECTORY_SEPARATOR.$this->bootstrapInstallPath.static::$targetSuffix,
'sourcePrefix' => '..'.\DIRECTORY_SEPARATOR.'..'.\DIRECTORY_SEPARATOR,
];
[$symlinkTarget, $symlinkName] = $cmanager->getSymlinkFromComposer(
self::$mopaBootstrapBundleName,
Expand All @@ -183,15 +183,15 @@ protected function execute(InputInterface $input, OutputInterface $output)
}

// Automatically detect if on Win XP where symlink will allways fail
if ($input->getOption('no-symlink') || PHP_OS == 'WINNT') {
if ($input->getOption('no-symlink') || \PHP_OS == 'WINNT') {
$this->output->write('Checking destination');

if (true === self::checkSymlink($symlinkTarget, $symlinkName)) {
$this->output->writeln(' ... <comment>symlink already exists</comment>');
} else {
$this->output->writeln(' ... <comment>not existing</comment>');
$this->output->writeln(\sprintf('Mirroring to: %s', $symlinkName));
$this->output->write(\sprintf('from target: %s', \realpath($symlinkName.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.$symlinkTarget)));
$this->output->write(\sprintf('from target: %s', \realpath($symlinkName.\DIRECTORY_SEPARATOR.'..'.\DIRECTORY_SEPARATOR.$symlinkTarget)));
self::createMirror($symlinkTarget, $symlinkName);
}
} else {
Expand Down Expand Up @@ -230,7 +230,7 @@ protected function getBootstrapPathsFromUser()
throw new \Exception('Target path '.$symlinkTarget.'is not a directory!');
}
} else {
$symlinkTarget = $symlinkName.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.$symlinkTarget;
$symlinkTarget = $symlinkName.\DIRECTORY_SEPARATOR.'..'.\DIRECTORY_SEPARATOR.$symlinkTarget;
}

if (!\is_dir($symlinkTarget)) {
Expand Down
6 changes: 3 additions & 3 deletions Command/InstallFontCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ protected function configure()
protected function execute(InputInterface $input, OutputInterface $output)
{
$finder = new Finder();
$iconWebPath = $this->kernel->getProjectDir().DIRECTORY_SEPARATOR.'web'.DIRECTORY_SEPARATOR.'fonts';
$iconWebPath = $this->kernel->getProjectDir().\DIRECTORY_SEPARATOR.'web'.\DIRECTORY_SEPARATOR.'fonts';

$fs = new Filesystem();

Expand All @@ -89,12 +89,12 @@ protected function execute(InputInterface $input, OutputInterface $output)

$bsbPath = $composer->getInstallationManager()->getInstallPath($sourcePackage);

$iconSetPath = $bsbPath.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'public'.DIRECTORY_SEPARATOR.self::$iconSetsPaths[$this->iconSet];
$iconSetPath = $bsbPath.\DIRECTORY_SEPARATOR.'Resources'.\DIRECTORY_SEPARATOR.'public'.\DIRECTORY_SEPARATOR.self::$iconSetsPaths[$this->iconSet];

$finder->files()->in($iconSetPath);

foreach ($finder as $file) {
$fs->copy($file->getRealpath(), $iconWebPath.DIRECTORY_SEPARATOR.$file->getRelativePathname());
$fs->copy($file->getRealpath(), $iconWebPath.\DIRECTORY_SEPARATOR.$file->getRelativePathname());
}

$output->writeln('Font: '.$this->iconSet.' Installed... <info>OK</info>');
Expand Down
10 changes: 5 additions & 5 deletions Composer/ScriptHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static function postInstallSymlinkTwitterBootstrap(Event $event)
$cmanager = new ComposerPathFinder($composer);
$options = [
'targetSuffix' => self::getTargetSuffix(),
'sourcePrefix' => '..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR,
'sourcePrefix' => '..'.\DIRECTORY_SEPARATOR.'..'.\DIRECTORY_SEPARATOR,
];
[$symlinkTarget, $symlinkName] = $cmanager->getSymlinkFromComposer(
BootstrapSymlinkLessCommand::$mopaBootstrapBundleName,
Expand All @@ -51,7 +51,7 @@ public static function postInstallMirrorTwitterBootstrap(Event $event)
$cmanager = new ComposerPathFinder($composer);
$options = [
'targetSuffix' => self::getTargetSuffix(),
'sourcePrefix' => '..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR,
'sourcePrefix' => '..'.\DIRECTORY_SEPARATOR.'..'.\DIRECTORY_SEPARATOR,
];
[$symlinkTarget, $symlinkName] = $cmanager->getSymlinkFromComposer(
BootstrapSymlinkLessCommand::$mopaBootstrapBundleName,
Expand All @@ -74,7 +74,7 @@ public static function postInstallSymlinkTwitterBootstrapSass(Event $event)
$cmanager = new ComposerPathFinder($composer);
$options = [
'targetSuffix' => self::getTargetSuffix('-sass'),
'sourcePrefix' => '..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR,
'sourcePrefix' => '..'.\DIRECTORY_SEPARATOR.'..'.\DIRECTORY_SEPARATOR,
];
[$symlinkTarget, $symlinkName] = $cmanager->getSymlinkFromComposer(
BootstrapSymlinkSassCommand::$mopaBootstrapBundleName,
Expand All @@ -97,7 +97,7 @@ public static function postInstallMirrorTwitterBootstrapSass(Event $event)
$cmanager = new ComposerPathFinder($composer);
$options = [
'targetSuffix' => self::getTargetSuffix('-sass'),
'sourcePrefix' => '..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR,
'sourcePrefix' => '..'.\DIRECTORY_SEPARATOR.'..'.\DIRECTORY_SEPARATOR,
];
[$symlinkTarget, $symlinkName] = $cmanager->getSymlinkFromComposer(
BootstrapSymlinkSassCommand::$mopaBootstrapBundleName,
Expand All @@ -115,6 +115,6 @@ public static function postInstallMirrorTwitterBootstrapSass(Event $event)

protected static function getTargetSuffix($end = '')
{
return DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'public'.DIRECTORY_SEPARATOR.'bootstrap'.$end;
return \DIRECTORY_SEPARATOR.'Resources'.\DIRECTORY_SEPARATOR.'public'.\DIRECTORY_SEPARATOR.'bootstrap'.$end;
}
}
2 changes: 1 addition & 1 deletion DependencyInjection/MopaBootstrapExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function load(array $configs, ContainerBuilder $container)
if ($this->isConfigEnabled($container, $config['menu']) || $this->isConfigEnabled($container, $config['navbar'])) {
// @deprecated: remove this BC layer
if ($this->isConfigEnabled($container, $config['navbar'])) {
\trigger_error(\sprintf('mopa_bootstrap.navbar is deprecated. Use mopa_bootstrap.menu.'), E_USER_DEPRECATED);
\trigger_error(\sprintf('mopa_bootstrap.navbar is deprecated. Use mopa_bootstrap.menu.'), \E_USER_DEPRECATED);
}
$loader->load('menu.xml');
$this->remapParameters($container, 'mopa_bootstrap.menu', $config['menu']);
Expand Down

0 comments on commit 7df8901

Please sign in to comment.