Skip to content

Commit

Permalink
Backport the removal of unused parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
acrobat committed Feb 18, 2018
1 parent 7a4619f commit 0b32063
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 31 deletions.
6 changes: 2 additions & 4 deletions src/Kunstmaan/AdminBundle/Helper/AdminRouteHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,12 @@ public function isAdminRoute($url)
/**
* Checks the current request if it's route is equal to SlugRouter::$SLUG_PREVIEW
*
* @param string $url
*
* @return boolean
*/
protected function matchesPreviewRoute($url)
protected function matchesPreviewRoute()
{
$routeName = $this->requestStack->getCurrentRequest()->get('_route');

return $routeName == SlugRouter::$SLUG_PREVIEW;
return $routeName === SlugRouter::$SLUG_PREVIEW;
}
}
1 change: 0 additions & 1 deletion src/Kunstmaan/AdminBundle/Resources/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ services:
class: '%kunstmaan_admin.toolbar.collector.bundle.class%'
arguments:
- '@kunstmaan_admin.versionchecker'
- '@logger'
- '@kunstmaan_admin.cache'
tags:
- { name: kunstmaan_admin.toolbar_collector, template: 'KunstmaanAdminBundle:Toolbar:bundles_version.html.twig', id: kuma_bundle_versions }
Expand Down
15 changes: 10 additions & 5 deletions src/Kunstmaan/AdminBundle/Toolbar/BundleVersionDataCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,21 @@ class BundleVersionDataCollector extends AbstractDataCollector
/** @var VersionChecker */
private $versionChecker;

/** @var Logger */
private $logger;

/** @var Cache */
private $cache;

public function __construct(VersionChecker $versionChecker, Logger $logger, Cache $cache)
public function __construct(VersionChecker $versionChecker, /*Logger $logger,*/ /* Cache */ $cache)
{
$this->versionChecker = $versionChecker;
$this->logger = $logger;

if (func_num_args() > 2) {
@trigger_error(sprintf('Passing the "logger" service as the second argument in "%s" is deprecated in KunstmaanAdminBundle 5.1 and will be removed in KunstmaanAdminBundle 6.0. Remove the "logger" argument from your service definition.', __METHOD__), E_USER_DEPRECATED);

$this->cache = func_get_arg(2);

return;
}

$this->cache = $cache;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Kunstmaan/ArticleBundle/Resources/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ parameters:
services:
kunstmaan_articlebundle.twig.extension:
class: 'Kunstmaan\ArticleBundle\Twig\ArticleTwigExtension'
arguments: ['@doctrine.orm.entity_manager', '@router', '@request_stack']
arguments: ['@doctrine.orm.entity_manager', '@router']
tags:
- { name: twig.extension }
14 changes: 6 additions & 8 deletions src/Kunstmaan/ArticleBundle/Twig/ArticleTwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,20 @@ class ArticleTwigExtension extends Twig_Extension
*/
private $router;

/**
* @var RequestStack
*/
private $requestStack;

/**
* ArticleTwigExtension constructor.
*
* @param EntityManagerInterface $em
* @param RouterInterface $router
* @param RequestStack $requestStack
*/
public function __construct(EntityManagerInterface $em, RouterInterface $router, RequestStack $requestStack) {
public function __construct(EntityManagerInterface $em, RouterInterface $router)
{
$this->em = $em;
$this->router = $router;
$this->requestStack = $requestStack;

if (func_num_args() > 2) {
@trigger_error(sprintf('Passing the "request_stack" service as the third argument in "%s" is deprecated in KunstmaanArticleBundle 5.1 and will be removed in KunstmaanArticleBundle 6.0. Remove the "request_stack" argument from your service definition.', __METHOD__), E_USER_DEPRECATED);
}
}

/**
Expand Down
23 changes: 13 additions & 10 deletions src/Kunstmaan/ConfigBundle/Controller/ConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,7 @@ class ConfigController
* @var array $configuration
*/
private $configuration;

/**
* @var ContainerInterface $container
*/
private $container;


/**
* @var FormFactoryInterface $formFactory
*/
Expand All @@ -73,16 +68,24 @@ public function __construct(
AuthorizationCheckerInterface $authorizationChecker,
EntityManagerInterface $em,
array $configuration,
ContainerInterface $container,
FormFactoryInterface $formFactory
/* ContainerInterface $container, */
/* FormFactoryInterface */ $formFactory
) {
$this->router = $router;
$this->templating = $templating;
$this->authorizationChecker = $authorizationChecker;
$this->em = $em;
$this->configuration = $configuration;
$this->container = $container;
$this->formFactory = $formFactory;

if (func_num_args() > 6) {
@trigger_error(sprintf('Passing the "container" as the sixth argument in "%s" is deprecated in KunstmaanConfigBundle 5.1 and will be removed in KunstmaanConfigBundle 6.0. Remove the "container" argument from your service definition.', __METHOD__), E_USER_DEPRECATED);

$this->formFactory = func_get_arg(6);

return;
}

$this->cache = $formFactory;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,9 @@ protected function doInteract()
));

$generator = $this->getGenerator();
$bundlePath = $this->bundle->getPath();
$this->entity = $this->assistant->askAndValidate(
'Article class name',
function ($name) use ($generator, $bundlePath) {
function ($name) use ($generator) {
// Check reserved words
if ($generator->isReservedKeyword($name)){
throw new \InvalidArgumentException(sprintf('"%s" is a reserved word', $name));
Expand Down

0 comments on commit 0b32063

Please sign in to comment.