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

[2.1] fixed tons of missing/wrong use statements #3496

Merged
merged 7 commits into from Jan 21, 2013
9 changes: 5 additions & 4 deletions library/Zend/Http/Client/Cookies.php
Expand Up @@ -10,10 +10,11 @@

namespace Zend\Http\Client;

use ArrayIterator;
use Traversable;
use Zend\Http\Header\SetCookie;
use Zend\Stdlib\ArrayUtils;
use Zend\Http\Response;
use Zend\Stdlib\ArrayUtils;
use Zend\Uri;

/**
Expand Down Expand Up @@ -259,7 +260,7 @@ protected function _flattenCookiesArray($ptr, $retAs = self::COOKIE_OBJECT)
}
}
return $ret;
} elseif ($ptr instanceof Cookie) {
} elseif ($ptr instanceof SetCookie) {
switch ($retAs) {
case self::COOKIE_STRING_ARRAY:
return array($ptr->__toString());
Expand Down Expand Up @@ -290,7 +291,7 @@ protected function _matchDomain($domain)
$ret = array();

foreach (array_keys($this->cookies) as $cdom) {
if (Cookie::matchCookieDomain($cdom, $domain)) {
if (SetCookie::matchCookieDomain($cdom, $domain)) {
$ret[$cdom] = $this->cookies[$cdom];
}
}
Expand All @@ -311,7 +312,7 @@ protected function _matchPath($domains, $path)

foreach ($domains as $dom => $pathsArray) {
foreach (array_keys($pathsArray) as $cpath) {
if (Cookie::matchCookiePath($cpath, $path)) {
if (SetCookie::matchCookiePath($cpath, $path)) {
if (! isset($ret[$dom])) {
$ret[$dom] = array();
}
Expand Down
7 changes: 4 additions & 3 deletions library/Zend/Http/Header/SetCookie.php
Expand Up @@ -11,6 +11,7 @@
namespace Zend\Http\Header;

use Closure;
use Zend\Uri\UriFactory;

/**
* @throws Exception\InvalidArgumentException
Expand Down Expand Up @@ -510,16 +511,16 @@ public function isValidForRequest($requestDomain, $path, $isSecure = false)
/**
* Checks whether the cookie should be sent or not in a specific scenario
*
* @param string|Zend\Uri $uri URI to check against (secure, domain, path)
* @param string|Zend\Uri\Uri $uri URI to check against (secure, domain, path)
* @param boolean $matchSessionCookies Whether to send session cookies
* @param int $now Override the current time when checking for expiry time
* @return boolean
*/
public function match($uri, $matchSessionCookies = true, $now = null)
{
if (is_string ($uri)) {
$uri = Zend\Uri\UriFactory::factory($uri);
}
$uri = UriFactory::factory($uri);
}

// Make sure we have a valid Zend_Uri_Http object
if (! ($uri->isValid() && ($uri->getScheme() == 'http' || $uri->getScheme() =='https'))) {
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Log/Writer/MongoDB.php
Expand Up @@ -110,7 +110,7 @@ public function setFormatter($formatter)
protected function doWrite(array $event)
{
if (null === $this->mongoCollection) {
throw new RuntimeException('MongoCollection must be defined');
throw new Exception\RuntimeException('MongoCollection must be defined');
}

if (isset($event['timestamp']) && $event['timestamp'] instanceof DateTime) {
Expand Down
2 changes: 2 additions & 0 deletions library/Zend/Session/Storage/SessionArrayStorage.php
Expand Up @@ -11,7 +11,9 @@
namespace Zend\Session\Storage;

use ArrayAccess;
use ArrayIterator;
use IteratorAggregate;
use Zend\Session\Exception;

/**
* Session storage in $_SESSION
Expand Down
2 changes: 2 additions & 0 deletions library/Zend/Stdlib/Hydrator/ClassMethods.php
Expand Up @@ -11,7 +11,9 @@
namespace Zend\Stdlib\Hydrator;

use ReflectionMethod;
use Traversable;
use Zend\Stdlib\Exception;
use Zend\Stdlib\ArrayUtils;
use Zend\Stdlib\Hydrator\Filter\FilterComposite;
use Zend\Stdlib\Hydrator\Filter\FilterProviderInterface;
use Zend\Stdlib\Hydrator\Filter\MethodMatchFilter;
Expand Down
Expand Up @@ -18,6 +18,7 @@
use Zend\Mvc\SendResponseListener;
use Zend\Stdlib\Exception\LogicException;
use Zend\Stdlib\Parameters;
use Zend\Stdlib\ResponseInterface;
use Zend\Uri\Http as HttpUri;
use Zend\View\Helper\Placeholder;

Expand Down Expand Up @@ -180,7 +181,7 @@ public function getRequest()

/**
* Get the application response object
* @return \Zend\Stdlib\ResponseInterface
* @return ResponseInterface
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we do not add a use just for something that is in a comment (at least someone told me not to do one day).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bakura10 We often do this to make the comments more readable and coherent.
Since phpdoc and most ides resolve them based on the imports/namespace,
they continue to document correctly. Since PHP does not expand an import or
try to autoload it unless the code actually references it, it's a no-op for
the engine.

On Saturday, January 19, 2013, Michaël Gallego wrote:

In library/Zend/Test/PHPUnit/Controller/AbstractControllerTestCase.php:

@@ -180,7 +181,7 @@ public function getRequest()

 /**
  * Get the application response object
  • \* @return \Zend\Stdlib\ResponseInterface
    
  • \* @return ResponseInterface
    

I think we do not add a use just for something that is in a comment (at
least someone told me not to do one day).


Reply to this email directly or view it on GitHubhttps://github.com//pull/3496/files#r2706310.

Matthew Weier O'Phinney
matthew@weierophinney.net
http://mwop.net/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing this we miss the possibility of scan use statements for detect direct dependencies

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*/
public function getResponse()
{
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/XmlRpc/Client/ServerIntrospection.php
Expand Up @@ -48,7 +48,7 @@ public function getSignatureForEachMethod()

try {
$signatures = $this->getSignatureForEachMethodByMulticall($methods);
} catch (FaultException $e) {
} catch (Exception\FaultException $e) {
// degrade to looping
}

Expand Down