Skip to content

Commit

Permalink
Code Quality
Browse files Browse the repository at this point in the history
  • Loading branch information
aschempp committed Aug 14, 2024
1 parent 2cb75fa commit 8482026
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 31 deletions.
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github: terminal42
ko_fi: terminal42
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: CI

on:
push: ~
pull_request: ~

permissions: read-all

jobs:
ci:
uses: 'terminal42/contao-build-tools/.github/workflows/build-tools.yml@main'
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2020 terminal42 gmbh
Copyright (c) 2024 terminal42 gmbh

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
15 changes: 7 additions & 8 deletions src/Annotation/ServiceTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@

declare(strict_types=1);

/*
* @copyright Copyright (c) 2020, terminal42 gmbh
* @author terminal42 gmbh <https://terminal42.ch>
* @license MIT
* @link http://github.com/terminal42/service-annotation-bundle
*/

namespace Terminal42\ServiceAnnotationBundle\Annotation;

use Doctrine\Common\Annotations\Annotation\Attribute;
Expand All @@ -32,10 +25,13 @@ class ServiceTag implements ServiceTagInterface
protected $name;

/**
* @var array
* @var array<string, string|int|float|bool>
*/
protected $attributes = [];

/**
* @param array<string, string|int|float|bool> $data
*/
public function __construct(array $data)
{
$this->name = $data['value'];
Expand All @@ -50,6 +46,9 @@ public function getName(): string
return $this->name;
}

/**
* @return array<string, string|int|float|bool>
*/
public function getAttributes(): array
{
return $this->attributes;
Expand Down
10 changes: 3 additions & 7 deletions src/Annotation/ServiceTagInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,14 @@

declare(strict_types=1);

/*
* @copyright Copyright (c) 2020, terminal42 gmbh
* @author terminal42 gmbh <https://terminal42.ch>
* @license MIT
* @link http://github.com/terminal42/service-annotation-bundle
*/

namespace Terminal42\ServiceAnnotationBundle\Annotation;

interface ServiceTagInterface
{
public function getName(): string;

/**
* @return array<string, string|int|float|bool>
*/
public function getAttributes(): array;
}
16 changes: 8 additions & 8 deletions src/DependencyInjection/Compiler/ServiceAnnotationPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,14 @@

declare(strict_types=1);

/*
* @copyright Copyright (c) 2020, terminal42 gmbh
* @author terminal42 gmbh <https://terminal42.ch>
* @license MIT
* @link http://github.com/terminal42/service-annotation-bundle
*/

namespace Terminal42\ServiceAnnotationBundle\DependencyInjection\Compiler;

use Doctrine\Common\Annotations\AnnotationException;
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Annotations\Reader;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Definition;
use Terminal42\ServiceAnnotationBundle\Annotation\ServiceTagInterface;

Expand All @@ -28,7 +22,7 @@ class ServiceAnnotationPass implements CompilerPassInterface

public function process(ContainerBuilder $container): void
{
$this->annotationReader = $container->get('annotation_reader', ContainerBuilder::NULL_ON_INVALID_REFERENCE) ?? new AnnotationReader();
$this->annotationReader = $container->get('annotation_reader', ContainerInterface::NULL_ON_INVALID_REFERENCE) ?? new AnnotationReader();

foreach ($container->getDefinitions() as $id => $definition) {
if ($definition->isAbstract() || $definition->isSynthetic()) {
Expand Down Expand Up @@ -58,6 +52,9 @@ public function process(ContainerBuilder $container): void
}
}

/**
* @param \ReflectionClass<\stdClass> $reflection
*/
private function parseClassAnnotations(\ReflectionClass $reflection, Definition $definition): void
{
try {
Expand All @@ -76,6 +73,9 @@ private function parseClassAnnotations(\ReflectionClass $reflection, Definition
}
}

/**
* @param \ReflectionClass<\stdClass> $reflection
*/
private function parseMethodAnnotations(\ReflectionClass $reflection, Definition $definition): void
{
foreach ($reflection->getMethods() as $method) {
Expand Down
7 changes: 0 additions & 7 deletions src/Terminal42ServiceAnnotationBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@

declare(strict_types=1);

/*
* @copyright Copyright (c) 2020, terminal42 gmbh
* @author terminal42 gmbh <https://terminal42.ch>
* @license MIT
* @link http://github.com/terminal42/service-annotation-bundle
*/

namespace Terminal42\ServiceAnnotationBundle;

use Symfony\Component\DependencyInjection\Compiler\PassConfig;
Expand Down

0 comments on commit 8482026

Please sign in to comment.