Skip to content

Commit 5c6ddbf

Browse files
authored
Merge pull request #11 from ingenerator/namespace-global-functions
Run php-cs-fixer native_function_invocation fix
2 parents f900314 + 86251ef commit 5c6ddbf

18 files changed

+90
-88
lines changed

.travis.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
sudo: false
22
language: php
33
php:
4-
- '5.5'
5-
- '5.6'
6-
- '7.1'
74
- '7.2'
85

96
# Only build main branches : feature branches will be covered by the PR builder

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
### Unreleased
22

3+
### v0.2.0 (2019-04-02)
4+
5+
* Drop support for php < 7.2
6+
* Run test suite against php 7.2
7+
38
### v0.1.6 (2019-03-18)
49

510
* Update StoppedMockClock to support newer phpunit (use namespaced assert class) and add

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
}
1616
],
1717
"require": {
18-
"php": "^5.5||^7.0"
18+
"php": "^7.2"
1919
},
2020
"require-dev": {
21-
"phpunit/phpunit": "^4.8||^6.5",
22-
"johnkary/phpunit-speedtrap": "^1.0||^2.0"
21+
"phpunit/phpunit": "^6.5",
22+
"johnkary/phpunit-speedtrap": "^2.0"
2323
},
2424
"support": {
2525
"source": "https://github.com/ingenerator/php-utils",

src/CSV/CSVWriter.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,19 @@ class CSVWriter
4141
*/
4242
public function open($file, array $options = [])
4343
{
44-
if (is_resource($file) AND (get_resource_type($file) === 'stream')) {
44+
if (\is_resource($file) AND (\get_resource_type($file) === 'stream')) {
4545
$this->resource = $file;
4646
$this->owns_resource = FALSE;
47-
} elseif (is_string($file)) {
48-
$this->resource = fopen($file, 'w');
47+
} elseif (\is_string($file)) {
48+
$this->resource = \fopen($file, 'w');
4949
$this->owns_resource = TRUE;
5050
} else {
5151
throw new \InvalidArgumentException(
5252
'Expected `file` to be string or an existing resource'
5353
);
5454
}
5555
$this->expect_schema = NULL;
56-
$this->options = array_merge($this->options, $options);
56+
$this->options = \array_merge($this->options, $options);
5757
}
5858

5959
/**
@@ -65,24 +65,24 @@ public function write(array $row)
6565
throw new \LogicException('Cannot write to a closed file');
6666
}
6767

68-
$row_schema = array_keys($row);
68+
$row_schema = \array_keys($row);
6969

7070
if ($this->expect_schema === NULL) {
7171
if ($this->options['write_utf8_bom']) {
72-
fputs($this->resource, static::UTF8_BOM);
72+
\fputs($this->resource, static::UTF8_BOM);
7373
}
7474
$this->expect_schema = $row_schema;
75-
fputcsv($this->resource, $this->expect_schema);
75+
\fputcsv($this->resource, $this->expect_schema);
7676
} elseif ($this->expect_schema !== $row_schema) {
7777
throw MismatchedSchemaException::forSchema($this->expect_schema, $row_schema);
7878
}
7979

80-
fputcsv($this->resource, $row);
80+
\fputcsv($this->resource, $row);
8181
}
8282

8383
protected function isResourceOpen()
8484
{
85-
return $this->resource && (get_resource_type($this->resource) === 'stream');
85+
return $this->resource && (\get_resource_type($this->resource) === 'stream');
8686
}
8787

8888
public function close()
@@ -92,7 +92,7 @@ public function close()
9292
}
9393

9494
if ($this->owns_resource) {
95-
fclose($this->resource);
95+
\fclose($this->resource);
9696
}
9797

9898
$this->resource = NULL;

src/CSV/MismatchedSchemaException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ public static function forSchema(array $expected, array $actual)
1414
{
1515
return new static(
1616
'Mismatched row schema in CSV file:'."\n"
17-
.'Expected: '.json_encode($expected)."\n"
18-
.'Actual: '.json_encode($actual)
17+
.'Expected: '.\json_encode($expected)."\n"
18+
.'Actual: '.\json_encode($actual)
1919
);
2020
}
2121

src/DateTime/Clock/RealtimeClock.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ public function getDateTime()
2828
*/
2929
public function getMicrotime()
3030
{
31-
return microtime(TRUE);
31+
return \microtime(TRUE);
3232
}
3333

3434
/**
3535
* @param $microseconds
3636
*/
3737
public function usleep($microseconds)
3838
{
39-
usleep($microseconds);
39+
\usleep($microseconds);
4040
}
4141
}

src/DateTime/Clock/StoppedMockClock.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public static function atTimeAgo($interval_spec)
7979

8080
public function getDateTime()
8181
{
82-
return (new \DateTimeImmutable)->setTimestamp(floor($this->current_microtime));
82+
return (new \DateTimeImmutable)->setTimestamp(\floor($this->current_microtime));
8383
}
8484

8585
public function getMicrotime()

src/Object/ConstantDirectory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ public static function forClass($class)
4444
*/
4545
public function filterConstants($prefix)
4646
{
47-
$prefix_len = strlen($prefix);
47+
$prefix_len = \strlen($prefix);
4848
$consts = [];
4949
foreach ($this->listConstants() as $name => $value) {
50-
if (strncmp($name, $prefix, $prefix_len) === 0) {
50+
if (\strncmp($name, $prefix, $prefix_len) === 0) {
5151
$consts[$name] = $value;
5252
}
5353
}

src/Object/ObjectPropertyPopulator.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ public static function assign($object, $property, $value)
3535
*/
3636
public static function assignHash($object, array $properties)
3737
{
38-
if ($undefined = static::listUndefinedProperties($object, array_keys($properties))) {
38+
if ($undefined = static::listUndefinedProperties($object, \array_keys($properties))) {
3939
throw new \InvalidArgumentException(
40-
'Undefined properties on '.get_class($object).' : '.json_encode($undefined)
40+
'Undefined properties on '.\get_class($object).' : '.\json_encode($undefined)
4141
);
4242
}
4343

@@ -58,11 +58,11 @@ function ($object, array $properties) {
5858

5959
private static function listUndefinedProperties($object, array $property_names)
6060
{
61-
return array_values(
62-
array_filter(
61+
return \array_values(
62+
\array_filter(
6363
$property_names,
6464
function ($property_name) use ($object) {
65-
return ! property_exists($object, $property_name);
65+
return ! \property_exists($object, $property_name);
6666
}
6767
)
6868
);

src/Object/ObjectPropertyRipper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class ObjectPropertyRipper
2828
*/
2929
public static function rip($object, array $properties)
3030
{
31-
$ripper = static::getRipper(get_class($object));
31+
$ripper = static::getRipper(\get_class($object));
3232

3333
return $ripper($object, $properties);
3434
}

0 commit comments

Comments
 (0)