@@ -12,11 +12,11 @@ |
||
| 12 | 12 | public function __construct( |
| 13 | 13 | string $interface, |
| 14 | 14 | bool $singleton = false, |
| 15 | - private readonly string|\BackedEnum|null $scope = null, |
|
| 15 | + private readonly string | \BackedEnum | null $scope = null, |
|
| 16 | 16 | private readonly ?string $version = null, |
| 17 | 17 | private readonly ?string $message = null, |
| 18 | - ) { |
|
| 19 | - if (($scope === null || $version === null) && $message === null) { |
|
| 18 | + ){ |
|
| 19 | + if (($scope === null || $version === null) && $message === null){ |
|
| 20 | 20 | throw new \InvalidArgumentException('Scope and version or custom message must be provided.'); |
| 21 | 21 | } |
| 22 | 22 | |
@@ -12,8 +12,8 @@ |
||
| 12 | 12 | public function __construct( |
| 13 | 13 | protected readonly string $interface, |
| 14 | 14 | public readonly bool $singleton = false, |
| 15 | - ) { |
|
| 16 | - if (!\interface_exists($interface)) { |
|
| 15 | + ){ |
|
| 16 | + if (!\interface_exists($interface)){ |
|
| 17 | 17 | throw new \InvalidArgumentException(\sprintf('Interface `%s` does not exist.', $interface)); |
| 18 | 18 | } |
| 19 | 19 | } |
@@ -63,19 +63,19 @@ discard block |
||
| 63 | 63 | * |
| 64 | 64 | * @throws \Throwable |
| 65 | 65 | */ |
| 66 | - public function make(string $alias, array $parameters = [], Stringable|string|null $context = null): mixed |
|
| 66 | + public function make(string $alias, array $parameters = [], Stringable | string | null $context = null): mixed |
|
| 67 | 67 | { |
| 68 | - if ($parameters === [] && \array_key_exists($alias, $this->state->singletons)) { |
|
| 68 | + if ($parameters === [] && \array_key_exists($alias, $this->state->singletons)){ |
|
| 69 | 69 | return $this->state->singletons[$alias]; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | $binding = $this->state->bindings[$alias] ?? null; |
| 73 | 73 | |
| 74 | - if ($binding === null) { |
|
| 74 | + if ($binding === null){ |
|
| 75 | 75 | return $this->resolveWithoutBinding($alias, $parameters, $context); |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - try { |
|
| 78 | + try{ |
|
| 79 | 79 | $this->tracer->push( |
| 80 | 80 | false, |
| 81 | 81 | action: 'resolve from binding', |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | ->resolveWeakReference($binding, $alias, $context, $parameters), |
| 106 | 106 | default => $binding, |
| 107 | 107 | }; |
| 108 | - } finally { |
|
| 108 | + }finally{ |
|
| 109 | 109 | $this->state->bindings[$alias] ??= $binding; |
| 110 | 110 | $this->tracer->pop(true); |
| 111 | 111 | $this->tracer->pop(false); |
@@ -119,18 +119,18 @@ discard block |
||
| 119 | 119 | private function resolveInjector(Config\Injectable $binding, Ctx $ctx, array $arguments) |
| 120 | 120 | { |
| 121 | 121 | $context = $ctx->context; |
| 122 | - try { |
|
| 122 | + try{ |
|
| 123 | 123 | $reflection = $ctx->reflection ??= new \ReflectionClass($ctx->class); |
| 124 | - } catch (\ReflectionException $e) { |
|
| 124 | + }catch (\ReflectionException $e){ |
|
| 125 | 125 | throw new ContainerException($e->getMessage(), $e->getCode(), $e); |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | $injector = $binding->injector; |
| 129 | 129 | |
| 130 | - try { |
|
| 130 | + try{ |
|
| 131 | 131 | $injectorInstance = \is_object($injector) ? $injector : $this->container->get($injector); |
| 132 | 132 | |
| 133 | - if (!$injectorInstance instanceof InjectorInterface) { |
|
| 133 | + if (!$injectorInstance instanceof InjectorInterface){ |
|
| 134 | 134 | throw new InjectionException( |
| 135 | 135 | \sprintf( |
| 136 | 136 | "Class '%s' must be an instance of InjectorInterface for '%s'.", |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | default => (string)$context, |
| 158 | 158 | }); |
| 159 | 159 | |
| 160 | - if (!$reflection->isInstance($instance)) { |
|
| 160 | + if (!$reflection->isInstance($instance)){ |
|
| 161 | 161 | throw new InjectionException( |
| 162 | 162 | \sprintf( |
| 163 | 163 | "Invalid injection response for '%s'.", |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | return $instance; |
| 170 | - } finally { |
|
| 170 | + }finally{ |
|
| 171 | 171 | $this->state->bindings[$ctx->class] ??= $binding; |
| 172 | 172 | } |
| 173 | 173 | } |
@@ -175,29 +175,29 @@ discard block |
||
| 175 | 175 | private function resolveAlias( |
| 176 | 176 | Config\Alias $binding, |
| 177 | 177 | string $alias, |
| 178 | - Stringable|string|null $context, |
|
| 178 | + Stringable | string | null $context, |
|
| 179 | 179 | array $arguments, |
| 180 | 180 | ): mixed { |
| 181 | 181 | $result = $binding->alias === $alias |
| 182 | 182 | ? $this->autowire( |
| 183 | - new Ctx(alias: $alias, class: $binding->alias, context: $context, singleton: $binding->singleton), |
|
| 183 | + new Ctx(alias : $alias, class : $binding->alias, context : $context, singleton : $binding->singleton), |
|
| 184 | 184 | $arguments, |
| 185 | 185 | ) |
| 186 | 186 | //Binding is pointing to something else |
| 187 | 187 | : $this->make($binding->alias, $arguments, $context); |
| 188 | 188 | |
| 189 | - if ($binding->singleton && $arguments === []) { |
|
| 189 | + if ($binding->singleton && $arguments === []){ |
|
| 190 | 190 | $this->state->singletons[$alias] = $result; |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | return $result; |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | - private function resolveProxy(Config\Proxy $binding, string $alias, Stringable|string|null $context): mixed |
|
| 196 | + private function resolveProxy(Config\Proxy $binding, string $alias, Stringable | string | null $context): mixed |
|
| 197 | 197 | { |
| 198 | 198 | $result = Proxy::create(new \ReflectionClass($binding->getInterface()), $context, new Attribute\Proxy()); |
| 199 | 199 | |
| 200 | - if ($binding->singleton) { |
|
| 200 | + if ($binding->singleton){ |
|
| 201 | 201 | $this->state->singletons[$alias] = $result; |
| 202 | 202 | } |
| 203 | 203 | |
@@ -207,13 +207,13 @@ discard block |
||
| 207 | 207 | private function resolveShared( |
| 208 | 208 | Config\Shared $binding, |
| 209 | 209 | string $alias, |
| 210 | - Stringable|string|null $context, |
|
| 210 | + Stringable | string | null $context, |
|
| 211 | 211 | array $arguments, |
| 212 | 212 | ): object { |
| 213 | 213 | $avoidCache = $arguments !== []; |
| 214 | 214 | return $avoidCache |
| 215 | 215 | ? $this->createInstance( |
| 216 | - new Ctx(alias: $alias, class: $binding->value::class, context: $context), |
|
| 216 | + new Ctx(alias : $alias, class : $binding->value::class, context : $context), |
|
| 217 | 217 | $arguments, |
| 218 | 218 | ) |
| 219 | 219 | : $binding->value; |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | private function resolveAutowire( |
| 223 | 223 | Config\Autowire $binding, |
| 224 | 224 | string $alias, |
| 225 | - Stringable|string|null $context, |
|
| 225 | + Stringable | string | null $context, |
|
| 226 | 226 | array $arguments, |
| 227 | 227 | ): mixed { |
| 228 | 228 | $instance = $binding->autowire->resolve($this, $arguments); |
@@ -232,17 +232,17 @@ discard block |
||
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | private function resolveFactory( |
| 235 | - Config\Factory|Config\DeferredFactory $binding, |
|
| 235 | + Config\Factory | Config\DeferredFactory $binding, |
|
| 236 | 236 | string $alias, |
| 237 | - Stringable|string|null $context, |
|
| 237 | + Stringable | string | null $context, |
|
| 238 | 238 | array $arguments, |
| 239 | 239 | ): mixed { |
| 240 | 240 | $ctx = new Ctx(alias: $alias, class: $alias, context: $context, singleton: $binding->singleton); |
| 241 | - try { |
|
| 241 | + try{ |
|
| 242 | 242 | $instance = $binding::class === Config\Factory::class && $binding->getParametersCount() === 0 |
| 243 | 243 | ? ($binding->factory)() |
| 244 | 244 | : $this->invoker->invoke($binding->factory, $arguments); |
| 245 | - } catch (NotCallableException $e) { |
|
| 245 | + }catch (NotCallableException $e){ |
|
| 246 | 246 | throw new ContainerException( |
| 247 | 247 | $this->tracer->combineTraceMessage(\sprintf('Invalid binding for `%s`.', $ctx->alias)), |
| 248 | 248 | $e->getCode(), |
@@ -256,24 +256,24 @@ discard block |
||
| 256 | 256 | private function resolveWeakReference( |
| 257 | 257 | Config\WeakReference $binding, |
| 258 | 258 | string $alias, |
| 259 | - Stringable|string|null $context, |
|
| 259 | + Stringable | string | null $context, |
|
| 260 | 260 | array $arguments, |
| 261 | 261 | ): ?object { |
| 262 | 262 | $avoidCache = $arguments !== []; |
| 263 | 263 | |
| 264 | - if (($avoidCache || $binding->reference->get() === null) && \class_exists($alias)) { |
|
| 265 | - try { |
|
| 264 | + if (($avoidCache || $binding->reference->get() === null) && \class_exists($alias)){ |
|
| 265 | + try{ |
|
| 266 | 266 | $this->tracer->push(false, alias: $alias, source: WeakReference::class, context: $context); |
| 267 | 267 | |
| 268 | 268 | $object = $this->createInstance( |
| 269 | 269 | new Ctx(alias: $alias, class: $alias, context: $context), |
| 270 | 270 | $arguments, |
| 271 | 271 | ); |
| 272 | - if ($avoidCache) { |
|
| 272 | + if ($avoidCache){ |
|
| 273 | 273 | return $object; |
| 274 | 274 | } |
| 275 | 275 | $binding->reference = WeakReference::create($object); |
| 276 | - } catch (\Throwable) { |
|
| 276 | + }catch (\Throwable){ |
|
| 277 | 277 | throw new ContainerException( |
| 278 | 278 | $this->tracer->combineTraceMessage( |
| 279 | 279 | \sprintf( |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | ) |
| 284 | 284 | ) |
| 285 | 285 | ); |
| 286 | - } finally { |
|
| 286 | + }finally{ |
|
| 287 | 287 | $this->tracer->pop(); |
| 288 | 288 | } |
| 289 | 289 | } |
@@ -294,23 +294,23 @@ discard block |
||
| 294 | 294 | private function resolveWithoutBinding( |
| 295 | 295 | string $alias, |
| 296 | 296 | array $parameters = [], |
| 297 | - Stringable|string|null $context = null |
|
| 297 | + Stringable | string | null $context = null |
|
| 298 | 298 | ): mixed { |
| 299 | 299 | $parent = $this->scope->getParentFactory(); |
| 300 | 300 | |
| 301 | - if ($parent !== null) { |
|
| 302 | - try { |
|
| 301 | + if ($parent !== null){ |
|
| 302 | + try{ |
|
| 303 | 303 | $this->tracer->push(false, ...[ |
| 304 | 304 | 'current scope' => $this->scope->getScopeName(), |
| 305 | 305 | 'jump to parent scope' => $this->scope->getParentScope()->getScopeName(), |
| 306 | 306 | ]); |
| 307 | 307 | /** @psalm-suppress TooManyArguments */ |
| 308 | 308 | return $parent->make($alias, $parameters, $context); |
| 309 | - } catch (BadScopeException $e) { |
|
| 310 | - if ($this->scope->getScopeName() !== $e->getScope()) { |
|
| 309 | + }catch (BadScopeException $e){ |
|
| 310 | + if ($this->scope->getScopeName() !== $e->getScope()){ |
|
| 311 | 311 | throw $e; |
| 312 | 312 | } |
| 313 | - } catch (ContainerExceptionInterface $e) { |
|
| 313 | + }catch (ContainerExceptionInterface $e){ |
|
| 314 | 314 | $className = match (true) { |
| 315 | 315 | $e instanceof NotFoundException => NotFoundException::class, |
| 316 | 316 | default => ContainerException::class, |
@@ -319,19 +319,19 @@ discard block |
||
| 319 | 319 | 'Can\'t resolve `%s`.', |
| 320 | 320 | $alias, |
| 321 | 321 | )), previous: $e); |
| 322 | - } finally { |
|
| 322 | + }finally{ |
|
| 323 | 323 | $this->tracer->pop(false); |
| 324 | 324 | } |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | $this->tracer->push(false, action: 'autowire', alias: $alias, context: $context); |
| 328 | - try { |
|
| 328 | + try{ |
|
| 329 | 329 | //No direct instructions how to construct class, make is automatically |
| 330 | 330 | return $this->autowire( |
| 331 | 331 | new Ctx(alias: $alias, class: $alias, context: $context), |
| 332 | 332 | $parameters, |
| 333 | 333 | ); |
| 334 | - } finally { |
|
| 334 | + }finally{ |
|
| 335 | 335 | $this->tracer->pop(false); |
| 336 | 336 | } |
| 337 | 337 | } |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | && |
| 353 | 353 | (isset($this->state->injectors[$ctx->class]) || $this->binder->hasInjector($ctx->class)) |
| 354 | 354 | )) |
| 355 | - ) { |
|
| 355 | + ){ |
|
| 356 | 356 | throw new NotFoundException($this->tracer->combineTraceMessage(\sprintf( |
| 357 | 357 | 'Can\'t resolve `%s`: undefined class or binding `%s`.', |
| 358 | 358 | $this->tracer->getRootAlias(), |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | // Check scope name |
| 382 | 382 | $ctx->reflection = new \ReflectionClass($instance); |
| 383 | 383 | $scopeName = ($ctx->reflection->getAttributes(Attribute\Scope::class)[0] ?? null)?->newInstance()->name; |
| 384 | - if ($scopeName !== null && $scopeName !== $this->scope->getScopeName()) { |
|
| 384 | + if ($scopeName !== null && $scopeName !== $this->scope->getScopeName()){ |
|
| 385 | 385 | throw new BadScopeException($scopeName, $instance::class); |
| 386 | 386 | } |
| 387 | 387 | |
@@ -408,24 +408,24 @@ discard block |
||
| 408 | 408 | array $arguments, |
| 409 | 409 | ): object { |
| 410 | 410 | $class = $ctx->class; |
| 411 | - try { |
|
| 411 | + try{ |
|
| 412 | 412 | $ctx->reflection = $reflection = new \ReflectionClass($class); |
| 413 | - } catch (\ReflectionException $e) { |
|
| 413 | + }catch (\ReflectionException $e){ |
|
| 414 | 414 | throw new ContainerException($e->getMessage(), $e->getCode(), $e); |
| 415 | 415 | } |
| 416 | 416 | |
| 417 | 417 | // Check scope name |
| 418 | 418 | $scope = ($reflection->getAttributes(Attribute\Scope::class)[0] ?? null)?->newInstance()->name; |
| 419 | - if ($scope !== null && $scope !== $this->scope->getScopeName()) { |
|
| 419 | + if ($scope !== null && $scope !== $this->scope->getScopeName()){ |
|
| 420 | 420 | throw new BadScopeException($scope, $class); |
| 421 | 421 | } |
| 422 | 422 | |
| 423 | 423 | // We have to construct class using external injector when we know the exact context |
| 424 | - if ($arguments === [] && $this->binder->hasInjector($class)) { |
|
| 424 | + if ($arguments === [] && $this->binder->hasInjector($class)){ |
|
| 425 | 425 | return $this->resolveInjector($this->state->bindings[$ctx->class], $ctx, $arguments); |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | - if (!$reflection->isInstantiable()) { |
|
| 428 | + if (!$reflection->isInstantiable()){ |
|
| 429 | 429 | $itIs = match (true) { |
| 430 | 430 | $reflection->isEnum() => 'Enum', |
| 431 | 431 | $reflection->isAbstract() => 'Abstract class', |
@@ -438,12 +438,12 @@ discard block |
||
| 438 | 438 | |
| 439 | 439 | $constructor = $reflection->getConstructor(); |
| 440 | 440 | |
| 441 | - if ($constructor !== null) { |
|
| 442 | - try { |
|
| 441 | + if ($constructor !== null){ |
|
| 442 | + try{ |
|
| 443 | 443 | $this->tracer->push(false, action: 'resolve arguments', signature: $constructor); |
| 444 | 444 | $this->tracer->push(true); |
| 445 | 445 | $args = $this->resolver->resolveArguments($constructor, $arguments); |
| 446 | - } catch (ValidationException $e) { |
|
| 446 | + }catch (ValidationException $e){ |
|
| 447 | 447 | throw new ContainerException( |
| 448 | 448 | $this->tracer->combineTraceMessage( |
| 449 | 449 | \sprintf( |
@@ -453,22 +453,22 @@ discard block |
||
| 453 | 453 | ) |
| 454 | 454 | ), |
| 455 | 455 | ); |
| 456 | - } finally { |
|
| 456 | + }finally{ |
|
| 457 | 457 | $this->tracer->pop(true); |
| 458 | 458 | $this->tracer->pop(false); |
| 459 | 459 | } |
| 460 | - try { |
|
| 460 | + try{ |
|
| 461 | 461 | // Using constructor with resolved arguments |
| 462 | 462 | $this->tracer->push(false, call: "$class::__construct", arguments: $args); |
| 463 | 463 | $this->tracer->push(true); |
| 464 | 464 | $instance = new $class(...$args); |
| 465 | - } catch (\TypeError $e) { |
|
| 465 | + }catch (\TypeError $e){ |
|
| 466 | 466 | throw new WrongTypeException($constructor, $e); |
| 467 | - } finally { |
|
| 467 | + }finally{ |
|
| 468 | 468 | $this->tracer->pop(true); |
| 469 | 469 | $this->tracer->pop(false); |
| 470 | 470 | } |
| 471 | - } else { |
|
| 471 | + }else{ |
|
| 472 | 472 | // No constructor specified |
| 473 | 473 | $instance = $reflection->newInstance(); |
| 474 | 474 | } |
@@ -486,13 +486,13 @@ discard block |
||
| 486 | 486 | $instance = $this->runInflector($instance); |
| 487 | 487 | |
| 488 | 488 | //Declarative singletons |
| 489 | - if ($this->isSingleton($ctx)) { |
|
| 489 | + if ($this->isSingleton($ctx)){ |
|
| 490 | 490 | $this->state->singletons[$ctx->alias] = $instance; |
| 491 | 491 | } |
| 492 | 492 | |
| 493 | 493 | // Register finalizer |
| 494 | 494 | $finalizer = $this->getFinalizer($ctx, $instance); |
| 495 | - if ($finalizer !== null) { |
|
| 495 | + if ($finalizer !== null){ |
|
| 496 | 496 | $this->state->finalizers[] = $finalizer; |
| 497 | 497 | } |
| 498 | 498 | |
@@ -504,12 +504,12 @@ discard block |
||
| 504 | 504 | */ |
| 505 | 505 | private function isSingleton(Ctx $ctx): bool |
| 506 | 506 | { |
| 507 | - if ($ctx->singleton === true) { |
|
| 507 | + if ($ctx->singleton === true){ |
|
| 508 | 508 | return true; |
| 509 | 509 | } |
| 510 | 510 | |
| 511 | 511 | /** @psalm-suppress RedundantCondition https://github.com/vimeo/psalm/issues/9489 */ |
| 512 | - if ($ctx->reflection->implementsInterface(SingletonInterface::class)) { |
|
| 512 | + if ($ctx->reflection->implementsInterface(SingletonInterface::class)){ |
|
| 513 | 513 | return true; |
| 514 | 514 | } |
| 515 | 515 | |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | * @var Attribute\Finalize|null $attribute |
| 524 | 524 | */ |
| 525 | 525 | $attribute = ($ctx->reflection->getAttributes(Attribute\Finalize::class)[0] ?? null)?->newInstance(); |
| 526 | - if ($attribute === null) { |
|
| 526 | + if ($attribute === null){ |
|
| 527 | 527 | return null; |
| 528 | 528 | } |
| 529 | 529 | |
@@ -537,10 +537,10 @@ discard block |
||
| 537 | 537 | { |
| 538 | 538 | $scope = $this->scope; |
| 539 | 539 | |
| 540 | - while ($scope !== null) { |
|
| 541 | - foreach ($this->state->inflectors as $class => $inflectors) { |
|
| 542 | - if ($instance instanceof $class) { |
|
| 543 | - foreach ($inflectors as $inflector) { |
|
| 540 | + while ($scope !== null){ |
|
| 541 | + foreach ($this->state->inflectors as $class => $inflectors){ |
|
| 542 | + if ($instance instanceof $class){ |
|
| 543 | + foreach ($inflectors as $inflector){ |
|
| 544 | 544 | $instance = $inflector->getParametersCount() > 1 |
| 545 | 545 | ? $this->invoker->invoke($inflector->inflector, [$instance]) |
| 546 | 546 | : ($inflector->inflector)($instance); |
@@ -556,9 +556,9 @@ discard block |
||
| 556 | 556 | |
| 557 | 557 | private function validateArguments(ContextFunction $reflection, array $arguments = []): bool |
| 558 | 558 | { |
| 559 | - try { |
|
| 559 | + try{ |
|
| 560 | 560 | $this->resolver->validateArguments($reflection, $arguments); |
| 561 | - } catch (\Throwable) { |
|
| 561 | + }catch (\Throwable){ |
|
| 562 | 562 | return false; |
| 563 | 563 | } |
| 564 | 564 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | self::expectExceptionMessageMatches('/Call to undefined method/i'); |
| 54 | 54 | |
| 55 | - $root->invoke(static function (#[Proxy] EmptyInterface $proxy) { |
|
| 55 | + $root->invoke(static function (#[Proxy] EmptyInterface $proxy){ |
|
| 56 | 56 | $proxy->bar(name: 'foo'); // Possible to run |
| 57 | 57 | }); |
| 58 | 58 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $proxy = $$var; |
| 93 | 93 | self::assertSame(['foo', 'bar', 'baz', 69], $proxy->extraVariadic('foo', 'bar', 'baz', 69)); |
| 94 | 94 | self::assertSame( |
| 95 | - ['foo' => 'foo','zap' => 'bar', 'gas' => 69], |
|
| 95 | + ['foo' => 'foo', 'zap' => 'bar', 'gas' => 69], |
|
| 96 | 96 | $proxy->extraVariadic(foo: 'foo', zap: 'bar', gas: 69), |
| 97 | 97 | ); |
| 98 | 98 | }); |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | $root->bindSingleton(MockInterface::class, Stub\MockInterfaceImpl::class); |
| 178 | 178 | $root->bindSingleton(EmptyInterface::class, Stub\MockInterfaceImpl::class); |
| 179 | 179 | |
| 180 | - $mock = $root->invoke(static fn(#[Proxy] MockInterface|EmptyInterface $mock) => $mock); |
|
| 180 | + $mock = $root->invoke(static fn(#[Proxy] MockInterface | EmptyInterface $mock) => $mock); |
|
| 181 | 181 | |
| 182 | 182 | self::assertInstanceOf(MockInterfaceImpl::class, $mock); |
| 183 | 183 | } |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | { |
| 231 | 231 | \set_error_handler(static function (int $errno, string $error) use ($interface): void { |
| 232 | 232 | self::assertSame( |
| 233 | - \sprintf('Using `%s` outside of the `foo` scope is deprecated and will be ' . |
|
| 233 | + \sprintf('Using `%s` outside of the `foo` scope is deprecated and will be '. |
|
| 234 | 234 | 'impossible in version 4.0.', $interface), |
| 235 | 235 | $error |
| 236 | 236 | ); |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | public function testDeprecationProxyConfigDontThrowIfNotConstructed(string $interface): void |
| 287 | 287 | { |
| 288 | 288 | \set_error_handler(static function (int $errno, string $error) use ($interface): void { |
| 289 | - self::fail('Unexpected error: ' . $error); |
|
| 289 | + self::fail('Unexpected error: '.$error); |
|
| 290 | 290 | }); |
| 291 | 291 | |
| 292 | 292 | $root = new Container(); |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | #[DataProvider('invalidDeprecationProxyArgsDataProvider')] |
| 309 | - public function testDeprecationProxyConfigArgsRequiredException(string|null $scope, string|null $version): void |
|
| 309 | + public function testDeprecationProxyConfigArgsRequiredException(string | null $scope, string | null $version): void |
|
| 310 | 310 | { |
| 311 | 311 | self::expectException(\InvalidArgumentException::class); |
| 312 | 312 | self::expectExceptionMessage('Scope and version or custom message must be provided.'); |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | { |
| 319 | 319 | $proxy = new Config\Proxy(EmptyInterface::class); |
| 320 | 320 | |
| 321 | - $this->assertSame(\sprintf('Proxy to `%s`', EmptyInterface::class), (string) $proxy); |
|
| 321 | + $this->assertSame(\sprintf('Proxy to `%s`', EmptyInterface::class), (string)$proxy); |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | public function testProxyConfigNotInterfaceException(): void |