Skip to content

Commit 30b8d84

Browse files
committed
remove support for PHP 7.0 and adopt PHP 7.1
1 parent d878507 commit 30b8d84

6 files changed

Lines changed: 35 additions & 48 deletions

File tree

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ language: php
33
sudo: false
44

55
php:
6-
- 7.0
76
- 7.1
87
- 7.2
98
- nightly

build/cs-ruleset.xml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
<?xml version="1.0"?>
22
<ruleset name="ConsistenceCodingStandard">
3-
<rule ref="../vendor/consistence/coding-standard/Consistence/ruleset.xml">
4-
<exclude name="SlevomatCodingStandard.Classes.ClassConstantVisibility"/><!-- requires 7.1+ -->
5-
<exclude name="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue"/><!-- requires PHP 7.1+ -->
6-
</rule>
3+
<rule ref="../vendor/consistence/coding-standard/Consistence/ruleset.xml"/>
74
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
85
<properties>
96
<property name="rootNamespaces" type="array" value="

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
}
1212
],
1313
"require": {
14-
"php": "~7.0",
14+
"php": "~7.1",
1515
"phing/phing": "~2.16"
1616
},
1717
"require-dev": {

src/CopyFileElement.php

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,46 +16,37 @@ class CopyFileElement
1616
/** @var string|null */
1717
private $existsMode;
1818

19-
/**
20-
* @return string|null
21-
*/
22-
public function getSource()
19+
public function getSource(): ?string
2320
{
2421
return $this->source;
2522
}
2623

27-
public function setSource(string $source)
24+
public function setSource(string $source): void
2825
{
2926
$this->source = $source;
3027
}
3128

32-
/**
33-
* @return string|null
34-
*/
35-
public function getTarget()
29+
public function getTarget(): ?string
3630
{
3731
return $this->target;
3832
}
3933

40-
public function setTarget(string $target)
34+
public function setTarget(string $target): void
4135
{
4236
$this->target = $target;
4337
}
4438

45-
/**
46-
* @return string|null
47-
*/
48-
public function getExistsMode()
39+
public function getExistsMode(): ?string
4940
{
5041
return $this->existsMode;
5142
}
5243

53-
public function setExistsMode(string $mode)
44+
public function setExistsMode(string $mode): void
5445
{
5546
$this->existsMode = $mode;
5647
}
5748

58-
public function validateAttributes()
49+
public function validateAttributes(): void
5950
{
6051
if ($this->getSource() === null) {
6152
throw new \BuildException('<file> must have the `source` attribute');

src/CopyFilesTask.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@
99
class CopyFilesTask extends \Task
1010
{
1111

12-
const EXISTS_MODE_FAIL = 'fail';
13-
const EXISTS_MODE_REPLACE = 'replace';
14-
const EXISTS_MODE_SKIP = 'skip';
12+
public const EXISTS_MODE_FAIL = 'fail';
13+
public const EXISTS_MODE_REPLACE = 'replace';
14+
public const EXISTS_MODE_SKIP = 'skip';
1515

1616
/** @var \VasekPurchart\Phing\CopyFiles\CopyFileElement[] */
1717
private $copyFiles = [];
1818

1919
/** @var string|null */
2020
private $existsMode;
2121

22-
public function setExistsMode(string $mode)
22+
public function setExistsMode(string $mode): void
2323
{
2424
$this->existsMode = $mode;
2525
}
2626

27-
public function main()
27+
public function main(): void
2828
{
2929
$this->validateAttributes();
3030

@@ -74,7 +74,7 @@ public function createFile(): CopyFileElement
7474
return $copyFile;
7575
}
7676

77-
private function validateAttributes()
77+
private function validateAttributes(): void
7878
{
7979
if (count($this->copyFiles) === 0) {
8080
throw new \BuildException('At least one <file> element expected');
@@ -87,7 +87,7 @@ private function validateAttributes()
8787
}
8888
}
8989

90-
public static function checkAllowedExistsMode(string $mode)
90+
public static function checkAllowedExistsMode(string $mode): void
9191
{
9292
$allowed = static::getAllowedExistsModes();
9393
if (!in_array($mode, $allowed, true)) {
@@ -122,7 +122,7 @@ private function getCopyFileFileExistsMode(CopyFileElement $copyFile): string
122122
/**
123123
* @param string[] $errors
124124
*/
125-
private function handleErrors(array $errors)
125+
private function handleErrors(array $errors): void
126126
{
127127
if (count($errors) > 0) {
128128
foreach ($errors as $error) {

tests/CopyFilesTaskIntegrationTest.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
class CopyFilesTaskIntegrationTest extends \PHPUnit\Framework\TestCase
1111
{
1212

13-
const TEMP_DIRECTORY_PATH = __DIR__ . '/temp';
13+
private const TEMP_DIRECTORY_PATH = __DIR__ . '/temp';
1414

15-
public function testCopyFile()
15+
public function testCopyFile(): void
1616
{
1717
$sourceFilePath = self::TEMP_DIRECTORY_PATH . '/foo';
1818
file_put_contents($sourceFilePath, 'FOO');
@@ -29,7 +29,7 @@ public function testCopyFile()
2929
$tester->assertLogMessageRegExp('~Copying.+/foo.+->.+/foo-copy~', $target, Project::MSG_INFO);
3030
}
3131

32-
public function testCopyFileWithAbsolutePath()
32+
public function testCopyFileWithAbsolutePath(): void
3333
{
3434
$sourceFilePath = self::TEMP_DIRECTORY_PATH . '/foo';
3535
file_put_contents($sourceFilePath, 'FOO');
@@ -46,7 +46,7 @@ public function testCopyFileWithAbsolutePath()
4646
$tester->assertLogMessageRegExp('~Copying.+/foo.+->.+/foo-copy~', $target, Project::MSG_INFO);
4747
}
4848

49-
public function testTargetFileExists()
49+
public function testTargetFileExists(): void
5050
{
5151
$sourceFilePath = self::TEMP_DIRECTORY_PATH . '/new';
5252
file_put_contents($sourceFilePath, 'NEW');
@@ -62,7 +62,7 @@ public function testTargetFileExists()
6262
$tester->assertLogMessageRegExp('~/existing.+already exists.+SKIPPING~', $target, Project::MSG_INFO);
6363
}
6464

65-
public function testTargetFileExistsSkip()
65+
public function testTargetFileExistsSkip(): void
6666
{
6767
$sourceFilePath = self::TEMP_DIRECTORY_PATH . '/new';
6868
file_put_contents($sourceFilePath, 'NEW');
@@ -78,7 +78,7 @@ public function testTargetFileExistsSkip()
7878
$tester->assertLogMessageRegExp('~/existing.+already exists.+SKIPPING~', $target, Project::MSG_INFO);
7979
}
8080

81-
public function testTargetFileExistsReplace()
81+
public function testTargetFileExistsReplace(): void
8282
{
8383
$sourceFilePath = self::TEMP_DIRECTORY_PATH . '/new';
8484
file_put_contents($sourceFilePath, 'NEW');
@@ -93,7 +93,7 @@ public function testTargetFileExistsReplace()
9393
$tester->assertLogMessageRegExp('~/existing.+already exists~', $target, Project::MSG_VERBOSE);
9494
}
9595

96-
public function testTargetFileExistsFail()
96+
public function testTargetFileExistsFail(): void
9797
{
9898
$sourceFilePath = self::TEMP_DIRECTORY_PATH . '/new';
9999
file_put_contents($sourceFilePath, 'NEW');
@@ -110,7 +110,7 @@ public function testTargetFileExistsFail()
110110
$tester->assertLogMessageRegExp('~/existing.+already exists~', $target, Project::MSG_ERR);
111111
}
112112

113-
public function testCopyMultipleFiles()
113+
public function testCopyMultipleFiles(): void
114114
{
115115
$sourceFooFilePath = self::TEMP_DIRECTORY_PATH . '/foo';
116116
file_put_contents($sourceFooFilePath, 'FOO');
@@ -135,7 +135,7 @@ public function testCopyMultipleFiles()
135135
$tester->assertLogMessageRegExp('~Copying.+/bar.+->.+/bar-copy~', $target, Project::MSG_INFO);
136136
}
137137

138-
public function testReplaceMultipleFilesWithExistingTargets()
138+
public function testReplaceMultipleFilesWithExistingTargets(): void
139139
{
140140
$sourceFooFilePath = self::TEMP_DIRECTORY_PATH . '/foo-new';
141141
file_put_contents($sourceFooFilePath, 'FOO-NEW');
@@ -160,7 +160,7 @@ public function testReplaceMultipleFilesWithExistingTargets()
160160
$tester->assertLogMessageRegExp('~/bar-existing.+already exists~', $target, Project::MSG_VERBOSE);
161161
}
162162

163-
public function testCopyMultipleFilesWithExistingTargetsUsingDifferentModes()
163+
public function testCopyMultipleFilesWithExistingTargetsUsingDifferentModes(): void
164164
{
165165
$sourceSkipFilePath = self::TEMP_DIRECTORY_PATH . '/skip-new';
166166
file_put_contents($sourceSkipFilePath, 'SKIP-NEW');
@@ -192,7 +192,7 @@ public function testCopyMultipleFilesWithExistingTargetsUsingDifferentModes()
192192
$this->assertSame('DEFAULT-EXISTING', file_get_contents($targetDefaultFilePath));
193193
}
194194

195-
public function testCopyMultipleFilesWithExistingTargetsUsingDifferentModesWithReplaceFallback()
195+
public function testCopyMultipleFilesWithExistingTargetsUsingDifferentModesWithReplaceFallback(): void
196196
{
197197
$sourceSkipFilePath = self::TEMP_DIRECTORY_PATH . '/skip-new';
198198
file_put_contents($sourceSkipFilePath, 'SKIP-NEW');
@@ -225,7 +225,7 @@ public function testCopyMultipleFilesWithExistingTargetsUsingDifferentModesWithR
225225
$tester->assertLogMessageRegExp('~/default-existing.+already exists~', $target, Project::MSG_VERBOSE);
226226
}
227227

228-
public function testCopyNonExistentFile()
228+
public function testCopyNonExistentFile(): void
229229
{
230230
$tester = new PhingTester(__DIR__ . '/copy-files-task-integration-test.xml');
231231
$target = __FUNCTION__;
@@ -235,7 +235,7 @@ public function testCopyNonExistentFile()
235235
$tester->assertLogMessageRegExp('~XXX.+does not exist~', $target, Project::MSG_ERR);
236236
}
237237

238-
public function testCopyMultipleNonExistentFiles()
238+
public function testCopyMultipleNonExistentFiles(): void
239239
{
240240
$tester = new PhingTester(__DIR__ . '/copy-files-task-integration-test.xml');
241241
$target = __FUNCTION__;
@@ -246,7 +246,7 @@ public function testCopyMultipleNonExistentFiles()
246246
$tester->assertLogMessageRegExp('~BAR.+does not exist~', $target, Project::MSG_ERR);
247247
}
248248

249-
public function testCopyFileToNonExistingDirectory()
249+
public function testCopyFileToNonExistingDirectory(): void
250250
{
251251
$sourceFilePath = self::TEMP_DIRECTORY_PATH . '/foo';
252252
file_put_contents($sourceFilePath, 'FOO');
@@ -263,7 +263,7 @@ public function testCopyFileToNonExistingDirectory()
263263
$tester->assertLogMessageRegExp('~/foo.+cannot be copied.+/foo-copy~', $target, Project::MSG_ERR);
264264
}
265265

266-
public function testMissingCopyFileElement()
266+
public function testMissingCopyFileElement(): void
267267
{
268268
$tester = new PhingTester(__DIR__ . '/copy-files-task-integration-test.xml');
269269
$target = __FUNCTION__;
@@ -274,7 +274,7 @@ public function testMissingCopyFileElement()
274274
$tester->executeTarget($target);
275275
}
276276

277-
public function testMissingSource()
277+
public function testMissingSource(): void
278278
{
279279
$tester = new PhingTester(__DIR__ . '/copy-files-task-integration-test.xml');
280280
$target = __FUNCTION__;
@@ -285,7 +285,7 @@ public function testMissingSource()
285285
$tester->executeTarget($target);
286286
}
287287

288-
public function testMissingTarget()
288+
public function testMissingTarget(): void
289289
{
290290
$tester = new PhingTester(__DIR__ . '/copy-files-task-integration-test.xml');
291291
$target = __FUNCTION__;
@@ -296,7 +296,7 @@ public function testMissingTarget()
296296
$tester->executeTarget($target);
297297
}
298298

299-
public function testInvalidFileExistsMode()
299+
public function testInvalidFileExistsMode(): void
300300
{
301301
$tester = new PhingTester(__DIR__ . '/copy-files-task-integration-test.xml');
302302
$target = __FUNCTION__;

0 commit comments

Comments
 (0)