From 84820262efa77be3efd11adf3eb6c79195d18f24 Mon Sep 17 00:00:00 2001 From: Andreas Schempp Date: Wed, 14 Aug 2024 12:43:11 +0200 Subject: [PATCH] Code Quality --- .github/FUNDING.yml | 2 ++ .github/workflows/ci.yml | 11 +++++++++++ LICENSE | 2 +- src/Annotation/ServiceTag.php | 15 +++++++-------- src/Annotation/ServiceTagInterface.php | 10 +++------- .../Compiler/ServiceAnnotationPass.php | 16 ++++++++-------- src/Terminal42ServiceAnnotationBundle.php | 7 ------- 7 files changed, 32 insertions(+), 31 deletions(-) create mode 100644 .github/FUNDING.yml create mode 100644 .github/workflows/ci.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..0390455 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: terminal42 +ko_fi: terminal42 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ce7790d --- /dev/null +++ b/.github/workflows/ci.yml @@ -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' diff --git a/LICENSE b/LICENSE index 5356e24..d6aacdb 100644 --- a/LICENSE +++ b/LICENSE @@ -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 diff --git a/src/Annotation/ServiceTag.php b/src/Annotation/ServiceTag.php index 2c7f361..1c72d7f 100644 --- a/src/Annotation/ServiceTag.php +++ b/src/Annotation/ServiceTag.php @@ -2,13 +2,6 @@ declare(strict_types=1); -/* - * @copyright Copyright (c) 2020, terminal42 gmbh - * @author terminal42 gmbh - * @license MIT - * @link http://github.com/terminal42/service-annotation-bundle - */ - namespace Terminal42\ServiceAnnotationBundle\Annotation; use Doctrine\Common\Annotations\Annotation\Attribute; @@ -32,10 +25,13 @@ class ServiceTag implements ServiceTagInterface protected $name; /** - * @var array + * @var array */ protected $attributes = []; + /** + * @param array $data + */ public function __construct(array $data) { $this->name = $data['value']; @@ -50,6 +46,9 @@ public function getName(): string return $this->name; } + /** + * @return array + */ public function getAttributes(): array { return $this->attributes; diff --git a/src/Annotation/ServiceTagInterface.php b/src/Annotation/ServiceTagInterface.php index 7c160e9..a15b836 100644 --- a/src/Annotation/ServiceTagInterface.php +++ b/src/Annotation/ServiceTagInterface.php @@ -2,18 +2,14 @@ declare(strict_types=1); -/* - * @copyright Copyright (c) 2020, terminal42 gmbh - * @author terminal42 gmbh - * @license MIT - * @link http://github.com/terminal42/service-annotation-bundle - */ - namespace Terminal42\ServiceAnnotationBundle\Annotation; interface ServiceTagInterface { public function getName(): string; + /** + * @return array + */ public function getAttributes(): array; } diff --git a/src/DependencyInjection/Compiler/ServiceAnnotationPass.php b/src/DependencyInjection/Compiler/ServiceAnnotationPass.php index 472aefb..f0c322e 100644 --- a/src/DependencyInjection/Compiler/ServiceAnnotationPass.php +++ b/src/DependencyInjection/Compiler/ServiceAnnotationPass.php @@ -2,13 +2,6 @@ declare(strict_types=1); -/* - * @copyright Copyright (c) 2020, terminal42 gmbh - * @author terminal42 gmbh - * @license MIT - * @link http://github.com/terminal42/service-annotation-bundle - */ - namespace Terminal42\ServiceAnnotationBundle\DependencyInjection\Compiler; use Doctrine\Common\Annotations\AnnotationException; @@ -16,6 +9,7 @@ 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; @@ -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()) { @@ -58,6 +52,9 @@ public function process(ContainerBuilder $container): void } } + /** + * @param \ReflectionClass<\stdClass> $reflection + */ private function parseClassAnnotations(\ReflectionClass $reflection, Definition $definition): void { try { @@ -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) { diff --git a/src/Terminal42ServiceAnnotationBundle.php b/src/Terminal42ServiceAnnotationBundle.php index 5341213..ded8506 100644 --- a/src/Terminal42ServiceAnnotationBundle.php +++ b/src/Terminal42ServiceAnnotationBundle.php @@ -2,13 +2,6 @@ declare(strict_types=1); -/* - * @copyright Copyright (c) 2020, terminal42 gmbh - * @author terminal42 gmbh - * @license MIT - * @link http://github.com/terminal42/service-annotation-bundle - */ - namespace Terminal42\ServiceAnnotationBundle; use Symfony\Component\DependencyInjection\Compiler\PassConfig;