Skip to content

[V5˖] Migrating your code to the V6

Georges.L edited this page Oct 16, 2016 · 6 revisions

⚠️ This wiki page applies to the V6 which is still in development ⚠️


Because the V6 is not backward compatible with the V5 we will help you to migrate your code:

Type hint of Driver instances

🕐 Then:

Driver instances used to implements a phpFastCache\Cache\ExtendedCacheItemPoolInterface interface.

namespace My\Custom\Project;


$instance = CacheManager::getInstance('Files');

if($instance instanceof \phpFastCache\Cache\ExtendedCacheItemPoolInterface)
{
    // Some code
}

⏰ Now:

This has been changed and they now implements a phpFastCache\Core\Pool\ExtendedCacheItemPoolInterface interface

namespace My\Custom\Project;


$instance = CacheManager::getInstance('Files');

if($instance instanceof \phpFastCache\Core\Pool\ExtendedCacheItemPoolInterface)
{
    // Some code
}

Type hint of Item instances

🕐 Then:

Item instances used to implements a phpFastCache\Cache\ExtendedCacheItemInterface interface.

namespace My\Custom\Project;


$instance = CacheManager::getInstance('Files');
$item = $instance->getItem('key');


if($item instanceof \phpFastCache\Cache\ExtendedCacheItemInterface)
{
    // Some code
}

⏰ Now:

This has been changed and it now returns a phpFastCache\Core\Item\ExtendedCacheItemInterface interface

namespace My\Custom\Project;


$instance = CacheManager::getInstance('Files');
$item = $instance->getItem('key');


if($item instanceof \phpFastCache\Core\Item\ExtendedCacheItemInterface)
{
    // Some code
}
Clone this wiki locally