Skip to content

Commit

Permalink
🐛 FIX: github actions
Browse files Browse the repository at this point in the history
🐛 FIX: github actions
  • Loading branch information
barbuslex authored Oct 15, 2024
2 parents af39c54 + 45923c7 commit 116cff8
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 34 deletions.
3 changes: 2 additions & 1 deletion .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
'@Symfony' => true,
'@Symfony:risky' => true,
'protected_to_private' => false,
'nullable_type_declaration_for_default_null_value' => ['use_nullable_type_declaration' => false],
'nullable_type_declaration_for_default_null_value' => false,
'get_class_to_class_keyword' => false,
])
->setRiskyAllowed(true)
->setFinder(
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Getting Started With BreadcrumbTrailBundle
Getting Started With BreadcrumbTrailBundle
==========================================

This bundle provides a breadcrumb trail service also known as breadcrumbs or Fil d'Ariane.
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
"psr-4": { "APY\\BreadcrumbTrailBundle\\": "src/" }
},
"require-dev": {
"symfony/phpunit-bridge": "^5.0|^6.0",
"symfony/phpunit-bridge": "^5.0|^6.0|^7.0",
"nyholm/symfony-bundle-test": "^v2.0|^v3.0",
"matthiasnoback/symfony-dependency-injection-test": "^4.0",
"doctrine/doctrine-bundle": "^v1.0|^v2.0",
"doctrine/annotations": "^2.0",
"symfony/twig-bundle": "^3.4|^4.0|^5.0|^6.0"
"doctrine/annotations": "^1.8|^2.0",
"symfony/twig-bundle": "^4.0|^5.0|^6.0|^7.0"
},
"autoload-dev": {
"psr-4": { "APY\\BreadcrumbTrailBundle\\": "tests/" }
Expand Down
21 changes: 7 additions & 14 deletions src/Annotation/Breadcrumb.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ class Breadcrumb
/**
* @var string Title of the breadcrumb
*/
private $title = null;
private $title;

/**
* @var string The name of the route
*/
private $routeName = null;
private $routeName;

/**
* @var mixed An array of parameters for the route
Expand All @@ -45,7 +45,7 @@ class Breadcrumb
/**
* @var string Template of the breadcrumb trail
*/
private $template = null;
private $template;

/**
* @var array with additional attributes for the breadcrumb
Expand All @@ -61,15 +61,8 @@ class Breadcrumb
* @param ?string $template
* @param array $attributes
*/
public function __construct(
$title = null,
$routeName = null,
$routeParameters = null,
$routeAbsolute = null,
$position = null,
$template = null,
$attributes = null
) {
public function __construct($title = null, $routeName = null, $routeParameters = null, $routeAbsolute = null, $position = null, $template = null, $attributes = null)
{
$data = [];

if (\is_string($title)) {
Expand Down Expand Up @@ -101,7 +94,7 @@ public function __construct(
foreach ($data['route'] as $key => $value) {
$method = 'setRoute'.$key;
if (!method_exists($this, $method)) {
throw new \BadMethodCallException(sprintf("Unknown property '%s' for the 'route' parameter on annotation '%s'.", $key, static::class));
throw new \BadMethodCallException(\sprintf("Unknown property '%s' for the 'route' parameter on annotation '%s'.", $key, static::class));
}
$this->$method($value);
}
Expand All @@ -120,7 +113,7 @@ public function __construct(

$method = 'set'.$key;
if (!method_exists($this, $method)) {
throw new \BadMethodCallException(sprintf("Unknown property '%s' on annotation '%s'.", $key, static::class));
throw new \BadMethodCallException(\sprintf("Unknown property '%s' on annotation '%s'.", $key, static::class));
}
$this->$method($value);
}
Expand Down
12 changes: 3 additions & 9 deletions src/BreadcrumbTrail/Trail.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function getTemplate()
*
* @return self
*
*@throws \InvalidArgumentException
* @throws \InvalidArgumentException
* @throws \RuntimeException
*/
public function add($breadcrumbOrTitle, $routeName = null, $routeParameters = [], $routeAbsolute = true, $position = 0, $attributes = [])
Expand Down Expand Up @@ -185,17 +185,11 @@ public function reset()
return $this;
}

/**
* {@inheritDoc}
*/
public function count(): int
{
return $this->breadcrumbs->count();
}

/**
* {@inheritDoc}
*/
public function getIterator(): \Traversable
{
$this->breadcrumbs->rewind();
Expand Down Expand Up @@ -246,7 +240,7 @@ private function retrieveChildObject($object, $function, $varName, array $functi
return \call_user_func([$object, $fullFunctionName]);
}

throw new \RuntimeException(sprintf('"%s" is not callable.', implode('.', array_merge([$varName], $functions))));
throw new \RuntimeException(\sprintf('"%s" is not callable.', implode('.', array_merge([$varName], $functions))));
}

/**
Expand All @@ -263,6 +257,6 @@ private function retrieveObjectValue($object, $function, $parameters, $varName,
return \call_user_func_array([$object, $fullFunctionName], $parameters);
}

throw new \RuntimeException(sprintf('"%s" is not callable.', implode('.', array_merge([$varName], $functions))));
throw new \RuntimeException(\sprintf('"%s" is not callable.', implode('.', array_merge([$varName], $functions))));
}
}
3 changes: 0 additions & 3 deletions src/DependencyInjection/APYBreadcrumbTrailExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@

class APYBreadcrumbTrailExtension extends Extension
{
/**
* {@inheritDoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
Expand Down
6 changes: 4 additions & 2 deletions src/EventListener/BreadcrumbListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,12 @@ public function onKernelController(KernelEvent $event)
}

if ($class->isAbstract()) {
throw new \InvalidArgumentException(sprintf('Annotations from class "%s" cannot be read as it is abstract.', $class));
throw new \InvalidArgumentException(\sprintf('Annotations from class "%s" cannot be read as it is abstract.', $class));
}

if (HttpKernelInterface::MAIN_REQUEST == $event->getRequestType()) {
$kernelRequest = \defined(HttpKernelInterface::class.'::MASTER_REQUEST') ? HttpKernelInterface::MASTER_REQUEST : HttpKernelInterface::MAIN_REQUEST;

if ($kernelRequest == $event->getRequestType()) {
$this->breadcrumbTrail->reset();

// Annotations from class
Expand Down
7 changes: 6 additions & 1 deletion tests/Twig/BreadcrumbTrailExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ protected static function createKernel(array $options = []): KernelInterface
*/
public function testTwigFunctionGetsRegistered()
{
$container = self::getContainer();
if (method_exists($this, 'getContainer')) {
$container = self::getContainer();
} else {
self::bootKernel();
$container = self::$container;
}

/** @var BreadcrumbTrailExtension $extension */
$extension = $container->get(BreadcrumbTrailExtension::class);
Expand Down

0 comments on commit 116cff8

Please sign in to comment.