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
22 changes: 22 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# CS fixes
86055ec8f9e3f20bde367c9bd318e38b705a681c
9efbd219ebad17dbdfbaa3c9358da9caf5f850ca
b971f6e7751a280c872c3a92f26160dbf3d944ee
85da4b1f41dcbf18160f39c2bdfe6c6204f6e974
2c4ad14863436f32f7695777d3cf4feaff32c299
6dcacfa03d827623c054a6ee9faea0a2e48f074b
b4be914757d69c10c6ba3360bb640aac3e03ecbb
36cd24dc4899ad3c196fe439bb9b11542acd3e08
# Rector cosmetic changes
93f2699102c3704435f70857df68837a29d58142
99da8995ae47c1be802eb23c1364e907a00bdea6
8772eeb79a0326a1d1f451a9c6759506fa178002
9f5907008c67c5da6e1fcb103ffc863f3764e59d
68c56f4e303108ede067d9af0461b993655d0883
54157f0a184b6a3af44695c1fec6211f55851d77
5b20c3f8090dd586b8f3a45e0ec2002018007a3e
88f4633eb2a6f4f8bcea3ce45319cfc927e51cd4
78d0cd9c3ab34eaaa9c2bfaffc2f425e72b4e624
0160a8696a6aa386ae949936bc2b7fb218195e55
acf4dc86daa625d8b860b93e46bbc9c2ada7f81d
2f631b23e94c3524bd0eb51d7bce5aa47afd3eae
2 changes: 1 addition & 1 deletion src/AnnotatedRoutes/src/Annotation/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ final class Route
public const DEFAULT_GROUP = 'web';

/**
* @param array $middleware Route specific middleware set, if any
* @psalm-param non-empty-string $route
* @psalm-param non-empty-string|null $name
* @psalm-param non-empty-string|array<string> $methods
* @psalm-param non-empty-string $group Route group, groups can be configured using MiddlewareRegistry
* @param array $middleware Route specific middleware set, if any
*/
public function __construct(
public readonly string $route,
Expand Down
2 changes: 1 addition & 1 deletion src/Boot/src/Attribute/AbstractMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

/**
* Abstract base class for method attributes used in bootloaders.
*
*
* This abstract class serves as a base for all method-level attributes in the bootloader system,
* providing common functionality for managing binding aliases.
*
Expand Down
10 changes: 5 additions & 5 deletions src/Boot/src/Attribute/BindAlias.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

/**
* Attribute to define additional aliases for a method.
*
*
* This attribute allows defining multiple aliases for a method in a bootloader class.
* It can be used to bind a method's return value to multiple interface or class names.
*
*
* This attribute can be applied multiple times to the same method.
*
*
* Example usage:
* ```php
* class MyBootloader extends Bootloader
Expand All @@ -24,8 +24,8 @@
* }
* }
* ```
*
* The above example binds the returned Logger instance to LoggerInterface,
*
* The above example binds the returned Logger instance to LoggerInterface,
* PsrLoggerInterface, and MonologLoggerInterface.
*/
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
Expand Down
12 changes: 6 additions & 6 deletions src/Boot/src/Attribute/BindMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

/**
* Attribute for marking methods that provide container bindings.
*
*
* Methods marked with this attribute will be invoked each time the container
* needs to resolve the dependency, creating a new instance each time.
* The return value of the method will be bound to the specified alias
* or to all interfaces/classes in the return type.
*
*
* Example usage:
* ```php
* class MyBootloader extends Bootloader
Expand All @@ -22,15 +22,15 @@
* {
* return new HttpClient();
* }
*
*
* // Method will be called each time the container resolves DbFactory
* // instead of its return type (DatabaseFactory)
* #[BindMethod(alias: DbFactory::class)]
* public function createDatabaseFactory(): DatabaseFactory
* {
* return new DatabaseFactory();
* }
*
*
* // Method will be called each time the container resolves either
* // LogManagerInterface or its return type (LogManager)
* #[BindMethod(alias: LogManagerInterface::class, aliasesFromReturnType: true)]
Expand All @@ -40,10 +40,10 @@
* }
* }
* ```
*
*
* This attribute is similar to defining bindings via the `defineBindings()` method,
* but with a more expressive and type-safe approach.
*
*
* @see SingletonMethod For binding singleton instances
* @see InjectorMethod For binding injector methods
*/
Expand Down
14 changes: 7 additions & 7 deletions src/Boot/src/Attribute/BootMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

/**
* Attribute for marking methods that should be called during the boot phase.
*
*
* Methods marked with this attribute will be called during the bootloader's
* boot phase, after all initialization methods have been called.
* The boot phase is where you typically configure services, register event listeners,
* or perform other setup tasks.
*
*
* The priority parameter determines the order in which boot methods are called.
* Higher priority values are executed first.
*
*
* Example usage:
* ```php
* class MyBootloader extends Bootloader
Expand All @@ -25,14 +25,14 @@
* {
* $router->addRoute('home', '/');
* }
*
*
* // Called during boot phase with high priority (10)
* #[BootMethod(priority: 10)]
* public function configureDatabase(DatabaseInterface $db): void
* {
* $db->setDefaultConnection('default');
* }
*
*
* // Called during boot phase with low priority (-10)
* #[BootMethod(priority: -10)]
* public function registerEventListeners(EventDispatcherInterface $dispatcher): void
Expand All @@ -41,9 +41,9 @@
* }
* }
* ```
*
*
* Boot methods are executed after all bootloaders' init methods have been called.
*
*
* @see InitMethod For methods to be called during initialization phase
*/
#[\Attribute(\Attribute::TARGET_METHOD)]
Expand Down
12 changes: 6 additions & 6 deletions src/Boot/src/Attribute/BootloadConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

/**
* Attribute to configure bootloader behavior.
*
*
* This attribute allows defining configuration for bootloaders, including
* constructor arguments, enabling/disabling based on environment variables,
* and controlling how configuration overrides work.
*
*
* Example usage:
* ```php
* // Basic configuration with constructor arguments
Expand All @@ -20,10 +20,10 @@
* public function __construct(
* private readonly string $defaultConnection
* ) {}
*
*
* // ...
* }
*
*
* // Conditionally enable based on environment
* #[BootloadConfig(
* allowEnv: ['APP_ENV' => ['local', 'development']],
Expand All @@ -34,7 +34,7 @@
* // Only loaded in local or development environments
* // And not when TESTING is true
* }
*
*
* // Prevent runtime configuration from overriding attribute configuration
* #[BootloadConfig(args: ['debug' => true], override: false)]
* class DebugBootloader extends Bootloader
Expand All @@ -43,7 +43,7 @@
* // configuration is provided at runtime
* }
* ```
*
*
* When a bootloader has both runtime configuration and a BootloadConfig attribute,
* the override parameter controls which configuration takes precedence.
*/
Expand Down
14 changes: 7 additions & 7 deletions src/Boot/src/Attribute/InitMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

/**
* Attribute for marking methods that should be called during the initialization phase.
*
*
* Methods marked with this attribute will be called during the bootloader's
* initialization phase, before the boot phase begins. This is where you typically
* set up container bindings, register services, or perform other initialization tasks.
*
*
* The priority parameter determines the order in which init methods are called.
* Higher priority values are executed first.
*
*
* Example usage:
* ```php
* class MyBootloader extends Bootloader
Expand All @@ -24,14 +24,14 @@
* {
* $container->bindSingleton(MyService::class, MyServiceImplementation::class);
* }
*
*
* // Called during initialization phase with high priority (10)
* #[InitMethod(priority: 10)]
* public function setupCore(): void
* {
* // Setup core components first
* }
*
*
* // Called during initialization phase with low priority (-10)
* #[InitMethod(priority: -10)]
* public function setupExtensions(): void
Expand All @@ -40,9 +40,9 @@
* }
* }
* ```
*
*
* Init methods are executed before any bootloader's boot methods are called.
*
*
* @see BootMethod For methods to be called during boot phase
*/
#[\Attribute(\Attribute::TARGET_METHOD)]
Expand Down
14 changes: 7 additions & 7 deletions src/Boot/src/Attribute/InjectorMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

/**
* Attribute for marking methods that provide a custom injector.
*
*
* Methods marked with this attribute will be used as injectors for the specified
* alias type. An injector is responsible for creating and configuring instances
* of a specific type when they're requested from the container.
*
*
* Unlike BindMethod and SingletonMethod which bind the return value of the method,
* InjectorMethod binds the method itself as an injector for the specified type.
*
*
* Example usage:
* ```php
* class MyBootloader extends Bootloader
Expand All @@ -24,7 +24,7 @@
* {
* return new Logger($channel);
* }
*
*
* // Method will be used as injector for ConnectionInterface
* #[InjectorMethod(ConnectionInterface::class)]
* public function createDatabaseConnection(string $name = null): ConnectionInterface
Expand All @@ -35,13 +35,13 @@
* }
* }
* ```
*
*
* With the above example, any time a LoggerInterface is requested from the container,
* the createLogger method will be called with any provided constructor arguments.
*
*
* Injectors are powerful for types that need custom creation logic or that
* accept additional parameters during construction.
*
*
* @see BindMethod For simple method bindings
* @see SingletonMethod For singleton method bindings
*/
Expand Down
12 changes: 6 additions & 6 deletions src/Boot/src/Attribute/SingletonMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

/**
* Attribute for marking methods that provide singleton container bindings.
*
*
* Methods marked with this attribute will be invoked only once, and the
* return value will be cached and reused for subsequent resolutions.
* The return value of the method will be bound to the specified alias
* or to all interfaces/classes in the return type.
*
*
* Example usage:
* ```php
* class MyBootloader extends Bootloader
Expand All @@ -22,15 +22,15 @@
* {
* return new HttpClient();
* }
*
*
* // Method will be called once and the result will be bound to DbFactory
* // instead of its return type (DatabaseFactory)
* #[SingletonMethod(alias: DbFactory::class)]
* public function createDatabaseFactory(): DatabaseFactory
* {
* return new DatabaseFactory();
* }
*
*
* // Method will be called once and the result will be bound to both
* // LogManagerInterface and its return type (LogManager)
* #[SingletonMethod(alias: LogManagerInterface::class, aliasesFromReturnType: true)]
Expand All @@ -40,10 +40,10 @@
* }
* }
* ```
*
*
* This attribute is similar to defining singletons via the `defineSingletons()` method,
* but with a more expressive and type-safe approach.
*
*
* @see BindMethod For non-singleton bindings
* @see InjectorMethod For binding injector methods
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Boot/src/Injector/EnumInjector.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use UnitEnum;

/**
* @implements InjectorInterface<UnitEnum>
* @implements InjectorInterface<\UnitEnum>
*
* @internal
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Console/src/Console.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ private function configureIO(InputInterface $input, OutputInterface $output): vo
$inputStream = $input->getStream();
}

if ($inputStream !== null && !@\posix_isatty($inputStream) && \getenv('SHELL_INTERACTIVE') === false) {
if ($inputStream !== null && !@posix_isatty($inputStream) && \getenv('SHELL_INTERACTIVE') === false) {
$input->setInteractive(false);
}
}
Expand Down
6 changes: 2 additions & 4 deletions src/Core/src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Spiral\Core;

use IteratorAggregate;
use Psr\Container\ContainerInterface;
use Spiral\Core\Internal\Binder;
use Spiral\Core\Internal\Container;
Expand All @@ -14,14 +13,13 @@
use Spiral\Core\Internal\Resolver;
use Spiral\Core\Internal\Scope;
use Spiral\Core\Internal\State;
use Spiral\Core\Internal\Tracer;

/**
* Container configuration that will be used not only in the root container but also in all child containers.
* The {@see self::$scopedBindings} property is internal and common for all containers.
* By the reason you can access to bindings for any scope from any container.
*
* @implements IteratorAggregate<
* @implements \IteratorAggregate<
* non-empty-string,
* class-string<State>|class-string<ResolverInterface>|class-string<FactoryInterface>|class-string<ContainerInterface>|class-string<BinderInterface>|class-string<InvokerInterface>|class-string<Actor>|class-string<Scope>
* >
Expand All @@ -32,8 +30,8 @@ class Config implements \IteratorAggregate
public readonly string $scope;

public readonly Internal\Config\StateStorage $scopedBindings;
private bool $rootLocked = true;
public readonly string $actor;
private bool $rootLocked = true;

/**
* @param class-string<State> $state
Expand Down
Loading
Loading