Skip to content

Commit ed8dacf

Browse files
committed
Merge branch 'cleanup'
2 parents f8b6d4f + 61d9974 commit ed8dacf

File tree

118 files changed

+1347
-965
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+1347
-965
lines changed

.gitattributes

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
/phpstan* export-ignore
1212
/phpstan-baseline-7.4.neon linguist-generated
1313
/phpstan-baseline-8.3.neon linguist-generated
14-
/phpstan.extension.neon -export-ignore
1514
/phpunit* export-ignore
1615
/scripts export-ignore
1716
/src/Toolkit/Cli/CliOptionBuilder.php linguist-generated

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119
"extra": {
120120
"phpstan": {
121121
"includes": [
122-
"phpstan.extension.neon"
122+
"src/Toolkit/PHPStan/phpstan.extension.neon"
123123
]
124124
}
125125
}

composer.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phpstan.neon.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
includes:
2-
- phpstan.extension.neon
2+
- src/Toolkit/PHPStan/phpstan.extension.neon
33
- tests/phpstan-conditional.php
44

55
parameters:

src/Toolkit/Cli/CliOption.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use Salient\Utility\Format;
2323
use Salient\Utility\Get;
2424
use Salient\Utility\Inflect;
25+
use Salient\Utility\Reflect;
2526
use Salient\Utility\Regex;
2627
use Salient\Utility\Str;
2728
use Salient\Utility\Test;
@@ -1137,7 +1138,7 @@ private function throwValueTypeException($value): void
11371138

11381139
private function getValueTypeName(): string
11391140
{
1140-
return CliOptionValueType::toName($this->ValueType);
1141+
return Reflect::getConstantName(CliOptionValueType::class, $this->ValueType);
11411142
}
11421143

11431144
/**

src/Toolkit/Container/Container.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
use Salient\Console\ConsoleLogger;
1111
use Salient\Console\ConsoleWriter;
1212
use Salient\Container\Event\BeforeGlobalContainerSetEvent;
13-
use Salient\Container\Exception\ContainerServiceNotFoundException;
14-
use Salient\Container\Exception\ContainerUnusableArgumentsException;
15-
use Salient\Container\Exception\InvalidContainerBindingException;
13+
use Salient\Container\Exception\ArgumentsNotUsedException;
14+
use Salient\Container\Exception\InvalidServiceException;
15+
use Salient\Container\Exception\ServiceNotFoundException;
1616
use Salient\Contract\Cache\CacheStoreInterface;
1717
use Salient\Contract\Console\ConsoleWriterInterface;
1818
use Salient\Contract\Container\ContainerAwareInterface;
@@ -21,6 +21,7 @@
2121
use Salient\Contract\Container\HasContextualBindings;
2222
use Salient\Contract\Container\HasServices;
2323
use Salient\Contract\Container\ServiceAwareInterface;
24+
use Salient\Contract\Container\ServiceLifetime;
2425
use Salient\Contract\Container\SingletonInterface;
2526
use Salient\Contract\Core\FacadeAwareInterface;
2627
use Salient\Contract\Core\FacadeInterface;
@@ -196,7 +197,7 @@ private function _get(string $id, string $service, array $args): object
196197
{
197198
$hasInstance = $this->Dice->hasShared($id);
198199
if ($hasInstance && $args) {
199-
throw new ContainerUnusableArgumentsException(sprintf(
200+
throw new ArgumentsNotUsedException(sprintf(
200201
'Cannot apply arguments to shared instance: %s',
201202
$id,
202203
));
@@ -237,7 +238,7 @@ private function _get(string $id, string $service, array $args): object
237238
$this->bindDefaultService($failed);
238239
continue;
239240
}
240-
throw new ContainerServiceNotFoundException($ex->getMessage(), $ex);
241+
throw new ServiceNotFoundException($ex->getMessage(), $ex);
241242
}
242243
} while (true);
243244
} finally {
@@ -542,7 +543,7 @@ private function applyService(
542543
$bind = array_intersect($bind, $services);
543544
if (count($bind) < count($services)) {
544545
// @codeCoverageIgnoreStart
545-
throw new InvalidContainerBindingException(sprintf(
546+
throw new InvalidServiceException(sprintf(
546547
'%s does not implement: %s',
547548
$id,
548549
implode(', ', array_diff($services, $bind)),

src/Toolkit/Container/Exception/AbstractContainerException.php

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace Salient\Container\Exception;
4+
5+
use Salient\Contract\Container\ArgumentsNotUsedExceptionInterface;
6+
use Salient\Core\AbstractException;
7+
8+
/**
9+
* Thrown when a container cannot pass arguments to a service, e.g. because it
10+
* resolves to a shared instance
11+
*/
12+
class ArgumentsNotUsedException extends AbstractException implements ArgumentsNotUsedExceptionInterface {}

src/Toolkit/Container/Exception/ContainerServiceNotFoundException.php

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/Toolkit/Container/Exception/ContainerUnusableArgumentsException.php

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)