From 3e3b547762c974bd92820b91528644f7c11284d0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Guillaume=20Perr=C3=A9al?= <guillaume.perreal@irstea.fr>
Date: Mon, 27 Jan 2020 11:37:45 +0100
Subject: [PATCH] Supprime le cache.

Probablement peu utile.
---
 composer.json                   |  3 --
 src/Config.php                  |  7 +----
 src/Git/CachedGitRepository.php | 55 ---------------------------------
 3 files changed, 1 insertion(+), 64 deletions(-)
 delete mode 100644 src/Git/CachedGitRepository.php

diff --git a/composer.json b/composer.json
index 5c0251e..0c59b08 100644
--- a/composer.json
+++ b/composer.json
@@ -14,9 +14,6 @@
     "ext-json": "*",
     "beberlei/assert": "^3.2",
     "friendsofphp/php-cs-fixer": "^2.16",
-    "symfony/event-dispatcher-contracts": "^1.1",
-    "symfony/cache": "^4.3",
-    "symfony/cache-contracts": "^1.1"
   },
   "require-dev": {
     "irstea/composer-require-checker-shim": "^2.0.0",
diff --git a/src/Config.php b/src/Config.php
index 032e645..ccf5e75 100644
--- a/src/Config.php
+++ b/src/Config.php
@@ -13,7 +13,6 @@ namespace Irstea\CS;
 use Irstea\CS\Composer\ComposerPackage;
 use Irstea\CS\Composer\ComposerPackageInterface;
 use Irstea\CS\FileLocator\FileLocator;
-use Irstea\CS\Git\CachedGitRepository;
 use Irstea\CS\Git\GitRepository;
 use Irstea\CS\HeaderComment\ChainTemplateProvider;
 use Irstea\CS\HeaderComment\FormattedHeaderProvider;
@@ -22,7 +21,6 @@ use Irstea\CS\HeaderComment\LicenseTemplateProvider;
 use Irstea\CS\HeaderComment\TemplateFormatter;
 use Irstea\CS\HeaderComment\UserDefinedTemplateProvider;
 use PhpCsFixer\Config as PhpCsFixerConfig;
-use Symfony\Component\Cache\Adapter\ArrayAdapter;
 
 /**
  * Class Config.
@@ -168,10 +166,7 @@ final class Config extends PhpCsFixerConfig
         $fileLocator = new FileLocator($callerPath);
         $composerPackage = new ComposerPackage($fileLocator);
 
-        $cache = new ArrayAdapter();
-
-        $backendGitRepository = new GitRepository($callerPath);
-        $gitRepository = new CachedGitRepository($backendGitRepository, $cache);
+        $gitRepository = new GitRepository($callerPath);
 
         $headerProvider = new FormattedHeaderProvider(
             new ChainTemplateProvider(
diff --git a/src/Git/CachedGitRepository.php b/src/Git/CachedGitRepository.php
deleted file mode 100644
index 52fc383..0000000
--- a/src/Git/CachedGitRepository.php
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php declare(strict_types=1);
-/*
- * irstea/php-cs-fixer-config - Jeux de règles pour php-cs-fixer.
- * Copyright (C) 2018-2020 IRSTEA
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- *
- */
-
-namespace Irstea\CS\Git;
-
-use Symfony\Contracts\Cache\CacheInterface;
-
-/**
- * Class CachedGitRepository.
- */
-final class CachedGitRepository implements GitRepositoryInterface
-{
-    /**
-     * @var GitRepositoryInterface
-     */
-    private $inner;
-
-    /**
-     * @var CacheInterface
-     */
-    private $cache;
-
-    /**
-     * CachedGitRepository constructor.
-     */
-    public function __construct(GitRepositoryInterface $inner, CacheInterface $cache)
-    {
-        $this->inner = $inner;
-        $this->cache = $cache;
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function getHeadCommit(): string
-    {
-        // Jamais mis en cache !
-        return $this->inner->getHeadCommit();
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function getYearRange(): string
-    {
-        return $this->cache->get('git.year-range', [$this->inner, 'getYearRange']);
-    }
-}
-- 
GitLab