Skip to content

Commit

Permalink
Merge pull request #235 from ergebnis/feature/php8
Browse files Browse the repository at this point in the history
Enhancement: Add support for PHP 8.0
  • Loading branch information
ergebnis-bot committed Aug 30, 2020
2 parents 6bc67be + f208cde commit 0b04738
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 11 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ on: # yamllint disable-line rule:truthy

env:
ERGEBNIS_BOT_NAME: "ergebnis-bot"
MIN_COVERED_MSI: 89
MIN_MSI: 87
MIN_COVERED_MSI: 86
MIN_MSI: 85
PHP_EXTENSIONS: "mbstring, tokenizer"

jobs:
Expand Down Expand Up @@ -207,6 +207,7 @@ jobs:
- "7.2"
- "7.3"
- "7.4"
- "8.0"

dependencies:
- "lowest"
Expand Down
15 changes: 13 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## Unreleased

For a full diff see [`1.0.1...main`][1.0.1...main].
For a full diff see [`1.1.0...main`][1.1.0...main].

## [`1.1.0`][1.1.0]

For a full diff see [`1.0.1...1.1.0`][1.0.1...1.1.0].

### Changed

* Added support for PHP 8.0 ([#235]), by [@localheinz]

## [`1.0.1`][1.0.1]

Expand Down Expand Up @@ -78,18 +86,21 @@ For a full diff see [`0.4.0...0.5.0`][0.4.0...0.5.0].
[0.5.1]: https://github.com/localheinz/ergebnis/classy/releases/tag/0.5.1
[0.5.2]: https://github.com/localheinz/ergebnis/classy/releases/tag/0.5.2
[1.0.1]: https://github.com/localheinz/ergebnis/classy/releases/tag/1.0.1
[1.1.0]: https://github.com/localheinz/ergebnis/classy/releases/tag/1.1.0

[0.4.0...0.5.0]: https://github.com/ergebnis/classy/compare/0.4.0...0.5.0
[0.5.0...0.5.1]: https://github.com/ergebnis/classy/compare/0.5.0...0.5.1
[0.5.1...0.5.2]: https://github.com/ergebnis/classy/compare/0.5.1...0.5.2
[1.0.0...1.0.1]: https://github.com/ergebnis/classy/compare/1.0.0...1.0.1
[1.0.1...main]: https://github.com/ergebnis/classy/compare/1.0.1...main
[1.0.1...1.1.0]: https://github.com/ergebnis/classy/compare/1.0.1...1.1.0
[1.1.0...main]: https://github.com/ergebnis/classy/compare/1.1.0...main

[#77]: https://github.com/ergebnis/classy/pull/77
[#88]: https://github.com/ergebnis/classy/pull/88
[#100]: https://github.com/ergebnis/classy/pull/100
[#103]: https://github.com/ergebnis/classy/pull/103
[#231]: https://github.com/ergebnis/classy/pull/231
[#235]: https://github.com/ergebnis/classy/pull/235

[@ergebnis]: https://github.com/ergebnis
[@localheinz]: https://github.com/localheinz
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
COMPOSER_ROOT_VERSION:=1.0-dev
MIN_COVERED_MSI:=89
MIN_MSI:=87
MIN_COVERED_MSI:=86
MIN_MSI:=85

.PHONY: it
it: coding-standards static-code-analysis tests ## Runs the coding-standards, static-code-analysis, and tests targets
Expand Down
3 changes: 2 additions & 1 deletion composer-require-checker.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"static",
"string",
"true",
"void"
"void",
"T_NAME_QUALIFIED"
]
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
}
],
"require": {
"php": "^7.2",
"php": "^7.2 || ^8.0",
"ext-tokenizer": "*"
},
"require-dev": {
Expand Down
4 changes: 2 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion src/Constructs.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ public static function fromSource(string $source): array
$count = \count($sequence);
$namespacePrefix = '';

$namespaceSegmentOrNamespaceToken = \T_STRING;

// https://wiki.php.net/rfc/namespaced_names_as_token
if (\PHP_VERSION_ID >= 80000 && \defined('T_NAME_QUALIFIED')) {
/** @var int $namespaceSegmentOrNamespaceToken */
$namespaceSegmentOrNamespaceToken = T_NAME_QUALIFIED;
}

for ($index = 0; $index < $count; ++$index) {
$token = $sequence[$index];

Expand All @@ -51,7 +59,7 @@ public static function fromSource(string $source): array
for ($index = self::significantAfter($index, $sequence, $count); $index < $count; ++$index) {
$token = $sequence[$index];

if (\is_array($token) && \T_STRING !== $token[0]) {
if (\is_array($token) && $namespaceSegmentOrNamespaceToken !== $token[0]) {
continue;
}

Expand Down

0 comments on commit 0b04738

Please sign in to comment.