Skip to content

Commit

Permalink
Fix symfony deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
core23 committed Dec 4, 2021
1 parent 2ea2acb commit fddf614
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/Bridge/Symfony/Bundle/NucleosDoctrineBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@

final class NucleosDoctrineBundle extends Bundle
{
public function getPath()
public function getPath(): string
{
return __DIR__.'/..';
}

protected function getContainerExtensionClass()
protected function getContainerExtensionClass(): string
{
return NucleosDoctrineExtension::class;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Bridge/Symfony/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

final class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder()
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder('nucleos_doctrine');

Expand Down
2 changes: 1 addition & 1 deletion src/EventListener/ORM/ConfirmableListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

final class ConfirmableListener extends AbstractListener
{
public function getSubscribedEvents()
public function getSubscribedEvents(): array
{
return [
Events::loadClassMetadata,
Expand Down
2 changes: 1 addition & 1 deletion src/EventListener/ORM/DeletableListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

final class DeletableListener extends AbstractListener
{
public function getSubscribedEvents()
public function getSubscribedEvents(): array
{
return [
Events::loadClassMetadata,
Expand Down
2 changes: 1 addition & 1 deletion src/EventListener/ORM/LifecycleDateListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

final class LifecycleDateListener extends AbstractListener
{
public function getSubscribedEvents()
public function getSubscribedEvents(): array
{
return [
Events::prePersist,
Expand Down
2 changes: 1 addition & 1 deletion src/EventListener/ORM/SortableListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function __construct(PropertyAccessor $propertyAccessor = null)
$this->propertyAccessor = $propertyAccessor;
}

public function getSubscribedEvents()
public function getSubscribedEvents(): array
{
return [
Events::prePersist,
Expand Down
2 changes: 1 addition & 1 deletion src/EventListener/ORM/UniqueActiveListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function __construct(PropertyAccessor $propertyAccessor = null)
$this->propertyAccessor = $propertyAccessor;
}

public function getSubscribedEvents()
public function getSubscribedEvents(): array
{
return [
Events::prePersist,
Expand Down
26 changes: 20 additions & 6 deletions tests/Bridge/Symfony/App/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
use Nucleos\Doctrine\Tests\Bridge\Symfony\App\Controller\SampleTestController;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Routing\RouteCollectionBuilder;
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;

final class AppKernel extends Kernel
{
Expand All @@ -30,7 +29,7 @@ public function __construct()
parent::__construct('test', false);
}

public function registerBundles()
public function registerBundles(): iterable
{
yield new FrameworkBundle();
yield new DoctrineBundle();
Expand All @@ -52,13 +51,28 @@ public function getProjectDir(): string
return __DIR__;
}

protected function configureRoutes(RouteCollectionBuilder $routes): void
protected function configureRoutes($routes): void
{
if ($routes instanceof RoutingConfigurator) {
$routes
->add('sample', '/test')
->controller(SampleTestController::class)
;

return;
}

$routes->add('/test', SampleTestController::class);
}

protected function configureContainer(ContainerBuilder $containerBuilder, LoaderInterface $loader): void
protected function configureContainer($container, $loader): void
{
if ($container instanceof ContainerConfigurator) {
$container->import(__DIR__.'/config/config.yaml');

return;
}

$loader->load(__DIR__.'/config/config.yaml');
}

Expand Down

0 comments on commit fddf614

Please sign in to comment.