Skip to content

Commit

Permalink
Remove superflous parameter from __invoke methods
Browse files Browse the repository at this point in the history
  • Loading branch information
loco8878 committed Sep 16, 2024
1 parent f3995af commit bf3a7c0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
4 changes: 1 addition & 3 deletions src/Bridge/Laminas/SlugifyService.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@ class SlugifyService
{
/**
* @param ContainerInterface $container
* @param $requestedName
* @param array|null $options
*
* @return Slugify
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null): Slugify
public function __invoke(ContainerInterface $container): Slugify
{
$config = $container->get('Config');

Expand Down
4 changes: 1 addition & 3 deletions src/Bridge/Laminas/SlugifyViewHelperFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@ class SlugifyViewHelperFactory

/**
* @param ContainerInterface $container
* @param $requestedName
* @param array|null $options
*
* @return SlugifyViewHelper
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null): SlugifyViewHelper
public function __invoke(ContainerInterface $container): SlugifyViewHelper
{
$slugify = $container->get('Cocur\Slugify\Slugify');

Expand Down
11 changes: 8 additions & 3 deletions tests/Bridge/Laminas/SlugifyServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protected function setUp(): void
public function testInvokeWithoutCustomConfig()
{
$sm = $this->createServiceManagerMock();
$slugify = call_user_func($this->slugifyService, $sm, 'slugify');
$slugify = call_user_func($this->slugifyService, $sm);
$this->assertInstanceOf('Cocur\Slugify\Slugify', $slugify);

// Make sure reg exp is default one
Expand All @@ -51,7 +51,7 @@ public function testInvokeWithCustomConfig()
'options' => ['regexp' => '/([^a-z0-9.]|-)+/']
]
]);
$slugify = call_user_func($this->slugifyService, $sm, 'slugify');
$slugify = call_user_func($this->slugifyService, $sm);
$this->assertInstanceOf('Cocur\Slugify\Slugify', $slugify);

// Make sure regexp is the one provided and dots are kept
Expand All @@ -60,7 +60,12 @@ public function testInvokeWithCustomConfig()
$this->assertSame($expected, $slugify->slugify($actual));
}

protected function createServiceManagerMock(array $config = [])
/**
* @param array $config
*
* @return ServiceManager
*/
protected function createServiceManagerMock(array $config = []): ServiceManager
{
$sm = new ServiceManager($config);
$sm->setService('Config', $config);
Expand Down
3 changes: 1 addition & 2 deletions tests/Bridge/Laminas/SlugifyViewHelperFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
use Cocur\Slugify\Bridge\Laminas\SlugifyViewHelperFactory;
use Cocur\Slugify\Slugify;
use Laminas\ServiceManager\ServiceManager;
use Laminas\View\HelperPluginManager;
use Mockery\Adapter\Phpunit\MockeryTestCase;

/**
Expand Down Expand Up @@ -33,7 +32,7 @@ public function testCreateService()
$sm = new ServiceManager();
$sm->setService('Cocur\Slugify\Slugify', new Slugify());

$viewHelper = call_user_func($this->factory, $sm, 'slugify');
$viewHelper = call_user_func($this->factory, $sm);
$this->assertInstanceOf('Cocur\Slugify\Bridge\Laminas\SlugifyViewHelper', $viewHelper);
}
}

0 comments on commit bf3a7c0

Please sign in to comment.