Skip to content

Commit

Permalink
Merge branch '#ZF2-151' of github.com:robertboloc/zf2 into #ZF2-151
Browse files Browse the repository at this point in the history
  • Loading branch information
robertmarsal committed Oct 9, 2012
2 parents 8680745 + 4cf730f commit 86e3975
Show file tree
Hide file tree
Showing 265 changed files with 647 additions and 390 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ before_install:

script:
- php ./tests/run-tests.php
- output=$(php php-cs-fixer.phar fix -v --dry-run --level=psr2 .); if [[ $output ]]; then while read -r line; do echo -e "\e[00;31m$line\e[00m"; done <<< "$output"; false; fi;
- output=$(php php-cs-fixer.phar fix -v --dry-run --level=psr2 library); if [[ $output ]]; then while read -r line; do echo -e "\e[00;31m$line\e[00m"; done <<< "$output"; false; fi;
- output=$(php php-cs-fixer.phar fix -v --dry-run --level=psr2 tests); if [[ $output ]]; then while read -r line; do echo -e "\e[00;31m$line\e[00m"; done <<< "$output"; false; fi;
- output=$(php php-cs-fixer.phar fix -v --dry-run --level=psr2 bin); if [[ $output ]]; then while read -r line; do echo -e "\e[00;31m$line\e[00m"; done <<< "$output"; false; fi;

notifications:
irc: "irc.freenode.org#zftalk.dev"
Expand Down
2 changes: 1 addition & 1 deletion demos/Zend/ProgressBar/Upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function makeRequest(url)
if (httpRequest.overrideMimeType) {
httpRequest.overrideMimeType('text/xml');
}
} elseif (window.ActiveXObject) {
} else if (window.ActiveXObject) {
try {
httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Authentication/Adapter/Ldap.php
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ protected function prepareOptions(ZendLdap\Ldap $ldap, array $options)
unset($options[$key]);
switch ($key) {
case 'groupScope':
$value = (int)$value;
$value = (int) $value;
if (in_array($value, array(ZendLdap\Ldap::SEARCH_SCOPE_BASE,
ZendLdap\Ldap::SEARCH_SCOPE_ONE, ZendLdap\Ldap::SEARCH_SCOPE_SUB), true)) {
$adapterOptions[$key] = $value;
Expand Down
1 change: 0 additions & 1 deletion library/Zend/Cache/Pattern/CallbackCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
namespace Zend\Cache\Pattern;

use Zend\Cache\Exception;
use Zend\Cache\StorageFactory;
use Zend\Stdlib\ErrorHandler;

/**
Expand Down
1 change: 0 additions & 1 deletion library/Zend/Cache/Pattern/OutputCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
namespace Zend\Cache\Pattern;

use Zend\Cache\Exception;
use Zend\Cache\StorageFactory;

/**
* @category Zend
Expand Down
1 change: 0 additions & 1 deletion library/Zend/Cache/Storage/Adapter/AbstractZendServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

namespace Zend\Cache\Storage\Adapter;

use ArrayObject;
use stdClass;
use Zend\Cache\Exception;
use Zend\Cache\Storage\Capabilities;
Expand Down
1 change: 0 additions & 1 deletion library/Zend/Cache/Storage/Adapter/Apc.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
namespace Zend\Cache\Storage\Adapter;

use APCIterator as BaseApcIterator;
use ArrayObject;
use stdClass;
use Traversable;
use Zend\Cache\Exception;
Expand Down
11 changes: 6 additions & 5 deletions library/Zend/Cache/Storage/Adapter/Dba.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,20 @@ public function getOptions()
*/
public function getTotalSpace()
{
if ($this->totalSpace !== null) {
if ($this->totalSpace === null) {
$pathname = $this->getOptions()->getPathname();

if ($pathname === '') {
throw new Exception\LogicException('No pathname to database file');
}

ErrorHandler::start();
$total = disk_total_space($pathname);
$total = disk_total_space(dirname($pathname));
$error = ErrorHandler::stop();
if ($total === false) {
throw new Exception\RuntimeException("Can't detect total space of '{$pathname}'", 0, $error);
}
$this->totalSpace = $total;

// clean total space buffer on change pathname
$events = $this->getEventManager();
Expand All @@ -142,7 +143,7 @@ public function getTotalSpace()
$events->detach($handle);
}
};
$handle = $events->attach($callback);
$handle = $events->attach('option', $callback);
}

return $this->totalSpace;
Expand All @@ -164,7 +165,7 @@ public function getAvailableSpace()
}

ErrorHandler::start();
$avail = disk_free_space($pathname);
$avail = disk_free_space(dirname($pathname));
$error = ErrorHandler::stop();
if ($avail === false) {
throw new Exception\RuntimeException("Can't detect free space of '{$pathname}'", 0, $error);
Expand Down Expand Up @@ -516,7 +517,7 @@ protected function _open()
protected function _close()
{
if ($this->handle) {
ErrorHandler::start(E_WARNING);
ErrorHandler::start(E_NOTICE);
dba_close($this->handle);
ErrorHandler::stop();
$this->handle = null;
Expand Down
7 changes: 3 additions & 4 deletions library/Zend/Cache/Storage/Adapter/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

namespace Zend\Cache\Storage\Adapter;

use ArrayObject;
use Exception as BaseException;
use GlobIterator;
use stdClass;
Expand All @@ -24,7 +23,6 @@
use Zend\Cache\Storage\FlushableInterface;
use Zend\Cache\Storage\IterableInterface;
use Zend\Cache\Storage\OptimizableInterface;
use Zend\Cache\Storage\StorageInterface;
use Zend\Cache\Storage\TaggableInterface;
use Zend\Cache\Storage\TotalSpaceCapableInterface;
use Zend\Stdlib\ErrorHandler;
Expand Down Expand Up @@ -385,7 +383,7 @@ public function optimize()
*/
public function getTotalSpace()
{
if ($this->totalSpace !== null) {
if ($this->totalSpace === null) {
$path = $this->getOptions()->getCacheDir();

ErrorHandler::start();
Expand All @@ -394,6 +392,7 @@ public function getTotalSpace()
if ($total === false) {
throw new Exception\RuntimeException("Can't detect total space of '{$path}'", 0, $error);
}
$this->totalSpace = $total;

// clean total space buffer on change cache_dir
$events = $this->getEventManager();
Expand All @@ -406,7 +405,7 @@ public function getTotalSpace()
$events->detach($handle);
}
};
$handle = $events->attach($callback);
$handle = $events->attach('option', $callback);
}

return $this->totalSpace;
Expand Down
3 changes: 1 addition & 2 deletions library/Zend/Cache/Storage/Adapter/Memcached.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

namespace Zend\Cache\Storage\Adapter;

use ArrayObject;
use Memcached as MemcachedResource;
use stdClass;
use Traversable;
Expand Down Expand Up @@ -476,7 +475,7 @@ protected function internalRemoveItems(array & $normalizedKeys)
*/
protected function internalIncrementItem(& $normalizedKey, & $value)
{
$value = (int)$value;
$value = (int) $value;
$newValue = $this->memcached->increment($normalizedKey, $value);

if ($newValue === false) {
Expand Down
1 change: 0 additions & 1 deletion library/Zend/Cache/Storage/Adapter/Memory.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

namespace Zend\Cache\Storage\Adapter;

use ArrayObject;
use stdClass;
use Zend\Cache\Exception;
use Zend\Cache\Storage\AvailableSpaceCapableInterface;
Expand Down
4 changes: 2 additions & 2 deletions library/Zend/Cache/Storage/Adapter/MemoryOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function getMemoryLimit()
// By default use half of PHP's memory limit if possible
$memoryLimit = $this->normalizeMemoryLimit(ini_get('memory_limit'));
if ($memoryLimit >= 0) {
$this->memoryLimit = (int)($memoryLimit / 2);
$this->memoryLimit = (int) ($memoryLimit / 2);
} else {
// disable memory limit
$this->memoryLimit = 0;
Expand All @@ -86,7 +86,7 @@ public function getMemoryLimit()
protected function normalizeMemoryLimit($value)
{
if (is_numeric($value)) {
return (int)$value;
return (int) $value;
}

if (!preg_match('/(\-?\d+)\s*(\w*)/', ini_get('memory_limit'), $matches)) {
Expand Down
5 changes: 2 additions & 3 deletions library/Zend/Cache/Storage/Adapter/WinCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

namespace Zend\Cache\Storage\Adapter;

use ArrayObject;
use stdClass;
use Traversable;
use Zend\Cache\Exception;
Expand Down Expand Up @@ -413,7 +412,7 @@ protected function internalIncrementItem(& $normalizedKey, & $value)
$options = $this->getOptions();
$prefix = $options->getNamespace() . $options->getNamespaceSeparator();
$internalKey = $prefix . $normalizedKey;
return wincache_ucache_inc($internalKey, (int)$value);
return wincache_ucache_inc($internalKey, (int) $value);
}

/**
Expand All @@ -429,7 +428,7 @@ protected function internalDecrementItem(& $normalizedKey, & $value)
$options = $this->getOptions();
$prefix = $options->getNamespace() . $options->getNamespaceSeparator();
$internalKey = $prefix . $normalizedKey;
return wincache_ucache_dec($internalKey, (int)$value);
return wincache_ucache_dec($internalKey, (int) $value);
}

/* status */
Expand Down
1 change: 0 additions & 1 deletion library/Zend/Cache/Storage/Adapter/WinCacheOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

namespace Zend\Cache\Storage\Adapter;

use Zend\Cache\Exception;

/**
* These are options specific to the APC adapter
Expand Down
3 changes: 1 addition & 2 deletions library/Zend/Cache/Storage/Adapter/ZendServerDisk.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

namespace Zend\Cache\Storage\Adapter;

use ArrayObject;
use Zend\Cache\Exception;
use Zend\Cache\Storage\AvailableSpaceCapableInterface;
use Zend\Cache\Storage\ClearByNamespaceInterface;
Expand Down Expand Up @@ -154,7 +153,7 @@ protected function zdcStore($internalKey, $value, $ttl)
*/
protected function zdcFetch($internalKey)
{
return zend_disk_cache_fetch((string)$internalKey);
return zend_disk_cache_fetch((string) $internalKey);
}

/**
Expand Down
3 changes: 1 addition & 2 deletions library/Zend/Cache/Storage/Adapter/ZendServerShm.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

namespace Zend\Cache\Storage\Adapter;

use ArrayObject;
use Zend\Cache\Exception;
use Zend\Cache\Storage\ClearByNamespaceInterface;
use Zend\Cache\Storage\FlushableInterface;
Expand Down Expand Up @@ -111,7 +110,7 @@ protected function zdcStore($internalKey, $value, $ttl)
*/
protected function zdcFetch($internalKey)
{
return zend_shm_cache_fetch((string)$internalKey);
return zend_shm_cache_fetch((string) $internalKey);
}

/**
Expand Down
2 changes: 0 additions & 2 deletions library/Zend/Cache/Storage/Plugin/ClearExpiredByFactor.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@

namespace Zend\Cache\Storage\Plugin;

use Traversable;
use Zend\Cache\Exception;
use Zend\Cache\Storage\ClearExpiredInterface;
use Zend\Cache\Storage\PostEvent;
use Zend\Cache\Storage\StorageInterface;
use Zend\EventManager\EventManagerInterface;

/**
Expand Down
1 change: 0 additions & 1 deletion library/Zend/Cache/Storage/Plugin/ExceptionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

namespace Zend\Cache\Storage\Plugin;

use Traversable;
use Zend\Cache\Exception;
use Zend\Cache\Storage\ExceptionEvent;
use Zend\EventManager\EventManagerInterface;
Expand Down
1 change: 0 additions & 1 deletion library/Zend/Cache/Storage/Plugin/OptimizeByFactor.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

namespace Zend\Cache\Storage\Plugin;

use Traversable;
use Zend\Cache\Exception;
use Zend\Cache\Storage\OptimizableInterface;
use Zend\Cache\Storage\PostEvent;
Expand Down
1 change: 0 additions & 1 deletion library/Zend/Cache/Storage/Plugin/Serializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
namespace Zend\Cache\Storage\Plugin;

use stdClass;
use Traversable;
use Zend\Cache\Exception;
use Zend\Cache\Storage\Capabilities;
use Zend\Cache\Storage\Event;
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Cache/StorageFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public static function factory($cfg)
$adapterOptions = array_merge($adapterOptions, $cfg['options']);
}

$adapter = static::adapterFactory((string)$adapterName, $adapterOptions);
$adapter = static::adapterFactory((string) $adapterName, $adapterOptions);

// add plugins
if (isset($cfg['plugins'])) {
Expand Down
1 change: 0 additions & 1 deletion library/Zend/Captcha/ReCaptcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
namespace Zend\Captcha;

use Traversable;
use Zend\Form\Element;
use ZendService\ReCaptcha\ReCaptcha as ReCaptchaService;

/**
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Code/Generator/BodyGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function setContent($content)
*/
public function getContent()
{
return (string)$this->content;
return (string) $this->content;
}

/**
Expand Down
1 change: 0 additions & 1 deletion library/Zend/Code/Reflection/DocBlockReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
namespace Zend\Code\Reflection;

use Reflector;
use Zend\Code\Annotation\AnnotationManager;
use Zend\Code\Scanner\DocBlockScanner;

/**
Expand Down
1 change: 0 additions & 1 deletion library/Zend/Code/Scanner/ClassScanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

namespace Zend\Code\Scanner;

use Zend\Code\Annotation\AnnotationManager;
use Zend\Code\Exception;
use Zend\Code\NameInformation;

Expand Down
1 change: 0 additions & 1 deletion library/Zend/Config/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use ArrayAccess;
use Countable;
use Iterator;
use Zend\Stdlib\ArrayUtils;

/**
* Provides a property based interface to an array.
Expand Down
6 changes: 3 additions & 3 deletions library/Zend/Console/Adapter/Posix.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,15 @@ public function getWidth()
* Try to read env variable
*/
if (($result = getenv('COLUMNS')) !== false) {
return $width = (int)$result;
return $width = (int) $result;
}

/**
* Try to read console size from "tput" command
*/
$result = exec('tput cols', $output, $return);
if (!$return && is_numeric($result)) {
return $width = (int)$result;
return $width = (int) $result;
}

return $width = parent::getWidth();
Expand All @@ -145,7 +145,7 @@ public function getHeight()
// Try to read console size from "tput" command
$result = exec('tput lines', $output, $return);
if (!$return && is_numeric($result)) {
return $height = (int)$result;
return $height = (int) $result;
}

return $height = parent::getHeight();
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Console/Adapter/Windows.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function getHeight()
}

if (count($this->probeResult) && (int) $this->probeResult[1]) {
$height = (int)$this->probeResult[1];
$height = (int) $this->probeResult[1];
} else {
$height = parent::getheight();
}
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Console/Prompt/Number.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function show()
* Cast proper type
*/
if ($number !== null) {
$number = $this->allowFloat ? (double)$number : (int)$number;
$number = $this->allowFloat ? (double) $number : (int) $number;
}

return $this->lastResponse = $number;
Expand Down
Loading

0 comments on commit 86e3975

Please sign in to comment.