-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLogicalError.php
More file actions
69 lines (57 loc) · 2.36 KB
/
LogicalError.php
File metadata and controls
69 lines (57 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
declare( strict_types = 1 );
namespace TheWebSolver\Codegarage\Container\Error;
use LogicException;
use TheWebSolver\Codegarage\Container\Event\EventType;
use TheWebSolver\Codegarage\Container\Helper\EventBuilder;
use TheWebSolver\Codegarage\Container\Helper\ContextBuilder;
class LogicalError extends LogicException {
public static function entryAndAliasIsSame( string $entry ): self {
return new self( sprintf( '"%s" cannot be aliased by same name.', $entry ) );
}
public static function duringBuildEventNeedsParamName( string $entry ): self {
return new self(
sprintf( 'Parameter name is required when adding event listener during build for entry "%s".', $entry )
);
}
public static function afterBuildEventEntryMustBeClassname( string $entry ): self {
return new self(
sprintf( 'The concrete must be a string when adding event listener after build for entry "%s".', $entry )
);
}
public static function unsupportedEventType( EventType $type ): self {
return new self( sprintf( 'Cannot add Event Listener for the "%s" Event Type.', $type->name ) );
}
public static function eventListenerEntryNotProvidedWith( string $method ): self {
return new self(
sprintf( 'Event entry must be provided using method "%1$s::%2$s()".', EventBuilder::class, $method )
);
}
public static function contextualConstraintNotProvidedWith( string $method ): self {
return new self(
sprintf(
'The dependency to be resolved must be provided using method "%1$s::%2$s()".',
ContextBuilder::class,
$method
)
);
}
public static function unwrappableClosure(): self {
return new self(
'Cannot unwrap closure. Currently, only supports non-static class members/functions/methods and named functions.'
);
}
public static function noMethodNameForBinding( string $classname ): self {
return new self( sprintf( 'Method name must be provided to create binding ID for class: "%s".', $classname ) );
}
public static function nonBindableClosure(): self {
return new self(
'Method binding only accepts first-class callable of a named function or'
. ' a non-static method. Alternatively, pass an instantiated object as'
. ' param [#1] "$object" & its method name as param [#2] "$methodName".'
);
}
public static function nonInstantiableClass( string $classname ): self {
return new self( sprintf( 'Non-instantiable class "%s".', $classname ) );
}
}