From bb20863457b83d0b7f5de6685e6bd0282fc17a04 Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Sun, 7 Feb 2021 19:54:38 +0100 Subject: [PATCH 1/4] [cs] bump build-cs deps to comply with PHP 8 --- build-cs/composer.json | 9 ++++++--- build.xml | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/build-cs/composer.json b/build-cs/composer.json index ea2bcb12..7a3d4e64 100644 --- a/build-cs/composer.json +++ b/build-cs/composer.json @@ -1,7 +1,10 @@ { + "require": { + "php": "^7.1 || ^8.0" + }, "require-dev": { - "consistence/coding-standard": "^3.5", - "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", - "slevomat/coding-standard": "^4.7.2" + "consistence/coding-standard": "^3.10", + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.1", + "slevomat/coding-standard": "^6.4.1" } } diff --git a/build.xml b/build.xml index 7d72b164..04716105 100644 --- a/build.xml +++ b/build.xml @@ -60,6 +60,7 @@ + Date: Sun, 7 Feb 2021 20:01:31 +0100 Subject: [PATCH 2/4] update phpcs.xml to Slevomat CS 6.4 --- phpcs.xml | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/phpcs.xml b/phpcs.xml index 16469c5a..e458f164 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -20,19 +20,26 @@ - + - - - + + + + + + + + + + + + + - + From cc8d8fc4f1f954644cd68f251153528a563c96d0 Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Sun, 7 Feb 2021 20:02:02 +0100 Subject: [PATCH 3/4] apply cs-fix --- src/Parser/ConstExprParser.php | 6 ++++-- src/Parser/TypeParser.php | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Parser/ConstExprParser.php b/src/Parser/ConstExprParser.php index 012a0cbe..b0ee83d9 100644 --- a/src/Parser/ConstExprParser.php +++ b/src/Parser/ConstExprParser.php @@ -14,13 +14,15 @@ public function parse(TokenIterator $tokens, bool $trimStrings = false): Ast\Con $value = $tokens->currentTokenValue(); $tokens->next(); return new Ast\ConstExpr\ConstExprFloatNode($value); + } - } elseif ($tokens->isCurrentTokenType(Lexer::TOKEN_INTEGER)) { + if ($tokens->isCurrentTokenType(Lexer::TOKEN_INTEGER)) { $value = $tokens->currentTokenValue(); $tokens->next(); return new Ast\ConstExpr\ConstExprIntegerNode($value); + } - } elseif ($tokens->isCurrentTokenType(Lexer::TOKEN_SINGLE_QUOTED_STRING)) { + if ($tokens->isCurrentTokenType(Lexer::TOKEN_SINGLE_QUOTED_STRING)) { $value = $tokens->currentTokenValue(); if ($trimStrings) { $value = trim($tokens->currentTokenValue(), "'"); diff --git a/src/Parser/TypeParser.php b/src/Parser/TypeParser.php index c123ee3f..71543a72 100644 --- a/src/Parser/TypeParser.php +++ b/src/Parser/TypeParser.php @@ -47,7 +47,9 @@ private function parseAtomic(TokenIterator $tokens): Ast\Type\TypeNode } return $type; - } elseif ($tokens->tryConsumeTokenType(Lexer::TOKEN_THIS_VARIABLE)) { + } + + if ($tokens->tryConsumeTokenType(Lexer::TOKEN_THIS_VARIABLE)) { $type = new Ast\Type\ThisTypeNode(); if ($tokens->isCurrentTokenType(Lexer::TOKEN_OPEN_SQUARE_BRACKET)) { From 42d4318045b248a3e790f71175c8a7e2f13d47c1 Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Sun, 7 Feb 2021 20:11:45 +0100 Subject: [PATCH 4/4] use php_version config to set object typehint requirement --- phpcs.xml | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/phpcs.xml b/phpcs.xml index e458f164..35d9cf94 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -1,5 +1,6 @@ + @@ -20,22 +21,11 @@ - - - - - - + - - - - - -