Skip to content
This repository was archived by the owner on Jan 8, 2024. It is now read-only.

Commit 57533e5

Browse files
committed
Merge remote-tracking branch 'origin/V2'
# Conflicts: # Resources/views/data_collector/template.html.twig # Service/Cache.php # Twig/CacheExtension/Node/CacheNode.php # composer.lock # phpFastCacheBundle.php # tests/SyntaxChecker.test.php
2 parents 2fd3b46 + e35757c commit 57533e5

File tree

12 files changed

+74
-96
lines changed

12 files changed

+74
-96
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## 2.0.1
2+
##### 16 february 2018
3+
- __Global__
4+
- Updated **@phpfastcache** service to be provided by a service factory to avoid multiprocessor issues with PhpUnit (@geolim4)
5+
- __Data collector__
6+
- Fixed critical Symfony 3.4 issue (@geolim4)
7+
8+
## 2.0.0
9+
##### 01 july 2017
10+
- __Global__
11+
- First 2.x release, yay !

Command/phpFastCacheCommand.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
namespace phpFastCache\Bundle\Command;
1818

19-
use phpFastCache\Cache\ExtendedCacheItemPoolInterface;
2019
use phpFastCache\Exceptions\phpFastCacheDriverCheckException;
2120
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
2221
use Symfony\Component\Console\Input\InputArgument;

DataCollector/CacheCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function collect(Request $request, Response $response, \Exception $except
5858
$instances = [];
5959
$driverUsed = [];
6060

61-
/** @var $cache */
61+
/** @var \phpFastCache\Cache\ExtendedCacheItemPoolInterface $cache */
6262
foreach ($this->cache->getInstances() as $instanceName => $cache) {
6363
if ($cache->getStats()->getSize()) {
6464
$size += $cache->getStats()->getSize();

Resources/config/services.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ parameters:
77

88
services:
99
phpfastcache:
10+
factory: ['%php_fast_cache.cache.class%', 'getInstance']
1011
class: "%php_fast_cache.cache.class%"
1112
arguments:
1213
- "%phpfastcache%"

Resources/views/data_collector/template.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* @author Khoa Bui (khoaofgod) <[email protected]> http://www.phpfastcache.com
1111
#}
1212

13-
{% extends 'WebProfilerBundle:Profiler:layout.html.twig' %}
13+
{% extends '@WebProfiler/Profiler/layout.html.twig' %}
1414

1515
{% block toolbar %}
1616
{% set icon %}

Service/Cache.php

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
namespace phpFastCache\Bundle\Service;
1717

18-
use phpFastCache\Cache\ExtendedCacheItemPoolInterface;
18+
use phpFastCache\Core\Pool\ExtendedCacheItemPoolInterface;
1919
use phpFastCache\CacheManager;
2020
use phpFastCache\Exceptions\phpFastCacheDriverException;
2121
use Symfony\Component\Stopwatch\Stopwatch;
@@ -26,10 +26,15 @@
2626
*/
2727
class Cache
2828
{
29+
/**
30+
* @var self
31+
*/
32+
protected static $selfInstance;
33+
2934
/**
3035
* @var array
3136
*/
32-
private $config = [];
37+
protected $config = [];
3338

3439
/**
3540
* @var Stopwatch
@@ -39,9 +44,9 @@ class Cache
3944
/**
4045
* Contains all cache instances
4146
*
42-
* @var \phpFastCache\Cache\ExtendedCacheItemPoolInterface[]
47+
* @var \phpFastCache\Core\Pool\ExtendedCacheItemPoolInterface[]
4348
*/
44-
private $cacheInstances = [];
49+
protected $cacheInstances = [];
4550

4651
/**
4752
* Cache constructor.
@@ -51,12 +56,26 @@ class Cache
5156
*
5257
* @throws \phpFastCache\Exceptions\phpFastCacheDriverException
5358
*/
54-
public function __construct($config, Stopwatch $stopwatch = null)
59+
protected function __construct($config, Stopwatch $stopwatch = null)
5560
{
5661
$this->config = (array) $config;
5762
$this->stopwatch = $stopwatch;
5863
}
5964

65+
/**
66+
* Factory instance provider
67+
*
68+
* @param array $config
69+
* @param Stopwatch $stopwatch
70+
*
71+
* @throws \phpFastCache\Exceptions\phpFastCacheDriverException
72+
* @return self
73+
*/
74+
public static function getInstance($config, Stopwatch $stopwatch = null)
75+
{
76+
return self::$selfInstance ?: self::$selfInstance = new self($config, $stopwatch);
77+
}
78+
6079
/**
6180
* Set a new cache instance
6281
*
@@ -65,7 +84,7 @@ public function __construct($config, Stopwatch $stopwatch = null)
6584
*
6685
* @throws \phpFastCache\Exceptions\phpFastCacheDriverException
6786
*/
68-
public function createInstance($name, ExtendedCacheItemPoolInterface $instance)
87+
public function createInstance($name, $instance)
6988
{
7089
if (array_key_exists($name, $this->cacheInstances) && $this->cacheInstances[ $name ] instanceof ExtendedCacheItemPoolInterface) {
7190
throw new phpFastCacheDriverException("Cache instance '{$name}' already exists");
@@ -78,7 +97,7 @@ public function createInstance($name, ExtendedCacheItemPoolInterface $instance)
7897
*
7998
* @param string $name Name of configured driver
8099
*
81-
* @return \phpFastCache\Cache\ExtendedCacheItemPoolInterface
100+
* @return \phpFastCache\Core\Pool\ExtendedCacheItemPoolInterface
82101
*
83102
* @throws \phpFastCache\Exceptions\phpFastCacheDriverException
84103
*/
@@ -106,7 +125,7 @@ public function get($name)
106125
}
107126

108127
/**
109-
* @return \phpFastCache\Cache\ExtendedCacheItemPoolInterface
128+
* @return \phpFastCache\Core\Pool\ExtendedCacheItemPoolInterface
110129
*/
111130
public function getTwigCacheInstance()
112131
{
@@ -126,7 +145,7 @@ public function getConfig()
126145
/**
127146
* Return all cache instances
128147
*
129-
* @return \phpFastCache\Cache\ExtendedCacheItemPoolInterface[]
148+
* @return \phpFastCache\Core\Pool\ExtendedCacheItemPoolInterface[]
130149
*/
131150
public function getInstances()
132151
{

Twig/CacheExtension/Node/CacheNode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class CacheNode extends \Twig_Node
2929
/**
3030
* @param \Twig_Node_Expression $annotation
3131
* @param \Twig_Node_Expression $keyInfo
32-
* @param \Twig_NodeInterface $body
32+
* @param \Twig_Node $body
3333
* @param integer $lineno
3434
* @param string $tag
3535
*/

Twig/HumanReadableExtension.php

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

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@
2727
}
2828
],
2929
"require": {
30-
"symfony/symfony": "^2.8|3.*",
31-
"phpFastCache/phpFastCache": "^5.0"
30+
"php": "^5.6 || ^7.0",
31+
"symfony/symfony": "^3.1",
32+
"phpFastCache/phpFastCache": "^6.0"
3233
},
3334
"autoload": {
3435
"psr-4": { "phpFastCache\\Bundle\\": "" }

composer.lock

Lines changed: 23 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phpFastCacheBundle.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@
2323
*/
2424
class phpFastCacheBundle extends Bundle
2525
{
26-
const VERSION = '1.0.4';
26+
const VERSION = '2.0.0';
2727
}

tests/SyntaxChecker.test.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ function read_dir($dir, $ext = null)
3838
/**
3939
* @todo Make the exclusions much cleaner
4040
*/
41-
if (strpos($file, '/vendor/') === false
41+
if (strpos($file, '/vendor/composer') === false
42+
&& strpos($file, '/vendor/symfony') === false
43+
&& strpos($file, '/vendor/doctrine') === false
44+
&& strpos($file, '/vendor/paragonie/random_compat') === false //random_int() patch
4245
&& strpos($file, '/bin/stubs') === false
4346
) {
4447
exec('php -l "' . $file . '"', $output, $status);

0 commit comments

Comments
 (0)