Skip to content

Commit

Permalink
Merge pull request #73 from cekta/fix-simple-cache-key
Browse files Browse the repository at this point in the history
fix #71
  • Loading branch information
smpl committed Dec 4, 2019
2 parents 74aac80 + c6b0974 commit 53c1149
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 17 deletions.
8 changes: 2 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ php:
- "7.3"

install:
- composer install
- make install

script:
- ./vendor/bin/phpcs
- ./vendor/bin/phpstan analyse
- ./vendor/bin/phpinsights --min-quality=100 --min-complexity=80 --min-architecture=100 --min-style=100 --no-interaction
- ./vendor/bin/phpunit
- ./vendor/bin/infection -s --min-msi=100 --min-covered-msi=100
- make test
23 changes: 23 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
install:
composer install
test: phpcs phpstan phpinsights phpunit infection
update:
composer update
phpcs:
./vendor/bin/phpcs
phpstan:
./vendor/bin/phpstan analyse
phpinsights:
./vendor/bin/phpinsights --min-quality=100 --min-complexity=80 --min-architecture=100 --min-style=100 --no-interaction
phpunit:
./vendor/bin/phpunit
infection:
./vendor/bin/infection -s --min-msi=100 --min-covered-msi=100
docs:
docker run \
--rm \
-it \
-v "$$PWD/docs":/srv/jekyll \
-v "$$PWD/bundle":/usr/local/bundle \
-p 4000:4000 \
jekyll/jekyll jekyll serve
2 changes: 1 addition & 1 deletion src/Exception/InfiniteRecursion.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ class InfiniteRecursion extends RuntimeException implements ContainerExceptionIn
public function __construct(string $id, array $calls)
{
$callsString = implode(', ', $calls);
parent::__construct("Infinite recursion for `$id`, calls: `$callsString`");
parent::__construct("Infinite recursion for `${id}`, calls: `${callsString}`");
}
}
2 changes: 1 addition & 1 deletion src/Exception/ProviderNotFound.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ class ProviderNotFound extends RuntimeException implements NotFoundExceptionInte
{
public function __construct(string $id)
{
parent::__construct("Provider not found for `$id`");
parent::__construct("Provider not found for `${id}`");
}
}
2 changes: 1 addition & 1 deletion src/Provider/AutowiringSimpleCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private function getDependencies(string $id): array
{
try {
$key = AutowiringCache::getCacheKey($id);
$result = $this->cache->get($id);
$result = $this->cache->get($key);
if ($result === null) {
$result = $this->autowiring->getDependencies($id);
$this->cache->set($key, $result);
Expand Down
2 changes: 1 addition & 1 deletion src/Provider/Exception/ClassNotCreated.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ClassNotCreated extends RuntimeException implements ProviderExceptionInter
{
public function __construct(string $id, Throwable $previous)
{
$message = "ReflectionClass not createable for `$id`";
$message = "ReflectionClass not createable for `{$id}`";
parent::__construct($message, 0, $previous);
}
}
2 changes: 1 addition & 1 deletion src/Provider/Exception/InvalidCacheKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class InvalidCacheKey extends RuntimeException implements ProviderExceptionInter
{
public function __construct(string $id, Throwable $previous)
{
$message = "Invalide cache key `$id`";
$message = "Invalide cache key `{$id}`";
parent::__construct($message, 0, $previous);
}
}
2 changes: 1 addition & 1 deletion src/Provider/Exception/NotFound.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ class NotFound extends RuntimeException implements ProviderExceptionInterface
{
public function __construct(string $id)
{
parent::__construct("Container `$id` not found");
parent::__construct("Container `${id}` not found");
}
}
10 changes: 5 additions & 5 deletions src/Provider/KeyValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ class KeyValue implements ProviderInterface
*/
private $values;

public function __construct(array $values)
{
$this->values = $values;
}

public static function stringToAlias(array $values): self
{
$result = [];
Expand All @@ -27,11 +32,6 @@ public static function stringToAlias(array $values): self
return new self($result);
}

public function __construct(array $values)
{
$this->values = $values;
}

public function provide(string $id)
{
if (!$this->canProvide($id)) {
Expand Down

0 comments on commit 53c1149

Please sign in to comment.