| @@ 125-137 (lines=13) @@ | ||
| 122 | /** |
|
| 123 | * @return AndX |
|
| 124 | */ |
|
| 125 | public static function andX() |
|
| 126 | { |
|
| 127 | // NEXT_MAJOR: use variable-length argument lists (...$specs) |
|
| 128 | $spec = (new \ReflectionClass(AndX::class))->newInstanceArgs(func_get_args()); |
|
| 129 | ||
| 130 | // hook for PHPStan |
|
| 131 | if (!($spec instanceof AndX)) { |
|
| 132 | throw new \RuntimeException( |
|
| 133 | sprintf('The specification must be an instance of "%s", but got "%s".', AndX::class, get_class($spec)) |
|
| 134 | ); |
|
| 135 | } |
|
| 136 | ||
| 137 | return $spec; |
|
| 138 | } |
|
| 139 | ||
| 140 | /** |
|
| @@ 143-155 (lines=13) @@ | ||
| 140 | /** |
|
| 141 | * @return OrX |
|
| 142 | */ |
|
| 143 | public static function orX() |
|
| 144 | { |
|
| 145 | // NEXT_MAJOR: use variable-length argument lists (...$specs) |
|
| 146 | $spec = (new \ReflectionClass(OrX::class))->newInstanceArgs(func_get_args()); |
|
| 147 | ||
| 148 | // hook for PHPStan |
|
| 149 | if (!($spec instanceof OrX)) { |
|
| 150 | throw new \RuntimeException( |
|
| 151 | sprintf('The specification must be an instance of "%s", but got "%s".', OrX::class, get_class($spec)) |
|
| 152 | ); |
|
| 153 | } |
|
| 154 | ||
| 155 | return $spec; |
|
| 156 | } |
|
| 157 | ||
| 158 | /** |
|