Skip to content

Commit 9ddd502

Browse files
s3b4stianStyleCIBot
authored andcommitted
Apply fixes from StyleCI
1 parent 71c4e4f commit 9ddd502

File tree

3 files changed

+27
-20
lines changed

3 files changed

+27
-20
lines changed

src/intArray.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,24 @@
1313

1414
use ArrayObject;
1515
use TypeError;
16+
1617
/**
1718
* Create an array of integer elements.
1819
*/
1920
class intArray extends ArrayObject
2021
{
2122
/**
2223
* Contructor.
23-
*
24+
*
2425
* @param array $array
26+
*
2527
* @throws TypeError
2628
*/
2729
public function __construct(array $array = [])
2830
{
2931
//for not utilize foreach, compare sizes of array
3032
//before and after apply a filter :)
31-
if (count($array) > count(array_filter($array, 'is_int'))){
33+
if (count($array) > count(array_filter($array, 'is_int'))) {
3234
throw new TypeError('Elements passed to '.__CLASS__.' must be of the type integer');
3335
}
3436

@@ -38,16 +40,19 @@ public function __construct(array $array = [])
3840

3941
/**
4042
* Array style value assignment.
41-
*
43+
*
4244
* @param mixed $index
4345
* @param mixed $newval
44-
* @return void
46+
*
4547
* @throws TypeError If value passed to $newval is not integer
48+
*
49+
* @return void
4650
*/
4751
public function offsetSet($index, $newval)
4852
{
4953
if (is_int($newval)) {
5054
parent::offsetSet($index, $newval);
55+
5156
return;
5257
}
5358

tests/bootstrap.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@
77
* @copyright (c) 2017, Sebastian Rapetti
88
* @license http://opensource.org/licenses/MIT MIT License
99
*/
10-
1110
include dirname(__DIR__).'/src/intArray.php';

tests/intArrayTest.php

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,21 @@ class intArrayTest extends TestCase
1616
{
1717
public function testCreateInstance()
1818
{
19-
$this->assertInstanceOf(intArray::class, (new intArray([1,2,3,4,5])));
19+
$this->assertInstanceOf(intArray::class, (new intArray([1, 2, 3, 4, 5])));
2020
}
21-
21+
2222
public function BadArgumentsProvider()
2323
{
2424
return [
25-
[[null,null,null]],
26-
[[true,false,true]],
27-
[['a','b','c']],
25+
[[null, null, null]],
26+
[[true, false, true]],
27+
[['a', 'b', 'c']],
2828
[[1.1, 2.1, 3.1]],
29-
[[[1],[2],[3]]],
30-
[[(object)[1],(object)[2],(object)[3]]],
31-
[[function () {}, function () {}]],
29+
[[[1], [2], [3]]],
30+
[[(object) [1], (object) [2], (object) [3]]],
31+
[[function () {
32+
}, function () {
33+
}]],
3234
];
3335
}
3436

@@ -40,15 +42,15 @@ public function testCreateInstanceWithBadArray($array)
4042
{
4143
(new intArray($array));
4244
}
43-
45+
4446
public function testArrayStyleAssign()
4547
{
46-
$intArray = new intArray([1,2,3,4]);
48+
$intArray = new intArray([1, 2, 3, 4]);
4749
$intArray[] = 6;
48-
50+
4951
$this->assertEquals(5, $intArray->count());
5052
}
51-
53+
5254
public function BadValueProvider()
5355
{
5456
return [
@@ -57,8 +59,9 @@ public function BadValueProvider()
5759
['e'],
5860
[1.1],
5961
[[1]],
60-
[(object)[1]],
61-
[function () {}],
62+
[(object) [1]],
63+
[function () {
64+
}],
6265
];
6366
}
6467

@@ -68,7 +71,7 @@ public function BadValueProvider()
6871
*/
6972
public function testArrayStyleAssignBadValue($value)
7073
{
71-
$intArray = new intArray([1,2,3,4]);
74+
$intArray = new intArray([1, 2, 3, 4]);
7275
$intArray[] = $value;
7376
}
7477
}

0 commit comments

Comments
 (0)