From 88a3d288de021206f584d0be65be9a4593eb8392 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Mon, 20 Feb 2023 12:49:59 +0100 Subject: [PATCH 1/3] Workaround arm64 opcache bug (fixes #9350) --- .../Statements/Expression/BinaryOp/ConcatAnalyzer.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php index 44dc2859b7d..61899ef83b7 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php @@ -2,6 +2,7 @@ namespace Psalm\Internal\Analyzer\Statements\Expression\BinaryOp; +use AssertionError; use PhpParser; use Psalm\CodeLocation; use Psalm\Config; @@ -41,7 +42,6 @@ use Psalm\Type\Union; use UnexpectedValueException; -use function assert; use function count; use function reset; use function strlen; @@ -178,8 +178,12 @@ public static function analyze( } if ($literal_concat) { - assert(count($result_type_parts) === $combinations); - assert(count($result_type_parts) !== 0); // #8163 + if (count($result_type_parts) === 0) { + throw new AssertionError("The number of parts cannot be 0!"); + } + if (count($result_type_parts) !== $combinations) { + throw new AssertionError("The number of parts does not match!"); + } $result_type = new Union($result_type_parts); } } From a01c6348786d9b6a5a8697e8c8b4e901744fe280 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Mon, 20 Feb 2023 13:49:58 +0100 Subject: [PATCH 2/3] Run tests with opcache --- .github/workflows/ci.yml | 2 +- .github/workflows/windows-ci.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ded89da5cd1..4fefbe3a081 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -87,7 +87,7 @@ jobs: ini-values: zend.assertions=1, assert.exception=1 tools: composer:v2 coverage: none - extensions: none, curl, dom, filter, intl, json, libxml, mbstring, openssl, pcre, phar, reflection, simplexml, spl, tokenizer, xml, xmlwriter + extensions: none, curl, dom, filter, intl, json, libxml, mbstring, opcache, openssl, pcre, phar, reflection, simplexml, spl, tokenizer, xml, xmlwriter - uses: actions/checkout@v3 diff --git a/.github/workflows/windows-ci.yml b/.github/workflows/windows-ci.yml index 8e202adf150..8bc4039113e 100644 --- a/.github/workflows/windows-ci.yml +++ b/.github/workflows/windows-ci.yml @@ -58,7 +58,7 @@ jobs: ini-values: zend.assertions=1, assert.exception=1 tools: composer:v2 coverage: none - extensions: none, curl, dom, filter, intl, json, libxml, mbstring, openssl, pcre, phar, reflection, simplexml, spl, tokenizer, xml, xmlwriter + extensions: none, curl, dom, filter, intl, json, libxml, mbstring, openssl, opcache, pcre, phar, reflection, simplexml, spl, tokenizer, xml, xmlwriter - uses: actions/checkout@v3 From 484043a5a1d4c992b9488461dd14dabcc877b6fe Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Mon, 20 Feb 2023 13:54:55 +0100 Subject: [PATCH 3/3] Enable JIT --- .github/workflows/ci.yml | 2 +- .github/workflows/windows-ci.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4fefbe3a081..552dc6b7363 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -84,7 +84,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: '8.1' - ini-values: zend.assertions=1, assert.exception=1 + ini-values: zend.assertions=1, assert.exception=1, opcache.enable_cli=1, opcache.jit=function, opcache.jit_buffer_size=512M tools: composer:v2 coverage: none extensions: none, curl, dom, filter, intl, json, libxml, mbstring, opcache, openssl, pcre, phar, reflection, simplexml, spl, tokenizer, xml, xmlwriter diff --git a/.github/workflows/windows-ci.yml b/.github/workflows/windows-ci.yml index 8bc4039113e..396b6fff8d8 100644 --- a/.github/workflows/windows-ci.yml +++ b/.github/workflows/windows-ci.yml @@ -55,7 +55,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: '8.0' - ini-values: zend.assertions=1, assert.exception=1 + ini-values: zend.assertions=1, assert.exception=1, opcache.enable_cli=1, opcache.jit=function, opcache.jit_buffer_size=512M tools: composer:v2 coverage: none extensions: none, curl, dom, filter, intl, json, libxml, mbstring, openssl, opcache, pcre, phar, reflection, simplexml, spl, tokenizer, xml, xmlwriter