Skip to content

Commit 17f8bce

Browse files
authored
Composer update #72 & fix semver OR condition (#73)
* Composer update #72 & fix semver OR condition phpunit ^9.0 php-file-iterator ^3.0 in composer OR condition is represented through double pipes (||). https://getcomposer.org/doc/articles/versions.md#version-range * Remove travis check * Enable github actions for ci check on php 7.3 and 7.4
1 parent 79342b7 commit 17f8bce

36 files changed

+840
-710
lines changed

.github/flake.lock

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/flake.nix

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
description = "A php test environment flake";
3+
4+
outputs = { self, nixpkgs }:
5+
let
6+
system = "x86_64-linux";
7+
pkgs = nixpkgs.legacyPackages."${system}";
8+
9+
phpEnv = phpPackage: (phpPackage.buildEnv {
10+
extensions = { enabled, all }: (enabled ++ [ all.xdebug ]);
11+
extraConfig = ''
12+
memory_limit=-1
13+
xdebug.mode=coverage
14+
'' +
15+
pkgs.lib.optionalString (pkgs.lib.versionOlder phpPackage.version "8.0") ''
16+
xdebug.coverage_enable=1
17+
'';
18+
});
19+
20+
phpVersions = [
21+
"php73"
22+
"php74"
23+
"php80"
24+
];
25+
in
26+
{
27+
packages."${system}" = builtins.listToAttrs
28+
(builtins.map
29+
(name:
30+
{
31+
name = "env-${name}";
32+
value = pkgs.symlinkJoin {
33+
name = "env-${name}";
34+
paths = [
35+
(phpEnv pkgs."${name}")
36+
(phpEnv pkgs."${name}").packages.composer2
37+
];
38+
};
39+
}
40+
)
41+
phpVersions);
42+
};
43+
}

.github/workflows/ci.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Simple Nix Flakes powered php ci.
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
ci:
7+
8+
runs-on: ubuntu-latest
9+
10+
strategy:
11+
matrix:
12+
php: [php73, php74]
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
with:
17+
# Nix Flakes doesn't work on shallow clones
18+
fetch-depth: 0
19+
20+
- uses: cachix/install-nix-action@v12
21+
with:
22+
install_url: https://github.com/numtide/nix-flakes-installer/releases/download/nix-2.4pre20201221_9fab14a/install
23+
extra_nix_config: |
24+
experimental-features = nix-command flakes
25+
26+
- name: Cache Composer dependencies
27+
uses: actions/cache@v2
28+
with:
29+
path: /home/runner/.cache/composer
30+
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
31+
restore-keys: |
32+
${{ runner.os }}-composer-
33+
34+
- run: |
35+
rm -fr vendor
36+
nix shell .github#env-${{ matrix.php }} --command composer ci-prepare
37+
nix shell .github#env-${{ matrix.php }} --command composer ci

.travis.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

box.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@
2929
],
3030
"git-commit": "git-commit",
3131
"git-version": "git-version",
32-
"output": "phpcb-2.3.1.phar"
32+
"output": "phpcb-2.3.2.phar"
3333
}

composer.json

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@
1616
}
1717
],
1818
"require": {
19-
"php": "^7.2",
19+
"php": "^7.3",
2020
"ext-dom": "*",
21-
"monolog/monolog": "~1.7|~2.0",
22-
"phpunit/php-file-iterator": "~2.0",
23-
"symfony/console": "~3.4|~4.0|~5.0"
21+
"monolog/monolog": "~1.7||~2.0",
22+
"phpunit/php-file-iterator": "~2.0||^3.0",
23+
"symfony/console": "~3.4||~4.0||~5.0"
2424
},
2525
"require-dev": {
2626
"humbug/box": "^3.8.3",
27-
"mayflower/mo4-coding-standard": "^5.0",
27+
"mayflower/mo4-coding-standard": "^6.0",
2828
"phploc/phploc": "*",
29-
"phpmd/phpmd": "1.5.*|~2.6",
29+
"phpmd/phpmd": "1.5.*||~2.6",
3030
"phpstan/phpstan": "^0.12.5",
31-
"phpunit/phpunit": "~8.4",
31+
"phpunit/phpunit": "~8.4||^9.0",
3232
"sebastian/phpcpd": "*"
3333
},
3434
"autoload": {
@@ -50,9 +50,12 @@
5050
"phploc -q --log-xml=build/logs/phploc.xml src || true",
5151
"@browser"
5252
],
53-
"travis": [
53+
"ci-prepare": [
54+
"composer update --prefer-dist --no-interaction --no-progress"
55+
],
56+
"ci": [
5457
"phpcs -s --standard=MO4 src/PHPCodeBrowser/",
55-
"phpstan analyse --no-progress --level=1 src/PHPCodeBrowser/",
58+
"phpstan analyse --no-progress",
5659
"phpunit"
5760
],
5861
"clean": "rm -rf build/logs/* build/code-browser",

phpstan_baseline.neon

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,10 @@ parameters:
33
-
44
message: "#^Call to an undefined method DOMNode\\:\\:getAttribute\\(\\)\\.$#"
55
count: 1
6-
path: src/PHPCodeBrowser/AbstractPlugin.php
7-
8-
-
9-
message: "#^Call to an undefined method DOMNode\\:\\:getAttribute\\(\\)\\.$#"
10-
count: 5
116
path: src/PHPCodeBrowser/Plugins/ErrorCPD.php
127

138
-
149
message: "#^Call to an undefined method DOMNode\\:\\:getAttribute\\(\\)\\.$#"
1510
count: 1
16-
path: src/PHPCodeBrowser/Plugins/ErrorCRAP.php
17-
18-
-
19-
message: "#^Call to an undefined method DOMNode\\:\\:getAttribute\\(\\)\\.$#"
20-
count: 2
2111
path: src/PHPCodeBrowser/Plugins/ErrorCoverage.php
2212

23-
-
24-
message: "#^Access to an undefined property DOMNode\\:\\:\\$wholeText\\.$#"
25-
count: 1
26-
path: src/PHPCodeBrowser/View/ViewReview.php
27-

src/PHPCodeBrowser/AbstractPlugin.php

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* Abstract Plugin
45
*
@@ -36,45 +37,45 @@
3637
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3738
* POSSIBILITY OF SUCH DAMAGE.
3839
*
39-
* @category PHP_CodeBrowser
40+
* @category PHP_CodeBrowser
4041
*
41-
* @author Elger Thiele <elger.thiele@mayflower.de>
42-
* @author Michel Hartmann <michel.hartmann@mayflower.de>
42+
* @author Elger Thiele <elger.thiele@mayflower.de>
43+
* @author Michel Hartmann <michel.hartmann@mayflower.de>
4344
*
4445
* @copyright 2007-2010 Mayflower GmbH
4546
*
46-
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
47+
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
4748
*
48-
* @version SVN: $Id$
49+
* @version SVN: $Id$
4950
*
50-
* @link http://www.phpunit.de/
51+
* @link http://www.phpunit.de/
5152
*
52-
* @since File available since 0.1.0
53+
* @since File available since 0.1.0
5354
*/
5455

5556
namespace PHPCodeBrowser;
5657

57-
use \DOMElement;
58-
use \DOMNode;
59-
use \DOMNodeList;
58+
use DOMElement;
59+
use DOMNode;
60+
use DOMNodeList;
6061

6162
/**
6263
* AbstractPlugin
6364
*
64-
* @category PHP_CodeBrowser
65+
* @category PHP_CodeBrowser
6566
*
66-
* @author Elger Thiele <elger.thiele@mayflower.de>
67-
* @author Michel Hartmann <michel.hartmann@mayflower.de>
67+
* @author Elger Thiele <elger.thiele@mayflower.de>
68+
* @author Michel Hartmann <michel.hartmann@mayflower.de>
6869
*
6970
* @copyright 2007-2010 Mayflower GmbH
7071
*
71-
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
72+
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
7273
*
73-
* @version Release: @package_version@
74+
* @version Release: @package_version@
7475
*
75-
* @link http://www.phpunit.de/
76+
* @link http://www.phpunit.de/
7677
*
77-
* @since Class available since 0.1.0
78+
* @since Class available since 0.1.0
7879
*/
7980
abstract class AbstractPlugin
8081
{
@@ -179,7 +180,7 @@ public function getIssuesByFile(string $filename): array
179180
$issues = [];
180181

181182
foreach ($this->getIssueNodes($filename) as $issueNode) {
182-
$issues = array_merge(
183+
$issues = \array_merge(
183184
$issues,
184185
$this->mapIssues($issueNode, $filename)
185186
);
@@ -197,14 +198,14 @@ public function getFilesWithIssues(): array
197198
{
198199
$fileNames = [];
199200
$issueNodes = $this->issueXml->query(
200-
sprintf('/*/%s/file[@name]', $this->pluginName)
201+
\sprintf('/*/%s/file[@name]', $this->pluginName)
201202
);
202203

203204
foreach ($issueNodes as $node) {
204205
$fileNames[] = $node->getAttribute('name');
205206
}
206207

207-
return array_unique($fileNames);
208+
return \array_unique($fileNames);
208209
}
209210

210211
/**
@@ -250,12 +251,13 @@ public function mapIssues(DOMNode $element, string $filename): array
250251
protected function getIssueNodes(string $filename): DOMNodeList
251252
{
252253
return $this->issueXml->query(
253-
sprintf('/*/%s/file[@name="%s"]', $this->pluginName, $filename)
254+
\sprintf('/*/%s/file[@name="%s"]', $this->pluginName, $filename)
254255
);
255256
}
256257

257258
/**
258259
* Default method for retrieving the first line of an issue.
260+
*
259261
* @see self::mapIssues
260262
*
261263
* @param DOMElement $element
@@ -269,6 +271,7 @@ protected function getLineStart(DOMElement $element): int
269271

270272
/**
271273
* Default method for retrieving the last line of an issue.
274+
*
272275
* @see self::mapIssues
273276
*
274277
* @param DOMElement $element
@@ -282,6 +285,7 @@ protected function getLineEnd(DOMElement $element): int
282285

283286
/**
284287
* Default method for retrieving the source of an issue.
288+
*
285289
* @see self::mapIssues
286290
*
287291
* @return string
@@ -293,6 +297,7 @@ protected function getSource(): string
293297

294298
/**
295299
* Default method for retrieving the description of an issue.
300+
*
296301
* @see self::mapIssues
297302
*
298303
* @param DOMElement $element
@@ -301,11 +306,12 @@ protected function getSource(): string
301306
*/
302307
protected function getDescription(DOMElement $element): string
303308
{
304-
return htmlentities($element->getAttribute($this->descriptionAttr));
309+
return \htmlentities($element->getAttribute($this->descriptionAttr));
305310
}
306311

307312
/**
308313
* Default method for retrieving the severity of an issue.
314+
*
309315
* @see self::mapIssues
310316
*
311317
* @param DOMElement $element
@@ -314,6 +320,6 @@ protected function getDescription(DOMElement $element): string
314320
*/
315321
protected function getSeverity(DOMElement $element): string
316322
{
317-
return htmlentities($element->getAttribute($this->severityAttr));
323+
return \htmlentities($element->getAttribute($this->severityAttr));
318324
}
319325
}

src/PHPCodeBrowser/Application.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* Application
45
*
@@ -36,19 +37,19 @@
3637
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3738
* POSSIBILITY OF SUCH DAMAGE.
3839
*
39-
* @category PHP_CodeBrowser
40+
* @category PHP_CodeBrowser
4041
*
41-
* @author Robin Gloster <robin.gloster@mayflower.de>
42+
* @author Robin Gloster <robin.gloster@mayflower.de>
4243
*
4344
* @copyright 2007-2010 Mayflower GmbH
4445
*
45-
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
46+
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
4647
*
47-
* @version SVN: $Id$
48+
* @version SVN: $Id$
4849
*
49-
* @link http://www.phpunit.de/
50+
* @link http://www.phpunit.de/
5051
*
51-
* @since File available since 1.1
52+
* @since File available since 1.1
5253
*/
5354

5455
namespace PHPCodeBrowser;

0 commit comments

Comments
 (0)