Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 57cfbcf

Browse files
committed
Merge branch 'hotfix/46'
Close #46 Fixes #45 Fixes #39
2 parents 2b2984d + c3197b4 commit 57cfbcf

File tree

14 files changed

+34
-24
lines changed

14 files changed

+34
-24
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
All notable changes to this project will be documented in this file, in reverse chronological order by release.
44

5-
## 3.0.2 - TBD
5+
## 3.0.2 - 2016-04-20
66

77
### Added
88

@@ -24,6 +24,9 @@ All notable changes to this project will be documented in this file, in reverse
2424
zend-code are compatible across versions.
2525
- PHP now excludes the 7.0.5 release, as it has known issues in its tokenizer
2626
implementation that make the zend-code token scanner unusable.
27+
- [#46](https://github.com/zendframework/zend-code/pull/46) updates all
28+
generators to use `\n` for line endings in generated code, vs `PHP_EOL`,
29+
ensuring cross-platform consistency.
2730

2831
## 3.0.1 - 2016-01-26
2932

phpcs.xml.dist

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@
1414
<property name="ignoreBlankLines" value="false"/>
1515
</properties>
1616
</rule>
17+
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpen">
18+
<severity>0</severity>
19+
</rule>
20+
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose">
21+
<severity>0</severity>
22+
</rule>
23+
1724

1825
<!-- Paths to check -->
1926
<file>src</file>

src/Generator/MethodGenerator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ protected static function clearBodyIndention($body)
9393
return $body;
9494
}
9595

96-
$lines = explode(PHP_EOL, $body);
96+
$lines = explode("\n", $body);
9797

9898
$indention = str_replace(trim($lines[1]), '', $lines[1]);
9999

@@ -103,7 +103,7 @@ protected static function clearBodyIndention($body)
103103
}
104104
}
105105

106-
$body = implode(PHP_EOL, $lines);
106+
$body = implode("\n", $lines);
107107

108108
return $body;
109109
}

src/Reflection/DocBlock/Tag/AuthorTag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,6 @@ public function getAuthorEmail()
6969

7070
public function __toString()
7171
{
72-
return 'DocBlock Tag [ * @' . $this->getName() . ' ]' . PHP_EOL;
72+
return 'DocBlock Tag [ * @' . $this->getName() . ' ]' . "\n";
7373
}
7474
}

src/Reflection/DocBlock/Tag/GenericTag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function returnValue($position)
9595
*/
9696
public function __toString()
9797
{
98-
return 'DocBlock Tag [ * @' . $this->name . ' ]' . PHP_EOL;
98+
return 'DocBlock Tag [ * @' . $this->name . ' ]' . "\n";
9999
}
100100

101101
/**

src/Reflection/DocBlock/Tag/LicenseTag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,6 @@ public function getLicenseName()
6969

7070
public function __toString()
7171
{
72-
return 'DocBlock Tag [ * @' . $this->getName() . ' ]' . PHP_EOL;
72+
return 'DocBlock Tag [ * @' . $this->getName() . ' ]' . "\n";
7373
}
7474
}

src/Reflection/DocBlock/Tag/MethodTag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,6 @@ public function isStatic()
117117

118118
public function __toString()
119119
{
120-
return 'DocBlock Tag [ * @' . $this->getName() . ' ]' . PHP_EOL;
120+
return 'DocBlock Tag [ * @' . $this->getName() . ' ]' . "\n";
121121
}
122122
}

src/Reflection/DocBlock/Tag/PropertyTag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,6 @@ public function getDescription()
9595

9696
public function __toString()
9797
{
98-
return 'DocBlock Tag [ * @' . $this->getName() . ' ]' . PHP_EOL;
98+
return 'DocBlock Tag [ * @' . $this->getName() . ' ]' . "\n";
9999
}
100100
}

src/Reflection/DocBlockReflection.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,15 +271,15 @@ protected function reflect()
271271
*/
272272
public function toString()
273273
{
274-
$str = "DocBlock [ /* DocBlock */ ] {" . PHP_EOL . PHP_EOL;
275-
$str .= " - Tags [" . count($this->tags) . "] {" . PHP_EOL;
274+
$str = "DocBlock [ /* DocBlock */ ] {" . "\n" . "\n";
275+
$str .= " - Tags [" . count($this->tags) . "] {" . "\n";
276276

277277
foreach ($this->tags as $tag) {
278278
$str .= " " . $tag;
279279
}
280280

281-
$str .= " }" . PHP_EOL;
282-
$str .= "}" . PHP_EOL;
281+
$str .= " }" . "\n";
282+
$str .= "}" . "\n";
283283

284284
return $str;
285285
}

test/Generator/TestAsset/TestClassWithManyProperties.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class TestClassWithManyProperties
3636
array(
3737
'bar',
3838
'baz',
39-
//PHP_EOL
39+
"\n"
4040
)
4141
);
4242

0 commit comments

Comments
 (0)