1
0
mirror of https://github.com/guzzle/guzzle.git synced 2025-01-17 21:38:16 +01:00

I think I'll remove functions.php

This commit is contained in:
Michael Dowling 2014-10-06 20:48:40 -07:00
parent eaaf949638
commit 4af718686c
4 changed files with 11 additions and 81 deletions

View File

@ -20,23 +20,9 @@ Adding support for non-blocking futures and some minor API cleanup.
* Added `GuzzleHttp\Pool` which implements FutureInterface and transfers
requests concurrently using a capped pool size as efficiently as possible.
* Added `hasListeners()` to EmitterInterface.
### Deprecations
* Removed `GuzzleHttp\ClientInterface::sendAll` and marked
`GuzzleHttp\Client::sendAll` as deprecated (it's still there, just not the
recommended way).
* Marked "functions.php" as deprecated, so that Guzzle is truly PSR-4 compliant.
functions.php is still available and autoloaded, but it is now deprecated.
These functions are now implemented in `GuzzleHttp\Utils` using camelCase.
`GuzzleHttp\json_decode` moved to `GuzzleHttp\Utils::jsonDecode`.
`GuzzleHttp\get_path` moved to `GuzzleHttp\Utils::getPath`.
`GuzzleHttp\set_path` moved to `GuzzleHttp\Utils::setPath`.
`GuzzleHttp\batch` should now be `GuzzleHttp\Pool::batch`, which returns a
`BatchResults` object instead of an `SplObjectStorage`. Using functions.php
caused problems for many users: they aren't PSR-4 compliant, require an
explicit include, and needed an if-guard to ensure that the functions are not
declared multiple times.
### Breaking changes
@ -51,6 +37,16 @@ interfaces.
why I did this: http://ocramius.github.io/blog/fluent-interfaces-are-evil/.
This also makes the Guzzle message interfaces compatible with the current
PSR-7 message proposal.
* Removed "functions.php", so that Guzzle is truly PSR-4 compliant. Except
for the HTTP request functions from function.psp, these functions are now
implemented in `GuzzleHttp\Utils` using camelCase. `GuzzleHttp\json_decode`
moved to `GuzzleHttp\Utils::jsonDecode`. `GuzzleHttp\get_path` moved to
`GuzzleHttp\Utils::getPath`. `GuzzleHttp\set_path` moved to
`GuzzleHttp\Utils::setPath`. `GuzzleHttp\batch` should now be
`GuzzleHttp\Pool::batch`, which returns a bjectStorage`. Using functions.php
caused problems for many users: they aren't PSR-4 compliant, require an
explicit include, and needed an if-guard to ensure that the functions are not
declared multiple times.
* Breaking changes to the adapter layer
* Removing all classes from `GuzzleHttp\Adapter`, these are now
implemented as callables that are stored in `GuzzleHttp\Ring\Client`.

View File

@ -25,8 +25,7 @@
"autoload": {
"psr-4": {
"GuzzleHttp\\": "src/"
},
"files": ["src/functions.php"]
}
},
"autoload-dev": {
"psr-4": {

View File

@ -379,9 +379,6 @@ class Client implements ClientInterface
RingBridge::completeRingResponse(
$t, $value, $this->messageFactory, $this->fsm
);
if ($t->exception) {
throw RequestException::wrapException($t->request, $t->exception);
}
return $t->response;
}
);

View File

@ -1,62 +0,0 @@
<?php
/*
* This file is here for backwards compatibility with Guzzle 4. Use the
* functions available on GuzzleHttp\Utils instead.
*/
namespace GuzzleHttp;
if (!defined('GUZZLE_FUNCTIONS_VERSION')) {
define('GUZZLE_FUNCTIONS_VERSION', ClientInterface::VERSION);
/**
* @param ClientInterface $client
* @param array $requests
* @param array $options
* @return \SplObjectStorage For backwards compatibility with v4
* @deprecated Use GuzzleHttp\Pool::batch
*/
function batch(ClientInterface $client, $requests, array $options = [])
{
$result = Pool::batch($client, $requests, $options);
$hash = new \SplObjectStorage();
foreach ($result->getKeys() as $request) {
$hash[$request] = $result->getResult($request);
}
return $hash;
}
/**
* @deprecated Use GuzzleHttp\Utils::getPath
*/
function get_path($data, $path)
{
return Utils::getPath($data, $path);
}
/**
* @deprecated Use GuzzleHttp\Utils::setPath
*/
function set_path(&$data, $path, $value)
{
Utils::setPath($data, $path, $value);
}
/**
* @deprecated Use GuzzleHttp\Utils::uriTemplate
*/
function uri_template($template, array $variables)
{
return Utils::uriTemplate($template, $variables);
}
/**
* @deprecated Use GuzzleHttp\Utils::jsonDecode
*/
function json_decode($json, $assoc = false, $depth = 512, $options = 0)
{
return Utils::jsonDecode($json, $assoc, $depth, $options);
}
}