Skip to content

Commit

Permalink
Merge branch '2.0-release'
Browse files Browse the repository at this point in the history
  • Loading branch information
emodric committed Oct 31, 2017
2 parents 04d201e + 3b1ec88 commit e832c39
Show file tree
Hide file tree
Showing 14 changed files with 54 additions and 50 deletions.
29 changes: 15 additions & 14 deletions .php_cs
@@ -1,28 +1,29 @@
<?php

return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
'@Symfony:risky' => true,
'array_syntax' => array('syntax' => 'long'),
'combine_consecutive_unsets' => true,
'concat_space' => ['spacing' => 'one'],
'array_syntax' => false,
'simplified_null_return' => false,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_class_elements' => true,
'ordered_imports' => true,
'phpdoc_add_missing_param_annotation' => true,
'phpdoc_align' => false,
'phpdoc_separation' => false,
'phpdoc_to_comment' => false,
'cast_spaces' => false,
'blank_line_after_opening_tag' => false,
'phpdoc_no_alias_tag' => false,
'phpdoc_order' => true,
'psr4' => true,
'semicolon_after_instruction' => true,
'strict_comparison' => true,
'strict_param' => true,
'yoda_style' => false,
])
->setRiskyAllowed(true)
->setFinder(
PhpCsFixer\Finder::create()
->exclude(['vendor', 'ezpublish_legacy', 'Resources', 'Installer/_templates'])
->in(__DIR__)
->exclude([
'vendor',
'Resources',
'ezpublish_legacy',
])
->files()->name('*.php')
)
;
16 changes: 8 additions & 8 deletions Command/InstallCommand.php
Expand Up @@ -2,20 +2,20 @@

namespace Netgen\Bundle\AdminUIBundle\Command;

use Exception;
use eZ\Publish\API\Repository\Exceptions\NotFoundException;
use InvalidArgumentException;
use Netgen\Bundle\AdminUIBundle\Installer\Generator\ConfigurationGenerator;
use Netgen\Bundle\AdminUIBundle\Installer\Generator\LegacySiteAccessGenerator;
use RuntimeException;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Symfony\Component\Console\Question\Question;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Symfony\Component\Console\Question\Question;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Process\ProcessBuilder;
use Netgen\Bundle\AdminUIBundle\Installer\Generator\LegacySiteAccessGenerator;
use Netgen\Bundle\AdminUIBundle\Installer\Generator\ConfigurationGenerator;
use InvalidArgumentException;
use Exception;
use RuntimeException;

class InstallCommand extends ContainerAwareCommand
{
Expand Down
10 changes: 5 additions & 5 deletions DependencyInjection/NetgenAdminUIExtension.php
Expand Up @@ -2,16 +2,16 @@

namespace Netgen\Bundle\AdminUIBundle\DependencyInjection;

use Netgen\BlockManager\Version as BlockManagerVersion;
use Netgen\TagsBundle\Version as TagsBundleVersion;
use RuntimeException;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;
use Netgen\TagsBundle\Version as TagsBundleVersion;
use Netgen\BlockManager\Version as BlockManagerVersion;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\Yaml\Yaml;
use RuntimeException;

class NetgenAdminUIExtension extends Extension implements PrependExtensionInterface
{
Expand Down
2 changes: 1 addition & 1 deletion EventListener/LegacyExceptionListener.php
Expand Up @@ -3,9 +3,9 @@
namespace Netgen\Bundle\AdminUIBundle\EventListener;

use eZ\Bundle\EzPublishLegacyBundle\Routing\FallbackRouter;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpKernel\KernelEvents;

class LegacyExceptionListener implements EventSubscriberInterface
Expand Down
7 changes: 4 additions & 3 deletions EventListener/LegacyResponseListener.php
Expand Up @@ -2,9 +2,9 @@

namespace Netgen\Bundle\AdminUIBundle\EventListener;

use Netgen\Bundle\AdminUIBundle\Exception\NotFoundHttpException;
use eZ\Bundle\EzPublishLegacyBundle\LegacyResponse;
use eZ\Bundle\EzPublishLegacyBundle\Routing\FallbackRouter;
use Netgen\Bundle\AdminUIBundle\Exception\NotFoundHttpException;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
Expand Down Expand Up @@ -40,9 +40,10 @@ public static function getSubscribedEvents()
/**
* Converts the legacy 404 response to proper Symfony exception.
*
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*
* @param \Symfony\Component\HttpKernel\Event\FilterResponseEvent $event
*
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/
public function onKernelResponse(FilterResponseEvent $event)
{
Expand All @@ -56,7 +57,7 @@ public function onKernelResponse(FilterResponseEvent $event)
return;
}

if (!$this->legacyMode && $response->getStatusCode() == Response::HTTP_NOT_FOUND) {
if (!$this->legacyMode && (int) $response->getStatusCode() === Response::HTTP_NOT_FOUND) {
$moduleResult = $response->getModuleResult();
$exception = new NotFoundHttpException(
isset($moduleResult['errorMessage']) ?
Expand Down
10 changes: 5 additions & 5 deletions EventListener/SecurityListener.php
Expand Up @@ -2,16 +2,16 @@

namespace Netgen\Bundle\AdminUIBundle\EventListener;

use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use eZ\Publish\API\Repository\Repository;
use eZ\Publish\Core\MVC\ConfigResolverInterface;
use eZ\Publish\Core\MVC\Legacy\Event\PostBuildKernelEvent;
use eZ\Publish\Core\MVC\Legacy\LegacyEvents;
use ezpWebBasedKernelHandler;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;

class SecurityListener implements EventSubscriberInterface
{
Expand Down
2 changes: 1 addition & 1 deletion EventListener/SetTagsAdminPageLayoutListener.php
Expand Up @@ -43,7 +43,7 @@ public function __construct(AdminGlobalVariable $globalVariable, $pageLayoutTemp
*/
public function setIsAdminSiteAccess($isAdminSiteAccess = false)
{
$this->isAdminSiteAccess = (bool)$isAdminSiteAccess;
$this->isAdminSiteAccess = (bool) $isAdminSiteAccess;
}

/**
Expand Down
11 changes: 6 additions & 5 deletions Helper/PathHelper.php
Expand Up @@ -2,10 +2,10 @@

namespace Netgen\Bundle\AdminUIBundle\Helper;

use eZ\Publish\API\Repository\Exceptions\UnauthorizedException;
use eZ\Publish\API\Repository\LocationService;
use eZ\Publish\Core\Helper\TranslationHelper;
use Symfony\Component\Routing\RouterInterface;
use eZ\Publish\API\Repository\Exceptions\UnauthorizedException;

class PathHelper
{
Expand Down Expand Up @@ -53,7 +53,7 @@ public function __construct(
*/
public function setRootLocationId($rootLocationId)
{
$this->rootLocationId = $rootLocationId;
$this->rootLocationId = (int) $rootLocationId;
}

/**
Expand All @@ -67,15 +67,16 @@ public function getPath($locationId)
{
$pathArray = array();

$path = $this->locationService->loadLocation($locationId)->path;
$startingLocation = $this->locationService->loadLocation($locationId);
$path = $startingLocation->path;

// Shift of location "1" from path as it is not
// a fully valid location and not readable by most users
array_shift($path);

$rootLocationFound = false;
foreach ($path as $index => $pathItem) {
if ($pathItem == $this->rootLocationId) {
if ((int) $pathItem === $this->rootLocationId) {
$rootLocationFound = true;
}

Expand All @@ -93,7 +94,7 @@ public function getPath($locationId)
'text' => $this->translationHelper->getTranslatedContentNameByContentInfo(
$location->contentInfo
),
'url' => $location->id != $locationId ?
'url' => $location->id !== $startingLocation->id ?
$this->router->generate($location) :
false,
'locationId' => $location->id,
Expand Down
2 changes: 1 addition & 1 deletion Installer/Generator/ConfigurationGenerator.php
Expand Up @@ -4,8 +4,8 @@

use eZ\Publish\API\Repository\Values\Content\Language;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Yaml\Yaml;
Expand Down
2 changes: 1 addition & 1 deletion Installer/Generator/Generator.php
Expand Up @@ -2,8 +2,8 @@

namespace Netgen\Bundle\AdminUIBundle\Installer\Generator;

use Twig_Loader_Filesystem;
use Twig_Environment;
use Twig_Loader_Filesystem;

abstract class Generator
{
Expand Down
2 changes: 1 addition & 1 deletion Installer/Generator/LegacySiteAccessGenerator.php
Expand Up @@ -4,8 +4,8 @@

use eZ\Publish\API\Repository\Values\Content\Language;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Symfony\Component\DependencyInjection\ContainerInterface;

Expand Down
3 changes: 2 additions & 1 deletion MenuPlugin/LegacyMenuPlugin.php
Expand Up @@ -53,7 +53,8 @@ public function matches(Request $request)
{
return in_array(
$request->attributes->get('_route'),
array(FallbackRouter::ROUTE_NAME, UrlAliasRouter::URL_ALIAS_ROUTE_NAME)
array(FallbackRouter::ROUTE_NAME, UrlAliasRouter::URL_ALIAS_ROUTE_NAME),
true
);
}
}
4 changes: 2 additions & 2 deletions NetgenAdminUIBundle.php
Expand Up @@ -2,9 +2,9 @@

namespace Netgen\Bundle\AdminUIBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Netgen\Bundle\AdminUIBundle\DependencyInjection\CompilerPass\MenuPluginRegistryPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;

class NetgenAdminUIBundle extends Bundle
{
Expand Down
4 changes: 2 additions & 2 deletions Templating/Twig/Extension/NetgenAdminUIExtension.php
Expand Up @@ -2,11 +2,11 @@

namespace Netgen\Bundle\AdminUIBundle\Templating\Twig\Extension;

use Closure;
use eZPreferences;
use Netgen\Bundle\AdminUIBundle\Helper\PathHelper;
use Twig_Extension;
use Twig_SimpleFunction;
use eZPreferences;
use Closure;

class NetgenAdminUIExtension extends Twig_Extension
{
Expand Down

0 comments on commit e832c39

Please sign in to comment.