Skip to content

Commit

Permalink
Two methods instead of one with a flag
Browse files Browse the repository at this point in the history
  • Loading branch information
robertbasic committed Feb 8, 2018
1 parent 4730b35 commit 4b19d53
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
4 changes: 2 additions & 2 deletions docs/mockery/configuration.rst
Expand Up @@ -66,12 +66,12 @@ We suggest turning off the reflection cache as so:

.. code-block:: php
\Mockery::getConfiguration()->toggleReflectionCache(false);
\Mockery::getConfiguration()->disableReflectionCache();
Turning it back on can be done like so:

.. code-block:: php
\Mockery::getConfiguration()->toggleReflectionCache(true);
\Mockery::getConfiguration()->enableReflectionCache();
In no other situation should you be required turn this reflection cache off.
19 changes: 16 additions & 3 deletions library/Mockery/Configuration.php
Expand Up @@ -155,16 +155,29 @@ public function getConstantsMap()
}

/**
* Toggle reflection caching
* Disable reflection caching
*
* It should be always enabled, except when using
* PHPUnit's --static-backup option.
*
* @see https://github.com/mockery/mockery/issues/268
*/
public function toggleReflectionCache($flag = true)
public function disableReflectionCache()
{
$this->_reflectionCacheEnabled = (bool) $flag;
$this->_reflectionCacheEnabled = false;
}

/**
* Enable reflection caching
*
* It should be always enabled, except when using
* PHPUnit's --static-backup option.
*
* @see https://github.com/mockery/mockery/issues/268
*/
public function enableReflectionCache()
{
$this->_reflectionCacheEnabled = true;
}

/**
Expand Down

0 comments on commit 4b19d53

Please sign in to comment.