Skip to content

Commit

Permalink
Revert "Add return type hints to resolve Symfony deprecation notices (#…
Browse files Browse the repository at this point in the history
…22)" (#23)

This reverts commit 1eafc1b.
  • Loading branch information
mpdude authored May 5, 2022
1 parent 1eafc1b commit 1f9ac67
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 14 deletions.
8 changes: 6 additions & 2 deletions src/Build/BuildContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,20 @@ public function __construct(array $params)

/**
* @param array<string, mixed> $params
*
* @return BuildContext
*/
public function change(array $params): self
public function change(array $params)
{
return new self(array_merge($this->params, $params));
}

/**
* @param string $name
*
* @return mixed|null
*/
public function get(string $name)
public function get($name)
{
return isset($this->params[$name]) ? $this->params[$name] : null;
}
Expand Down
3 changes: 0 additions & 3 deletions src/Build/BuildDirector.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,5 @@
*/
interface BuildDirector
{
/**
* @return void
*/
public function build(BuildContext $c, Tree $t, BuildDispatcher $d);
}
20 changes: 14 additions & 6 deletions src/Build/TreeFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class TreeFactory implements ServiceSubscriberInterface
/** @var ContainerInterface */
protected $container;

public static function getSubscribedServices(): array
public static function getSubscribedServices()
{
return [
BuildDispatcher::class,
Expand All @@ -64,14 +64,19 @@ public function __construct(
$this->stopwatch = $stopwatch;
}

public function debug(string $msg): void
public function debug($msg)
{
if ($this->logger) {
$this->logger->debug("$msg (PID ".getmypid().', microtime '.microtime().')');
}
}

protected function startTiming(string $sectionName): ?StopwatchEvent
/**
* @param $sectionName
*
* @return StopwatchEvent|null
*/
protected function startTiming($sectionName)
{
if ($this->stopwatch) {
return $this->stopwatch->start('webfactory/navigation-bundle: '.$sectionName);
Expand All @@ -80,14 +85,17 @@ protected function startTiming(string $sectionName): ?StopwatchEvent
return null;
}

protected function stopTiming(StopwatchEvent $watch = null): void
protected function stopTiming(StopwatchEvent $watch = null)
{
if ($watch) {
$watch->stop();
}
}

public function getTree(): Tree
/**
* @return Tree
*/
public function getTree()
{
if (!$this->_tree) {
$self = $this;
Expand Down Expand Up @@ -116,7 +124,7 @@ public function getTree(): Tree
return $this->_tree;
}

public function buildTreeCache(ConfigCacheInterface $cache): void
public function buildTreeCache(ConfigCacheInterface $cache)
{
$this->_tree = new Tree();
// Dynamic (runtime) lookup:
Expand Down
2 changes: 1 addition & 1 deletion src/Command/DumpTreeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
return 0;
}

private function dumpNode(Node $n, OutputInterface $output, $depth = 0): void
private function dumpNode(Node $n, OutputInterface $output, $depth = 0)
{
$first = true;

Expand Down
2 changes: 1 addition & 1 deletion src/Twig/NavigationExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function __construct(ContainerInterface $container)
$this->container = $container;
}

public function getFunctions(): array
public function getFunctions()
{
return [
new TwigFunction('navigation_tree', [$this, 'renderTree'], ['needs_environment' => true, 'is_safe' => ['html']]),
Expand Down
2 changes: 1 addition & 1 deletion src/WebfactoryNavigationBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class WebfactoryNavigationBundle extends Bundle
{
public function build(ContainerBuilder $container): void
public function build(ContainerBuilder $container)
{
$container->addCompilerPass(new BuildDirectorPass());
}
Expand Down

0 comments on commit 1f9ac67

Please sign in to comment.