Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ServiceConfiguration attribute is no longer used #10

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"require": {
"php": ">= 8.2",
"composer-runtime-api": "^2.2",
"archict/brick": "^0.1.0",
"archict/brick": "^0",
"composer/class-map-generator": "^1.1",
"azjezz/psl": "^2.9",
"cuyz/valinor": "^1.12",
Expand Down
16 changes: 8 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 2 additions & 17 deletions include/Bricks/LoadBricks.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
namespace Archict\Core\Bricks;

use Archict\Brick\Service;
use Archict\Brick\ServiceConfiguration;
use Archict\Core\Services\ServiceRepresentation;
use Composer\ClassMapGenerator\ClassMapGenerator;
use Composer\InstalledVersions;
Expand All @@ -41,7 +40,6 @@
final readonly class LoadBricks implements BricksLoader
{
/**
* @throws NotAServiceConfigurationException
* @throws ReflectionException
*/
public function loadInstalledBricks(): array
Expand Down Expand Up @@ -70,7 +68,6 @@ public function loadInstalledBricks(): array

/**
* @return ServiceRepresentation[]
* @throws NotAServiceConfigurationException
* @throws ReflectionException
*/
private function loadServicesOfPackage(string $package_path): array
Expand All @@ -86,20 +83,8 @@ private function loadServicesOfPackage(string $package_path): array
continue;
}

$service_attribute = $attributes[0]->newInstance();
$configuration_attribute = null;
if ($service_attribute->configuration_classname !== null) {
$configuration_reflection = new ReflectionClass($service_attribute->configuration_classname);

$configuration_attributes = $configuration_reflection->getAttributes(ServiceConfiguration::class);
if (empty($configuration_attributes)) {
throw new NotAServiceConfigurationException($service_attribute->configuration_classname, $reflection->name);
}

$configuration_attribute = $configuration_attributes[0]->newInstance();
}

$result[] = new ServiceRepresentation($reflection, $service_attribute, $package_path);
$service_attribute = $attributes[0]->newInstance();
$result[] = new ServiceRepresentation($reflection, $service_attribute, $package_path);
}

return $result;
Expand Down
38 changes: 0 additions & 38 deletions include/Bricks/NotAServiceConfigurationException.php

This file was deleted.

3 changes: 0 additions & 3 deletions tests/unit/Fixtures/brick1/Service1Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@

namespace Archict\Core\Fixtures\brick1;

use Archict\Brick\ServiceConfiguration;

#[ServiceConfiguration]
final readonly class Service1Configuration
{
public function __construct(
Expand Down