Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- The asset classes that left for the package no longer reach for Laravel: `AssetEnqueuer` receives the hook services, the Vite factory, the runtime and a PSR-3 logger instead of resolving them from the container, `AssetFile` is resolved through a resolver the provider sets (`AssetFile::resolveUsing()`), and `AssetManager`, `MissingBuilds` and `MissingBuildNotice` take their public directory, logger and project root as arguments. The rendered HTML of a Pollora site is unchanged, in build and while Vite runs hot
- An `AssetEnqueuer` destroyed after its application, as in a test, no longer throws while it reports a failure of its deferred enqueue
- The typed meta classes that will leave for `pollora/meta` no longer reach for Laravel: `MetaUiDrivers` and `MetaAccessor::extend()` take a PSR-11 `ContainerInterface` (the Laravel container is one, a driver closure receives the same object), and the key of a data object's property is derived by `Pollora\Attributes\Support\Naming` instead of `Str::snake()`. What needs Laravel moved to `Pollora\Meta\Infrastructure\Laravel`: `MetaServiceProvider`, `LaravelMetaValidator`, `TypedMetaCheck`, `MetaListCommand` and `MetaAuditCommand`. The rendered pages, the REST responses and the output of the `pollora:meta:*`, `pollora:binding:list`, `pollora:roles:*` and `pollora:doctor` commands of a Pollora site are unchanged

## [v13.36.0](https://github.com/Pollora/framework/compare/v13.35.6...v13.36.0) - 2026-10-14

Expand Down
4 changes: 2 additions & 2 deletions src/Meta/Application/Services/MetaAccessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Pollora\Meta\Application\Services;

use Closure;
use Illuminate\Contracts\Container\Container;
use LogicException;
use Pollora\Meta\Domain\Contracts\MetaStoreInterface;
use Pollora\Meta\Domain\Contracts\MetaUiDriver;
Expand All @@ -16,6 +15,7 @@
use Pollora\Meta\Domain\Models\MetaRecord;
use Pollora\Meta\Domain\Models\MetaSchema;
use Pollora\Meta\Domain\Services\MetaValueCaster;
use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;

/**
Expand Down Expand Up @@ -82,7 +82,7 @@ public function schemaFor(MetaObjectType|string $objectType, ?string $subtype =
* Registers a UI driver, from a package's service provider:
* `Meta::extend('acf', AcfDriver::class)`.
*
* @param class-string<MetaUiDriver>|Closure(Container): MetaUiDriver $driver
* @param class-string<MetaUiDriver>|Closure(ContainerInterface): MetaUiDriver $driver
*/
public function extend(string $name, string|Closure $driver): void
{
Expand Down
4 changes: 2 additions & 2 deletions src/Meta/Application/Services/MetaSchemaBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

use BackedEnum;
use DateTimeInterface;
use Illuminate\Support\Str;
use Pollora\Attributes\CommentMeta;
use Pollora\Attributes\Meta;
use Pollora\Attributes\PostMeta;
use Pollora\Attributes\PostType;
use Pollora\Attributes\Support\Naming;
use Pollora\Attributes\Taxonomy;
use Pollora\Attributes\TermMeta;
use Pollora\Attributes\UserMeta;
Expand Down Expand Up @@ -310,7 +310,7 @@ private function buildProperties(string $class, string $name, string $objectClas

$properties[$propertyName] = new MetaDefinition(
property: $propertyName,
key: Str::snake($propertyName),
key: Naming::snake($propertyName),
valueType: $valueType,
valueClass: $valueClass,
nullable: $type->allowsNull(),
Expand Down
10 changes: 5 additions & 5 deletions src/Meta/Application/Services/MetaUiDrivers.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@
namespace Pollora\Meta\Application\Services;

use Closure;
use Illuminate\Contracts\Container\Container;
use InvalidArgumentException;
use Pollora\Meta\Domain\Contracts\MetaUiDriver;
use Pollora\Meta\Domain\Models\MetaSchema;
use Psr\Container\ContainerInterface;

/**
* The UI drivers packages register, and the hand-off of the schemas to the one
* the project picks.
*/
final class MetaUiDrivers
{
/** @var array<string, class-string<MetaUiDriver>|Closure(Container): MetaUiDriver> */
/** @var array<string, class-string<MetaUiDriver>|Closure(ContainerInterface): MetaUiDriver> */
private array $drivers = [];

public function __construct(private readonly Container $container) {}
public function __construct(private readonly ContainerInterface $container) {}

/**
* @param class-string<MetaUiDriver>|Closure(Container): MetaUiDriver $driver
* @param class-string<MetaUiDriver>|Closure(ContainerInterface): MetaUiDriver $driver
*/
public function extend(string $name, string|Closure $driver): void
{
Expand All @@ -40,7 +40,7 @@ public function has(string $name): bool
public function driver(string $name): MetaUiDriver
{
$driver = $this->drivers[$name] ?? throw new InvalidArgumentException(sprintf('No meta UI driver is named "%s"; its package registers it with Meta::extend().', $name));
$instance = $driver instanceof Closure ? $driver($this->container) : $this->container->make($driver);
$instance = $driver instanceof Closure ? $driver($this->container) : $this->container->get($driver);

return $instance instanceof MetaUiDriver
? $instance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Pollora\Meta\UI\Console;
namespace Pollora\Meta\Infrastructure\Laravel\Console;

use Illuminate\Console\Attributes\Description;
use Illuminate\Console\Attributes\Signature;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Pollora\Meta\UI\Console;
namespace Pollora\Meta\Infrastructure\Laravel\Console;

use BackedEnum;
use Illuminate\Console\Attributes\Description;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Pollora\Meta\Infrastructure\Services;
namespace Pollora\Meta\Infrastructure\Laravel;

use BackedEnum;
use DateTimeInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Pollora\Meta\Infrastructure\Providers;
namespace Pollora\Meta\Infrastructure\Laravel;

use Illuminate\Contracts\Foundation\Application;
use Illuminate\Support\ServiceProvider;
Expand All @@ -24,11 +24,9 @@
use Pollora\Meta\Infrastructure\Adapters\WordPressMetaRegistry;
use Pollora\Meta\Infrastructure\Adapters\WordPressMetaStore;
use Pollora\Meta\Infrastructure\Adapters\WordPressRestMetaValidation;
use Pollora\Meta\Infrastructure\Checks\TypedMetaCheck;
use Pollora\Meta\Infrastructure\Services\LaravelMetaValidator;
use Pollora\Meta\Infrastructure\Laravel\Console\MetaAuditCommand;
use Pollora\Meta\Infrastructure\Laravel\Console\MetaListCommand;
use Pollora\Meta\Infrastructure\Services\MetaDiscovery;
use Pollora\Meta\UI\Console\MetaAuditCommand;
use Pollora\Meta\UI\Console\MetaListCommand;
use Psr\Log\LoggerInterface;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Pollora\Meta\Infrastructure\Checks;
namespace Pollora\Meta\Infrastructure\Laravel;

use Pollora\Doctor\Domain\Contracts\CheckInterface;
use Pollora\Doctor\Domain\Enums\RunContext;
Expand Down
32 changes: 32 additions & 0 deletions src/Meta/Testing/InstantiatingContainer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types=1);

namespace Pollora\Meta\Testing;

use Psr\Container\ContainerInterface;
use Psr\Container\NotFoundExceptionInterface;
use RuntimeException;

/**
* The container MetaUiDriverConformance gives to the drivers it builds: it
* makes a class with no constructor argument, and has no other service.
*
* @internal
*/
final class InstantiatingContainer implements ContainerInterface
{
public function get(string $id): mixed
{
if (! class_exists($id)) {
throw new class(sprintf('No entry "%s".', $id)) extends RuntimeException implements NotFoundExceptionInterface {};
}

return new $id;
}

public function has(string $id): bool
{
return class_exists($id);
}
}
3 changes: 1 addition & 2 deletions src/Meta/Testing/MetaUiDriverConformance.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Pollora\Meta\Testing;

use Illuminate\Container\Container;
use Pollora\Meta\Application\Services\MetaSchemaBuilder;
use Pollora\Meta\Application\Services\MetaUiDrivers;
use Pollora\Meta\Domain\Contracts\MetaUiDriver;
Expand Down Expand Up @@ -57,7 +56,7 @@ public static function check(MetaUiDriver $driver): array
}

try {
(new MetaUiDrivers(new Container))->build($driver, [$schema]);
(new MetaUiDrivers(new InstantiatingContainer))->build($driver, [$schema]);
} catch (Throwable $throwable) {
$violations[] = sprintf('register() throws for the meta it supports: %s', $throwable->getMessage());
}
Expand Down
2 changes: 1 addition & 1 deletion src/Providers/PolloraServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
use Pollora\Logging\Infrastructure\Providers\LoggingServiceProvider;
use Pollora\Login\Infrastructure\Providers\LoginServiceProvider;
use Pollora\Mail\WordPressMailServiceProvider;
use Pollora\Meta\Infrastructure\Providers\MetaServiceProvider;
use Pollora\Meta\Infrastructure\Laravel\MetaServiceProvider;
use Pollora\Modules\Infrastructure\Providers\ModuleServiceProvider;
use Pollora\Option\Infrastructure\Providers\OptionServiceProvider;
use Pollora\Permalink\Infrastructure\Providers\PermalinkServiceProvider;
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/Extraction/BlockBindingsContractTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
use Pollora\Meta\Application\Services\MetaSchemaBuilder;
use Pollora\Meta\Application\Services\MetaSchemaRepository;
use Pollora\Meta\Domain\Contracts\MetaStoreInterface;
use Pollora\Meta\Infrastructure\Providers\MetaServiceProvider;
use Pollora\Meta\Infrastructure\Laravel\MetaServiceProvider;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
use Tests\Unit\BlockBinding\Fixtures\ArrayMetaStore;
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/Extraction/TypedMetaContractTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use Pollora\Meta\Domain\Models\MetaDefinition;
use Pollora\Meta\Domain\Models\MetaRecord;
use Pollora\Meta\Domain\Models\MetaSchema;
use Pollora\Meta\Infrastructure\Providers\MetaServiceProvider;
use Pollora\Meta\Infrastructure\Laravel\MetaServiceProvider;
use Pollora\Support\Facades\Meta;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
Expand Down
72 changes: 42 additions & 30 deletions tests/Feature/Extraction/surface.json
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@
"implements": [],
"constants": [],
"methods": {
"__construct": "public (Illuminate\\Contracts\\Container\\Container $container): mixed",
"__construct": "public (Psr\\Container\\ContainerInterface $container): mixed",
"build": "public (Pollora\\Meta\\Domain\\Contracts\\MetaUiDriver $driver, array $schemas): void",
"driver": "public (string $name): Pollora\\Meta\\Domain\\Contracts\\MetaUiDriver",
"extend": "public (string $name, Closure|string $driver): void",
Expand Down Expand Up @@ -622,22 +622,37 @@
"validate": "public (mixed $response, array $handler, WP_REST_Request $request): mixed"
}
},
"Pollora\\Meta\\Infrastructure\\Checks\\TypedMetaCheck": {
"Pollora\\Meta\\Infrastructure\\Laravel\\Console\\MetaAuditCommand": {
"kind": "class",
"extends": "Illuminate\\Console\\Command",
"implements": [],
"constants": [],
"methods": {
"handle": "public (Pollora\\Meta\\Application\\Services\\MetaAuditor $auditor): int"
}
},
"Pollora\\Meta\\Infrastructure\\Laravel\\Console\\MetaListCommand": {
"kind": "class",
"extends": "Illuminate\\Console\\Command",
"implements": [],
"constants": [],
"methods": {
"handle": "public (Pollora\\Meta\\Application\\Services\\MetaSchemaRepository $schemas): int"
}
},
"Pollora\\Meta\\Infrastructure\\Laravel\\LaravelMetaValidator": {
"kind": "final readonly class",
"extends": null,
"implements": [
"Pollora\\Doctor\\Domain\\Contracts\\CheckInterface"
"Pollora\\Meta\\Domain\\Contracts\\MetaValidatorInterface"
],
"constants": [],
"methods": {
"__construct": "public (Pollora\\Meta\\Application\\Services\\MetaSchemaRepository $schemas, Pollora\\Meta\\Application\\Services\\MetaAuditor $auditor): mixed",
"id": "public (): string",
"label": "public (): string",
"run": "public (Pollora\\Doctor\\Domain\\Enums\\RunContext $context): Pollora\\Doctor\\Domain\\Models\\CheckResult",
"runsIn": "public (): array"
"__construct": "public (Illuminate\\Contracts\\Validation\\Factory $validator): mixed",
"validate": "public (Pollora\\Meta\\Domain\\Models\\MetaDefinition $definition, mixed $value): void"
}
},
"Pollora\\Meta\\Infrastructure\\Providers\\MetaServiceProvider": {
"Pollora\\Meta\\Infrastructure\\Laravel\\MetaServiceProvider": {
"kind": "class",
"extends": "Illuminate\\Support\\ServiceProvider",
"implements": [],
Expand All @@ -647,16 +662,19 @@
"register": "public (): void"
}
},
"Pollora\\Meta\\Infrastructure\\Services\\LaravelMetaValidator": {
"Pollora\\Meta\\Infrastructure\\Laravel\\TypedMetaCheck": {
"kind": "final readonly class",
"extends": null,
"implements": [
"Pollora\\Meta\\Domain\\Contracts\\MetaValidatorInterface"
"Pollora\\Doctor\\Domain\\Contracts\\CheckInterface"
],
"constants": [],
"methods": {
"__construct": "public (Illuminate\\Contracts\\Validation\\Factory $validator): mixed",
"validate": "public (Pollora\\Meta\\Domain\\Models\\MetaDefinition $definition, mixed $value): void"
"__construct": "public (Pollora\\Meta\\Application\\Services\\MetaSchemaRepository $schemas, Pollora\\Meta\\Application\\Services\\MetaAuditor $auditor): mixed",
"id": "public (): string",
"label": "public (): string",
"run": "public (Pollora\\Doctor\\Domain\\Enums\\RunContext $context): Pollora\\Doctor\\Domain\\Models\\CheckResult",
"runsIn": "public (): array"
}
},
"Pollora\\Meta\\Infrastructure\\Services\\MetaDiscovery": {
Expand All @@ -682,32 +700,26 @@
"constants": [],
"methods": []
},
"Pollora\\Meta\\Testing\\MetaUiDriverConformance": {
"Pollora\\Meta\\Testing\\InstantiatingContainer": {
"kind": "final class",
"extends": null,
"implements": [],
"constants": [],
"methods": {
"check": "public static (Pollora\\Meta\\Domain\\Contracts\\MetaUiDriver $driver): array",
"schema": "public static (): Pollora\\Meta\\Domain\\Models\\MetaSchema"
}
},
"Pollora\\Meta\\UI\\Console\\MetaAuditCommand": {
"kind": "class",
"extends": "Illuminate\\Console\\Command",
"implements": [],
"implements": [
"Psr\\Container\\ContainerInterface"
],
"constants": [],
"methods": {
"handle": "public (Pollora\\Meta\\Application\\Services\\MetaAuditor $auditor): int"
"get": "public (string $id): mixed",
"has": "public (string $id): bool"
}
},
"Pollora\\Meta\\UI\\Console\\MetaListCommand": {
"kind": "class",
"extends": "Illuminate\\Console\\Command",
"Pollora\\Meta\\Testing\\MetaUiDriverConformance": {
"kind": "final class",
"extends": null,
"implements": [],
"constants": [],
"methods": {
"handle": "public (Pollora\\Meta\\Application\\Services\\MetaSchemaRepository $schemas): int"
"check": "public static (Pollora\\Meta\\Domain\\Contracts\\MetaUiDriver $driver): array",
"schema": "public static (): Pollora\\Meta\\Domain\\Models\\MetaSchema"
}
},
"Pollora\\Role\\Application\\Services\\CapabilityOwnerReader": {
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Meta/Fixtures/validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Illuminate\Translation\ArrayLoader;
use Illuminate\Translation\Translator;
use Illuminate\Validation\Factory;
use Pollora\Meta\Infrastructure\Services\LaravelMetaValidator;
use Pollora\Meta\Infrastructure\Laravel\LaravelMetaValidator;

function metaValidator(): LaravelMetaValidator
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Meta/MetaCommandsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
use Pollora\Meta\Application\Services\MetaSchemaBuilder;
use Pollora\Meta\Application\Services\MetaSchemaRepository;
use Pollora\Meta\Domain\Services\MetaValueCaster;
use Pollora\Meta\UI\Console\MetaAuditCommand;
use Pollora\Meta\UI\Console\MetaListCommand;
use Pollora\Meta\Infrastructure\Laravel\Console\MetaAuditCommand;
use Pollora\Meta\Infrastructure\Laravel\Console\MetaListCommand;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\BufferedOutput;
use Tests\Unit\Meta\Fixtures\ArrayMetaInventory;
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Meta/MetaServiceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
use Pollora\Meta\Domain\Models\MetaRecord;
use Pollora\Meta\Infrastructure\Adapters\WordPressMetaRegistry;
use Pollora\Meta\Infrastructure\Adapters\WordPressMetaStore;
use Pollora\Meta\Infrastructure\Providers\MetaServiceProvider;
use Pollora\Meta\Infrastructure\Services\LaravelMetaValidator;
use Pollora\Meta\Infrastructure\Laravel\LaravelMetaValidator;
use Pollora\Meta\Infrastructure\Laravel\MetaServiceProvider;
use Pollora\Meta\Infrastructure\Services\MetaDiscovery;
use Pollora\Support\Facades\Meta;
use Psr\Log\LoggerInterface;
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Meta/MetaUiDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
use Pollora\Meta\Domain\Models\MetaDefinition;
use Pollora\Meta\Domain\Models\MetaSchema;
use Pollora\Meta\Domain\Services\MetaValueCaster;
use Pollora\Meta\Infrastructure\Providers\MetaServiceProvider;
use Pollora\Meta\Infrastructure\Laravel\MetaServiceProvider;
use Pollora\Meta\Testing\MetaUiDriverConformance;
use Psr\Log\LoggerInterface;
use Tests\Unit\Meta\Fixtures\Event;
Expand Down
Loading
Loading