Skip to content

Commit 4679635

Browse files
authored
Addressing #8 (#9)
1 parent ebd2b66 commit 4679635

File tree

9 files changed

+104
-22
lines changed

9 files changed

+104
-22
lines changed

.travis.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
language: php
22
php:
3-
- '7.0'
43
- '7.1'
54
- '7.2'
65
- nightly
76

8-
matrix:
9-
allow_failures:
10-
- php: hhvm
11-
127
before_script:
138
- composer install
149

CHANGELOG.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
## [Unreleased]
8+
### Added
9+
- php 7 type hints.
10+
- This changelog
11+
12+
### Removed
13+
- php 5 support.
14+
- php 7.1 support.
15+
16+
### Fixed
17+
- Incorrect handling of uninitialized pass-by-ref argument in `CurlMulti::exec()` (#8).
18+
19+
### Changed
20+
- Documentation to reflect the interfaces.
21+
22+
## [2.1.0] - 2017-01-20
23+
### Added
24+
- `CurlInterface`.
25+
- `CurlMultiInterface`.
26+
- `CurlShareInterface`.
27+
28+
## [2.0.1] - 2017-01-20
29+
### Changed
30+
- Minor documentation improvements.
31+
32+
## [2.0.0] - 2017-01-20
33+
### Added
34+
- `Curl` object destructor to close the handler.
35+
- `Curl::getHandle()`.
36+
- `CurlMulti::init()`.
37+
- `CurlShare::init()`.
38+
39+
### Removed
40+
- php 5.3 and 5.4 support.
41+
- Retry on failure feature.
42+
- `CurlException` class.
43+
44+
### Changed
45+
- `Curl::version`, `Curl::strError`, `CurlMulti::strError` are not static anymore.
46+
47+
## [1.0.0] - 2016-02-02
48+
### Changed
49+
- The library moved to "phpcurl/curlwrapper".
50+
51+
## [0.1.2] - 2016-02-02
52+
### Fixed
53+
- The `$opt` flag should not be artificially set to 0.
54+
55+
## [0.1.1] - 2016-01-21
56+
### Changed
57+
- Minor documentation improvements.
58+
59+
## [0.1.0] - 2016-01-21
60+
### Added
61+
- Documentation
62+
- `CurlException` class.
63+
64+
## [0.0.2] - 2014-02-19
65+
### Changed
66+
- Test cleanup.
67+
68+
## 0.0.1 - 2014-02-17
69+
### Added
70+
- Initial version.
71+
72+
[Unreleased]: https://github.com/phpcurl/curlwrapper/compare/2.1.0...HEAD
73+
[2.1.0]: https://github.com/phpcurl/curlwrapper/compare/2.0.1...2.1.0
74+
[2.0.1]: https://github.com/phpcurl/curlwrapper/compare/2.0.0...2.0.1
75+
[2.0.0]: https://github.com/phpcurl/curlwrapper/compare/1.0.0...2.0.0
76+
[1.0.0]: https://github.com/phpcurl/curlwrapper/compare/0.1.2...1.0.0
77+
[0.1.2]: https://github.com/phpcurl/curlwrapper/compare/0.1.1...0.1.2
78+
[0.1.1]: https://github.com/phpcurl/curlwrapper/compare/0.1.0...0.1.1
79+
[0.1.0]: https://github.com/phpcurl/curlwrapper/compare/0.0.2...0.1.0
80+
[0.0.2]: https://github.com/phpcurl/curlwrapper/compare/0.0.1...0.0.2

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525
}
2626
],
2727
"require": {
28-
"php": ">=7.0.0",
28+
"php": ">=7.1.0",
2929
"ext-curl": "*"
3030
},
3131
"require-dev": {
32-
"phpunit/phpunit": "^4.8 || ^5.0",
32+
"phpunit/phpunit": "^7.0",
3333
"squizlabs/php_codesniffer": "^2.0"
3434
},
3535
"autoload": {

phpunit.xml.dist

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
convertNoticesToExceptions="true"
77
convertWarningsToExceptions="true"
88
stopOnFailure="false"
9-
verbose="true"
10-
syntaxCheck="true">
9+
verbose="true">
1110
<testsuites>
1211
<testsuite name="Main">
1312
<directory>./test</directory>

src/CurlMulti.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace PHPCurl\CurlWrapper;
34

45
class CurlMulti implements CurlMultiInterface
@@ -40,15 +41,15 @@ public function add(CurlInterface $curl): int
4041
/**
4142
* @inheritdoc
4243
*/
43-
public function exec(int &$stillRunning): int
44+
public function exec(int &$stillRunning = null): int
4445
{
4546
return curl_multi_exec($this->handle, $stillRunning);
4647
}
4748

4849
/**
4950
* @inheritdoc
5051
*/
51-
public function getContent(CurlInterface $curl): string
52+
public function getContent(CurlInterface $curl): ?string
5253
{
5354
return curl_multi_getcontent($curl->getHandle());
5455
}

src/CurlMultiInterface.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ public function add(CurlInterface $curl): int;
2626
* @param int $stillRunning Flag
2727
* @return int (One of CURLM_* constants)
2828
*/
29-
public function exec(int &$stillRunning): int;
29+
public function exec(int &$stillRunning = null): int;
3030

3131
/**
3232
* @see curl_multi_getcontent()
3333
*
3434
* @param CurlInterface $curl
35-
* @return string
35+
* @return string|null
3636
*/
37-
public function getContent(CurlInterface $curl): string;
37+
public function getContent(CurlInterface $curl): ?string;
3838

3939
/**
4040
* @see curl_multi_info_read()

test/CurlMultiTest.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<?php
2+
23
namespace PHPCurl\CurlWrapper;
34

5+
use PHPUnit\Framework\TestCase;
6+
47
function curl_multi_init()
58
{
69
return 'foo';
@@ -28,7 +31,7 @@ function curl_multi_getcontent($h)
2831

2932
function curl_multi_strerror($c)
3033
{
31-
return 'strerror_'.$c;
34+
return 'strerror_' . $c;
3235
}
3336

3437
function curl_multi_select($h, $t)
@@ -38,7 +41,7 @@ function curl_multi_select($h, $t)
3841

3942
function curl_multi_close($h)
4043
{
41-
CurlMultiTest::$log[] = 'close_'.$h;
44+
CurlMultiTest::$log[] = 'close_' . $h;
4245
}
4346

4447
function curl_multi_info_read($h, &$m)
@@ -50,12 +53,12 @@ function curl_multi_info_read($h, &$m)
5053
function curl_multi_exec($h, &$r)
5154
{
5255
$r = 24;
53-
return $h === 'foo' ? 1 : 0;
56+
return $h === 'foo' ? 1 : 0;
5457
}
5558

56-
class CurlMultiTest extends \PHPUnit_Framework_TestCase
59+
class CurlMultiTest extends TestCase
5760
{
58-
static public $log = array();
61+
static public $log = [];
5962

6063
public function testAll()
6164
{

test/CurlShareTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?php
22
namespace PHPCurl\CurlWrapper;
33

4+
use PHPUnit\Framework\TestCase;
5+
46
function curl_share_close($h)
57
{
68
CurlShareTest::$log[] = 'close_'.$h;
@@ -16,7 +18,7 @@ function curl_share_setopt($h, $o, $v)
1618
return $h === 'foo' && $o === 0 && $v === 'val';
1719
}
1820

19-
class CurlShareTest extends \PHPUnit_Framework_TestCase
21+
class CurlShareTest extends TestCase
2022
{
2123
static public $log = array();
2224

test/CurlTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?php
22
namespace PHPCurl\CurlWrapper;
33

4+
use PHPUnit\Framework\TestCase;
5+
46
function curl_close($h)
57
{
68
CurlTest::$log[] = [__FUNCTION__, func_get_args()];
@@ -88,7 +90,7 @@ function curl_errno($h)
8890
return 42;
8991
}
9092

91-
class CurlTest extends \PHPUnit_Framework_TestCase
93+
class CurlTest extends TestCase
9294
{
9395
static public $log = [];
9496

@@ -119,7 +121,7 @@ public function testAll()
119121
],
120122
[
121123
'PHPCurl\\CurlWrapper\\curl_version',
122-
[3],
124+
[\CURLVERSION_NOW],
123125
],
124126
[
125127
'PHPCurl\\CurlWrapper\\curl_strerror',

0 commit comments

Comments
 (0)