Skip to content

Commit 9b384da

Browse files
committed
Add type hint, use ObjectManager
1 parent b96ccb1 commit 9b384da

File tree

7 files changed

+12
-32
lines changed

7 files changed

+12
-32
lines changed

spec/Manager/SettingsManagerSpec.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace spec\Sylius\Bundle\SettingsBundle\Manager;
1313

14-
use Doctrine\Persistence\ObjectRepository;
14+
use Doctrine\Persistence\ObjectManager;
1515
use PhpSpec\ObjectBehavior;
1616
use Sylius\Bundle\SettingsBundle\Resource\FactoryInterface;
1717
use Sylius\Bundle\SettingsBundle\Manager\SettingsManager;
@@ -27,7 +27,7 @@ final class SettingsManagerSpec extends ObjectBehavior
2727
function let(
2828
ServiceRegistryInterface $schemaRegistry,
2929
ServiceRegistryInterface $resolverRegistry,
30-
ObjectRepository $manager,
30+
ObjectManager $manager,
3131
FactoryInterface $settingsFactory,
3232
EventDispatcherInterface $eventDispatcher
3333
) {

src/Bundle/DependencyInjection/Configuration.php

-3
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ public function getConfigTreeBuilder()
4444
return $treeBuilder;
4545
}
4646

47-
/**
48-
* @param ArrayNodeDefinition $node
49-
*/
5047
private function addClassesSection(ArrayNodeDefinition $node)
5148
{
5249
$node

src/Bundle/Manager/SettingsManager.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Sylius\Bundle\SettingsBundle\Manager;
1313

14-
use Doctrine\Persistence\ObjectRepository;
14+
use Doctrine\Persistence\ObjectManager;
1515
use Sylius\Bundle\SettingsBundle\Event\SettingsEvent;
1616
use Sylius\Bundle\SettingsBundle\Model\SettingsInterface;
1717
use Sylius\Bundle\SettingsBundle\Registry\ServiceRegistryInterface;
@@ -38,7 +38,7 @@ final class SettingsManager implements SettingsManagerInterface
3838
private $resolverRegistry;
3939

4040
/**
41-
* @var ObjectRepository
41+
* @var ObjectManager
4242
*/
4343
private $manager;
4444

@@ -55,7 +55,7 @@ final class SettingsManager implements SettingsManagerInterface
5555
public function __construct(
5656
ServiceRegistryInterface $schemaRegistry,
5757
ServiceRegistryInterface $resolverRegistry,
58-
ObjectRepository $manager,
58+
ObjectManager $manager,
5959
FactoryInterface $settingsFactory,
6060
EventDispatcherInterface $eventDispatcher
6161
) {
@@ -69,7 +69,7 @@ public function __construct(
6969
/**
7070
* {@inheritdoc}
7171
*/
72-
public function load(string $schemaAlias, string $namespace = null, bool $ignoreUnknown = true)
72+
public function load(string $schemaAlias, string $namespace = null, bool $ignoreUnknown = true): SettingsInterface
7373
{
7474
/** @var SchemaInterface $schema */
7575
$schema = $this->schemaRegistry->get($schemaAlias);

src/Bundle/Manager/SettingsManagerInterface.php

+2-10
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,11 @@
1515

1616
/**
1717
* @author Paweł Jędrzejewski <[email protected]>
18+
* @author Julio Montoya
1819
*/
1920
interface SettingsManagerInterface
2021
{
21-
/**
22-
* @param string $schemaAlias
23-
* @param string|null $namespace
24-
*
25-
* @return SettingsInterface
26-
*/
27-
public function load(string $schemaAlias, string $namespace = null);
22+
public function load(string $schemaAlias, string $namespace = null, bool $ignoreUnknown = true): SettingsInterface;
2823

29-
/**
30-
* @param SettingsInterface $settings
31-
*/
3224
public function save(SettingsInterface $settings);
3325
}

src/Bundle/Schema/SchemaInterface.php

-6
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,7 @@
1818
*/
1919
interface SchemaInterface
2020
{
21-
/**
22-
* @param SettingsBuilderInterface $builder
23-
*/
2421
public function buildSettings(AbstractSettingsBuilder $builder);
2522

26-
/**
27-
* @param FormBuilderInterface $builder
28-
*/
2923
public function buildForm(FormBuilderInterface $builder);
3024
}

src/Bundle/Templating/Helper/SettingsHelper.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Sylius\Bundle\SettingsBundle\Templating\Helper;
1313

1414
use Sylius\Bundle\SettingsBundle\Manager\SettingsManagerInterface;
15+
use Sylius\Bundle\SettingsBundle\Model\SettingsInterface;
1516
use Symfony\Component\Templating\Helper\Helper;
1617

1718
final class SettingsHelper extends Helper implements SettingsHelperInterface
@@ -29,10 +30,7 @@ public function __construct(SettingsManagerInterface $settingsManager)
2930
$this->settingsManager = $settingsManager;
3031
}
3132

32-
/**
33-
* {@inheritdoc}
34-
*/
35-
public function getSettings($schemaAlias)
33+
public function getSettings($schemaAlias): SettingsInterface
3634
{
3735
return $this->settingsManager->load($schemaAlias);
3836
}

src/Bundle/Templating/Helper/SettingsHelperInterface.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Sylius\Bundle\SettingsBundle\Templating\Helper;
1313

14+
use Sylius\Bundle\SettingsBundle\Model\SettingsInterface;
1415
use Symfony\Component\Templating\Helper\HelperInterface;
1516

1617
/**
@@ -20,8 +21,6 @@ interface SettingsHelperInterface extends HelperInterface
2021
{
2122
/**
2223
* @param string $schemaAlias
23-
*
24-
* @return array
2524
*/
26-
public function getSettings($schemaAlias);
25+
public function getSettings($schemaAlias): SettingsInterface;
2726
}

0 commit comments

Comments
 (0)