Skip to content

Commit 34aa112

Browse files
committed
Go PHP 7.1
1 parent 5166dd6 commit 34aa112

28 files changed

+264
-415
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
\#*
44
*.bak
55
.idea/
6-
coverage.clover
7-
composer.lock
86
vendor/
7+
composer.lock
8+
coverage.clover

.travis.yml

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,20 @@
11
language: php
22

33
php:
4-
php:
5-
- 5.4
6-
- 5.5
7-
- 5.6
8-
- 7.0
94
- 7.1
105
- 7.2
116
- nightly
127

8+
matrix:
9+
allow_failures:
10+
- php: nightly
11+
1312
install:
1413
- composer install
1514

1615
script:
17-
- vendor/bin/phpunit --configuration tests/phpunit.xml --coverage-clover=coverage.clover
16+
- vendor/bin/phpunit
1817

1918
after_script:
2019
- if [ "$TRAVIS_PHP_VERSION" != "nightly" ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
2120
- if [ "$TRAVIS_PHP_VERSION" != "nightly" ]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi
22-
23-
matrix:
24-
include:
25-
- php: 5.3
26-
dist: precise
27-
allow_failures:
28-
- php: nightly

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@
1010
],
1111
"homepage": "https://github.com/geekwright/Po",
1212
"type": "library",
13-
"license": "GPL-2.0+",
13+
"license": "GPL-2.0-or-later",
1414
"authors": [
1515
{
1616
"name": "Richard Griffith",
1717
"email": "richard@geekwright.com"
1818
}
1919
],
2020
"require": {
21-
"php": ">=5.3.0",
22-
"smarty/smarty": "^3.1"
21+
"php": ">7.1"
2322
},
2423
"require-dev": {
25-
"phpunit/phpunit": "4.8.*|5.*"
24+
"smarty/smarty": "^3.1",
25+
"phpunit/phpunit": "^6.5|^7.0"
2626
},
2727
"autoload": {
2828
"psr-4": {

phpunit.xml.dist

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
4+
bootstrap="vendor/autoload.php"
5+
colors="true">
6+
<testsuites>
7+
<testsuite name="po">
8+
<directory>./tests</directory>
9+
</testsuite>
10+
</testsuites>
11+
12+
<filter>
13+
<whitelist processUncoveredFilesFromWhitelist="true">
14+
<directory suffix=".php">./src</directory>
15+
</whitelist>
16+
</filter>
17+
18+
<logging>
19+
<log type="coverage-clover" target="coverage.clover" />
20+
</logging>
21+
</phpunit>

src/Exceptions/FileNotReadableException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
* @category Exceptions
1111
* @package Po
1212
* @author Richard Griffith <richard@geekwright.com>
13-
* @copyright 2015 Richard Griffith
13+
* @copyright 2015-2018 Richard Griffith
1414
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
1515
* @link https://github.com/geekwright/Po
1616
*/
17-
class FileNotReadableException extends \Exception
17+
class FileNotReadableException extends \RuntimeException
1818
{
1919
}

src/Exceptions/FileNotWritableException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
* @category Exceptions
1111
* @package Po
1212
* @author Richard Griffith <richard@geekwright.com>
13-
* @copyright 2015 Richard Griffith
13+
* @copyright 2015-2018 Richard Griffith
1414
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
1515
* @link https://github.com/geekwright/Po
1616
*/
17-
class FileNotWritableException extends \Exception
17+
class FileNotWritableException extends \RuntimeException
1818
{
1919
}

src/Exceptions/UnrecognizedInputException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* @category Exceptions
1212
* @package Po
1313
* @author Richard Griffith <richard@geekwright.com>
14-
* @copyright 2015 Richard Griffith
14+
* @copyright 2015-2018 Richard Griffith
1515
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
1616
* @link https://github.com/geekwright/Po
1717
*/

src/PoEntry.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* @category Entries
1111
* @package Po
1212
* @author Richard Griffith <richard@geekwright.com>
13-
* @copyright 2015 Richard Griffith
13+
* @copyright 2015-2018 Richard Griffith
1414
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
1515
* @link https://github.com/geekwright/Po
1616
*/
@@ -45,7 +45,7 @@ public function __construct()
4545
* @param string $value value to store
4646
* @return void
4747
*/
48-
public function add($type, $value)
48+
public function add(string $type, string $value): void
4949
{
5050
if ($this->entry[$type] === null) {
5151
$this->entry[$type] = array();
@@ -61,7 +61,7 @@ public function add($type, $value)
6161
* @param string $value value to store
6262
* @return void
6363
*/
64-
public function addQuoted($type, $value)
64+
public function addQuoted(string $type, string $value): void
6565
{
6666
if ($value[0]=='"') {
6767
$value = substr($value, 1, -1);
@@ -86,7 +86,7 @@ public function addQuoted($type, $value)
8686
* @param string $value value to store
8787
* @return void
8888
*/
89-
public function addQuotedAtPosition($type, $position, $value)
89+
public function addQuotedAtPosition(string $type, int $position, string $value): void
9090
{
9191
if ($value[0]=='"') {
9292
$value = substr($value, 1, -1);
@@ -111,7 +111,7 @@ public function addQuotedAtPosition($type, $position, $value)
111111
*
112112
* @return string|string[]|null
113113
*/
114-
public function get($type)
114+
public function get(string $type)
115115
{
116116
return $this->entry[$type];
117117
}
@@ -122,7 +122,7 @@ public function get($type)
122122
* @param string $type PoToken constant
123123
* @return string|null
124124
*/
125-
public function getAsString($type)
125+
public function getAsString(string $type): ?string
126126
{
127127
$ret = $this->entry[$type];
128128
if (is_array($ret)) {
@@ -139,7 +139,7 @@ public function getAsString($type)
139139
*
140140
* @return string[]|null
141141
*/
142-
public function getAsStringArray($type)
142+
public function getAsStringArray(string $type): ?array
143143
{
144144
$plurals = $this->entry[$type];
145145
$plurals = is_array($plurals) ? $plurals : array('', '');
@@ -156,11 +156,11 @@ public function getAsStringArray($type)
156156
/**
157157
* set the value of a specified type
158158
*
159-
* @param string $type PoToken constant
160-
* @param string $value value to set
159+
* @param string $type PoToken constant
160+
* @param string|string[]|null $value value to set
161161
* @return void
162162
*/
163-
public function set($type, $value)
163+
public function set(string $type, $value): void
164164
{
165165
$this->entry[$type] = $value;
166166
}
@@ -170,7 +170,7 @@ public function set($type, $value)
170170
*
171171
* @return string
172172
*/
173-
public function dumpEntry()
173+
public function dumpEntry(): string
174174
{
175175
$output = $this->dumpEntryComments();
176176

@@ -205,7 +205,7 @@ public function dumpEntry()
205205
*
206206
* @return string
207207
*/
208-
protected function dumpEntryComments()
208+
protected function dumpEntryComments(): string
209209
{
210210
$commentKeys = array(
211211
PoTokens::TRANSLATOR_COMMENTS,
@@ -236,13 +236,13 @@ protected function dumpEntryComments()
236236
* format a string for output by escaping control and double quote
237237
* characters, then surrounding with double quotes
238238
*
239-
* @param string|null $value string to prepare
240-
* @param boolean $bare true for bare output, default false adds leading
241-
* space and trailing newline
239+
* @param string|string[]|null $value string to prepare
240+
* @param boolean $bare true for bare output, default false adds leading
241+
* space and trailing newline
242242
*
243243
* @return string
244244
*/
245-
protected function formatQuotedString($value, $bare = false)
245+
protected function formatQuotedString($value, bool $bare = false): string
246246
{
247247
if (is_array($value)) {
248248
$string = '';
@@ -266,7 +266,7 @@ protected function formatQuotedString($value, $bare = false)
266266
*
267267
* @return boolean true if flag is set, otherwise false
268268
*/
269-
public function hasFlag($name)
269+
public function hasFlag(string $name): bool
270270
{
271271
$flags = array();
272272
$flagEntry = $this->entry[PoTokens::FLAG];
@@ -290,7 +290,7 @@ public function hasFlag($name)
290290
*
291291
* @return void
292292
*/
293-
public function addFlag($name)
293+
public function addFlag(string $name): void
294294
{
295295
if (!$this->hasFlag($name)) {
296296
$flagEntry = $this->entry[PoTokens::FLAG];

0 commit comments

Comments
 (0)