Skip to content
This repository has been archived by the owner on Feb 24, 2023. It is now read-only.

Commit

Permalink
bumped deps, removed doctrine/common
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Apr 8, 2019
1 parent d25f0de commit 049d799
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 16 deletions.
13 changes: 11 additions & 2 deletions EventListener/ControllerListener.php
Expand Up @@ -12,11 +12,11 @@
namespace Sensio\Bundle\FrameworkExtraBundle\EventListener;

use Doctrine\Common\Annotations\Reader;
use Doctrine\Common\Persistence\Proxy;
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ConfigurationInterface;
use Doctrine\Common\Util\ClassUtils;

/**
* The ControllerListener class parses annotation blocks located in
Expand Down Expand Up @@ -53,7 +53,7 @@ public function onKernelController(FilterControllerEvent $event)
return;
}

$className = class_exists('Doctrine\Common\Util\ClassUtils') ? ClassUtils::getClass($controller[0]) : \get_class($controller[0]);
$className = $this->getRealClass(\get_class($controller[0]));
$object = new \ReflectionClass($className);
$method = $object->getMethod($controller[1]);

Expand Down Expand Up @@ -112,4 +112,13 @@ public static function getSubscribedEvents()
KernelEvents::CONTROLLER => 'onKernelController',
];
}

private static function getRealClass(string $class): string
{
if (false === $pos = strrpos($class, '\\'.Proxy::MARKER.'\\')) {
return $class;
}

return substr($class, $pos + Proxy::MARKER_LENGTH + 2);
}
}
13 changes: 11 additions & 2 deletions Templating/TemplateGuesser.php
Expand Up @@ -11,10 +11,10 @@

namespace Sensio\Bundle\FrameworkExtraBundle\Templating;

use Doctrine\Common\Persistence\Proxy;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\HttpFoundation\Request;
use Doctrine\Common\Util\ClassUtils;

/**
* The TemplateGuesser class handles the guessing of template name based on controller.
Expand Down Expand Up @@ -62,7 +62,7 @@ public function guessTemplateName($controller, Request $request)
throw new \InvalidArgumentException(sprintf('First argument of %s must be an array callable or an object defining the magic method __invoke. "%s" given.', __METHOD__, \gettype($controller)));
}

$className = class_exists('Doctrine\Common\Util\ClassUtils') ? ClassUtils::getClass($controller[0]) : \get_class($controller[0]);
$className = $this->getRealClass(\get_class($controller[0]));

$matchController = null;
foreach ($this->controllerPatterns as $pattern) {
Expand Down Expand Up @@ -113,4 +113,13 @@ private function getBundleForClass($class)
$reflectionClass = $reflectionClass->getParentClass();
} while ($reflectionClass);
}

private static function getRealClass(string $class): string
{
if (false === $pos = strrpos($class, '\\'.Proxy::MARKER.'\\')) {
return $class;
}

return substr($class, $pos + Proxy::MARKER_LENGTH + 2);
}
}
25 changes: 13 additions & 12 deletions composer.json
Expand Up @@ -12,23 +12,24 @@
],
"require": {
"php": ">=7.1.3",
"symfony/config": "^3.3|^4.0",
"symfony/framework-bundle": "^3.4|^4.0",
"symfony/dependency-injection": "^3.3|^4.0",
"symfony/http-kernel": "^3.3|^4.0",
"doctrine/common": "^2.2"
"symfony/config": "^3.4|^4.2",
"symfony/framework-bundle": "^3.4|^4.2",
"symfony/dependency-injection": "^3.4|^4.2",
"symfony/http-kernel": "^3.4|^4.2",
"doctrine/annotations": "^1.0",
"doctrine/persistence": "^1.0"
},
"require-dev": {
"symfony/expression-language": "^3.3|^4.0",
"symfony/finder": "^3.3|^4.0",
"symfony/expression-language": "^3.4|^4.2",
"symfony/finder": "^3.4|^4.2",
"symfony/psr-http-message-bridge": "^1.1",
"symfony/security-bundle": "^3.3|^4.0",
"symfony/yaml": "^3.3|^4.0",
"symfony/twig-bundle": "^3.3|^4.0",
"symfony/security-bundle": "^3.4|^4.2",
"symfony/yaml": "^3.4|^4.2",
"symfony/twig-bundle": "^3.4|^4.2",
"twig/twig": "~1.12|~2.0",
"symfony/browser-kit": "^3.3|^4.0",
"symfony/browser-kit": "^3.4|^4.2",
"symfony/phpunit-bridge": "^3.4.19|^4.1.8",
"symfony/dom-crawler": "^3.3|^4.0",
"symfony/dom-crawler": "^3.4|^4.2",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/orm": "^2.5",
"symfony/monolog-bundle": "^3.2",
Expand Down

0 comments on commit 049d799

Please sign in to comment.