Skip to content

Commit 2657a30

Browse files
committed
Updated test suite
1 parent 45d0d26 commit 2657a30

31 files changed

+180
-163
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# Third party
22
/composer.lock
33
/vendor
4+
/.php_cs.cache

.php_cs

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()
4+
->exclude('vendor')
5+
->in(__DIR__)
6+
;
7+
8+
return PhpCsFixer\Config::create()
9+
->setRules([
10+
'@Symfony' => true,
11+
'visibility_required' => false,
12+
'array_syntax' => [
13+
'syntax' => 'short',
14+
],
15+
])
16+
->setUsingCache(true)
17+
->setFinder($finder)
18+
;

.travis.yml

+3-7
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,13 @@ cache:
88

99
php:
1010
- 7.0
11-
- hhvm
12-
13-
matrix:
14-
allow_failures:
15-
- php: hhvm
11+
- 7.1
12+
- 7.2
1613

1714
before_script:
18-
- curl http://cs.sensiolabs.org/get/php-cs-fixer.phar -o php-cs-fixer.phar
1915
- composer selfupdate
2016
- composer update $COMPOSER_FLAGS
2117

2218
script:
2319
- echo '[phpspec] Running specification tests'; ./vendor/bin/phpspec run -n -f dot
24-
- output=$(php -n php-cs-fixer.phar fix -v --dry-run --config=sf23 .); if [[ $(grep -o F <<< $output | wc -l) -gt 3 ]]; then while read -r line; do echo -e "\e[00;31m$line\e[00m"; done <<< "$output"; false; fi;
20+
- output=$(php -n ./vendor/bin/php-cs-fixer` fix -v --dry-run .); if [[ $(grep -o F <<< $output | wc -l) -gt 3 ]]; then while read -r line; do echo -e "\e[00;31m$line\e[00m"; done <<< "$output"; false; fi;

composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
"php": "^7.0"
2121
},
2222
"require-dev": {
23-
"friendsofphp/php-cs-fixer": "^1.6",
24-
"phpspec/phpspec": "^3.0"
23+
"friendsofphp/php-cs-fixer": "^2.10",
24+
"phpspec/phpspec": "^4.3"
2525
},
2626
"extra": {
2727
"branch-alias": {

spec/Memio/Model/ContractSpec.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,22 @@ function it_can_have_phpdoc(StructurePhpdoc $phpdoc)
5757

5858
function it_can_extend_contracts(Contract $contract)
5959
{
60-
$this->allContracts()->shouldBe(array());
60+
$this->allContracts()->shouldBe([]);
6161
$this->extend($contract);
62-
$this->allContracts()->shouldBe(array($contract));
62+
$this->allContracts()->shouldBe([$contract]);
6363
}
6464

6565
function it_can_have_constants(Constant $constant)
6666
{
67-
$this->allConstants()->shouldBe(array());
67+
$this->allConstants()->shouldBe([]);
6868
$this->addConstant($constant);
69-
$this->allConstants()->shouldBe(array($constant));
69+
$this->allConstants()->shouldBe([$constant]);
7070
}
7171

7272
function it_can_have_methods(Method $method)
7373
{
74-
$this->allMethods()->shouldBe(array());
74+
$this->allMethods()->shouldBe([]);
7575
$this->addMethod($method);
76-
$this->allMethods()->shouldBe(array($method));
76+
$this->allMethods()->shouldBe([$method]);
7777
}
7878
}

spec/Memio/Model/FileSpec.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ function it_has_a_namespace(Structure $structure)
5454

5555
function it_can_have_fully_qualified_names(FullyQualifiedName $fullyQualifiedName)
5656
{
57-
$this->allFullyQualifiedNames()->shouldBe(array());
57+
$this->allFullyQualifiedNames()->shouldBe([]);
5858
$this->addFullyQualifiedName($fullyQualifiedName);
59-
$this->allFullyQualifiedNames()->shouldBe(array($fullyQualifiedName));
59+
$this->allFullyQualifiedNames()->shouldBe([$fullyQualifiedName]);
6060
}
6161

6262
function it_has_a_structure(Structure $structure)

spec/Memio/Model/MethodSpec.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ function it_can_have_staticness()
8888

8989
function it_can_have_arguments(Argument $argument)
9090
{
91-
$this->allArguments()->shouldBe(array());
91+
$this->allArguments()->shouldBe([]);
9292
$this->addArgument($argument);
93-
$this->allArguments()->shouldBe(array($argument));
93+
$this->allArguments()->shouldBe([$argument]);
9494
}
9595

9696
function it_can_have_a_return_type()

spec/Memio/Model/ObjektSpec.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -91,29 +91,29 @@ function it_can_have_a_parent(Objekt $parent)
9191

9292
function it_can_implement_contracts(Contract $contract)
9393
{
94-
$this->allContracts()->shouldBe(array());
94+
$this->allContracts()->shouldBe([]);
9595
$this->implement($contract);
96-
$this->allContracts()->shouldBe(array($contract));
96+
$this->allContracts()->shouldBe([$contract]);
9797
}
9898

9999
function it_can_have_constants(Constant $constant)
100100
{
101-
$this->allConstants()->shouldBe(array());
101+
$this->allConstants()->shouldBe([]);
102102
$this->addConstant($constant);
103-
$this->allConstants()->shouldBe(array($constant));
103+
$this->allConstants()->shouldBe([$constant]);
104104
}
105105

106106
function it_can_have_properties(Property $property)
107107
{
108-
$this->allProperties()->shouldBe(array());
108+
$this->allProperties()->shouldBe([]);
109109
$this->addProperty($property);
110-
$this->allProperties()->shouldBe(array($property));
110+
$this->allProperties()->shouldBe([$property]);
111111
}
112112

113113
function it_can_have_methods(Method $method)
114114
{
115-
$this->allMethods()->shouldBe(array());
115+
$this->allMethods()->shouldBe([]);
116116
$this->addMethod($method);
117-
$this->allMethods()->shouldBe(array($method));
117+
$this->allMethods()->shouldBe([$method]);
118118
}
119119
}

spec/Memio/Model/Phpdoc/DescriptionSpec.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,28 @@ function let()
2424

2525
function it_has_a_short_description()
2626
{
27-
$this->all()->shouldBe(array(self::SHORT_DESCRIPTION));
27+
$this->all()->shouldBe([self::SHORT_DESCRIPTION]);
2828
}
2929

3030
function it_can_have_empty_lines()
3131
{
3232
$this->addEmptyLine();
3333

34-
$this->all()->shouldBe(array(self::SHORT_DESCRIPTION, ''));
34+
$this->all()->shouldBe([self::SHORT_DESCRIPTION, '']);
3535
}
3636

3737
function it_can_have_long_description()
3838
{
39-
$longDescription = array(
39+
$longDescription = [
4040
'Long descriptions can span on many lines',
4141
'',
4242
' They can also have empty lines and indented ones.',
43-
);
43+
];
4444

4545
foreach ($longDescription as $line) {
4646
$this->addLine($line);
4747
}
4848

49-
$this->all()->shouldBe(array_merge(array(self::SHORT_DESCRIPTION), $longDescription));
49+
$this->all()->shouldBe(array_merge([self::SHORT_DESCRIPTION], $longDescription));
5050
}
5151
}

spec/Memio/Model/Phpdoc/MethodPhpdocSpec.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function it_can_have_description(Description $description)
3434
function it_can_have_parameters(ParameterTag $parameterTag)
3535
{
3636
$this->addParameterTag($parameterTag);
37-
$this->getParameterTags()->shouldBe(array($parameterTag));
37+
$this->getParameterTags()->shouldBe([$parameterTag]);
3838
$this->isEmpty(false);
3939
}
4040

src/Memio/Model/Argument.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,25 @@ public function __construct(string $type, string $name)
3333
/**
3434
* @deprecated
3535
*/
36-
public static function make(string $type, string $name) : self
36+
public static function make(string $type, string $name): self
3737
{
3838
return new self($type, $name);
3939
}
4040

41-
public function getType() : string
41+
public function getType(): string
4242
{
4343
return $this->type->getName();
4444
}
4545

46-
public function getName() : string
46+
public function getName(): string
4747
{
4848
return $this->name;
4949
}
5050

5151
/**
5252
* @api
5353
*/
54-
public function setDefaultValue(string $value) : self
54+
public function setDefaultValue(string $value): self
5555
{
5656
$this->defaultValue = $value;
5757

@@ -66,7 +66,7 @@ public function getDefaultValue()
6666
/**
6767
* @api
6868
*/
69-
public function removeDefaultValue() : self
69+
public function removeDefaultValue(): self
7070
{
7171
$this->defaultValue = null;
7272

@@ -84,7 +84,7 @@ public function isVariadic(): bool
8484
/**
8585
* @api
8686
*/
87-
public function makeVariadic() : self
87+
public function makeVariadic(): self
8888
{
8989
$this->isVariadic = true;
9090

@@ -94,7 +94,7 @@ public function makeVariadic() : self
9494
/**
9595
* @api
9696
*/
97-
public function removeVariadic() : self
97+
public function removeVariadic(): self
9898
{
9999
$this->isVariadic = false;
100100

src/Memio/Model/Constant.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,17 @@ public function __construct(string $name, string $value)
3131
/**
3232
* @deprecated
3333
*/
34-
public static function make(string $name, string $value) : self
34+
public static function make(string $name, string $value): self
3535
{
3636
return new self($name, $value);
3737
}
3838

39-
public function getName() : string
39+
public function getName(): string
4040
{
4141
return $this->name;
4242
}
4343

44-
public function getValue() : string
44+
public function getValue(): string
4545
{
4646
return $this->value;
4747
}

src/Memio/Model/Contract.php

+11-11
Original file line numberDiff line numberDiff line change
@@ -37,27 +37,27 @@ public function __construct(string $fullyQualifiedName)
3737
/**
3838
* @deprecated
3939
*/
40-
public static function make(string $fullyQualifiedName) : self
40+
public static function make(string $fullyQualifiedName): self
4141
{
4242
return new self($fullyQualifiedName);
4343
}
4444

45-
public function getFullyQualifiedName() : string
45+
public function getFullyQualifiedName(): string
4646
{
4747
return $this->fullyQualifiedName->getFullyQualifiedName();
4848
}
4949

50-
public function getName() : string
50+
public function getName(): string
5151
{
5252
return $this->fullyQualifiedName->getName();
5353
}
5454

55-
public function getNamespace() : string
55+
public function getNamespace(): string
5656
{
5757
return $this->fullyQualifiedName->getNamespace();
5858
}
5959

60-
public function setPhpdoc(StructurePhpdoc $structurePhpdoc) : self
60+
public function setPhpdoc(StructurePhpdoc $structurePhpdoc): self
6161
{
6262
$this->structurePhpdoc = $structurePhpdoc;
6363

@@ -72,44 +72,44 @@ public function getPhpdoc()
7272
/**
7373
* @api
7474
*/
75-
public function extend(Contract $contract) : self
75+
public function extend(Contract $contract): self
7676
{
7777
$this->contracts[] = $contract;
7878

7979
return $this;
8080
}
8181

82-
public function allContracts() : array
82+
public function allContracts(): array
8383
{
8484
return $this->contracts;
8585
}
8686

8787
/**
8888
* @api
8989
*/
90-
public function addConstant(Constant $constant) : self
90+
public function addConstant(Constant $constant): self
9191
{
9292
$this->constants[] = $constant;
9393

9494
return $this;
9595
}
9696

97-
public function allConstants() : array
97+
public function allConstants(): array
9898
{
9999
return $this->constants;
100100
}
101101

102102
/**
103103
* @api
104104
*/
105-
public function addMethod(Method $method) : self
105+
public function addMethod(Method $method): self
106106
{
107107
$this->methods[] = $method;
108108

109109
return $this;
110110
}
111111

112-
public function allMethods() : array
112+
public function allMethods(): array
113113
{
114114
return $this->methods;
115115
}

0 commit comments

Comments
 (0)