From 4bf63683a2402b107920ec7ed6d9967d8c3283a2 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 3 Aug 2018 17:58:43 +0200 Subject: [PATCH 1/2] Replace "continue" by "break" in "switch" statements --- src/Generator/FileGenerator.php | 6 +++--- src/Reflection/MethodReflection.php | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Generator/FileGenerator.php b/src/Generator/FileGenerator.php index 4abcafe3..8253b603 100644 --- a/src/Generator/FileGenerator.php +++ b/src/Generator/FileGenerator.php @@ -155,17 +155,17 @@ public static function fromArray(array $values) switch (strtolower(str_replace(['.', '-', '_'], '', $name))) { case 'filename': $fileGenerator->setFilename($value); - continue; + break; case 'class': $fileGenerator->setClass( $value instanceof ClassGenerator ? $value : ClassGenerator::fromArray($value) ); - continue; + break; case 'requiredfiles': $fileGenerator->setRequiredFiles($value); - continue; + break; default: if (property_exists($fileGenerator, $name)) { $fileGenerator->{$name} = $value; diff --git a/src/Reflection/MethodReflection.php b/src/Reflection/MethodReflection.php index d7b75a6c..a18a99db 100644 --- a/src/Reflection/MethodReflection.php +++ b/src/Reflection/MethodReflection.php @@ -287,22 +287,22 @@ protected function extractMethodContents($bodyOnly = false) //closure test if ($firstBrace && $tokenType == 'T_FUNCTION') { $body .= $tokenValue; - continue; + break; } $capture = false; - continue; + break; } break; case '{': if ($capture === false) { - continue; + break; } if ($firstBrace === false) { $firstBrace = true; if ($bodyOnly === true) { - continue; + break; } } @@ -311,7 +311,7 @@ protected function extractMethodContents($bodyOnly = false) case '}': if ($capture === false) { - continue; + break; } //check to see if this is the last brace @@ -329,12 +329,12 @@ protected function extractMethodContents($bodyOnly = false) default: if ($capture === false) { - continue; + break; } // if returning body only wait for first brace before capturing if ($bodyOnly === true && $firstBrace !== true) { - continue; + break; } $body .= $tokenValue; From c8cb5c3f6241b9cb1e3c8187d2fbc70858ff07ae Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Mon, 13 Aug 2018 15:35:33 -0500 Subject: [PATCH 2/2] Adds CHANGELOG entry for #158 --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5bb9736f..e23df056 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,9 @@ All notable changes to this project will be documented in this file, in reverse ### Fixed +- [#158](https://github.com/zendframework/zend-code/pull/158) updates several `switch` cases to use `break` instead of `continue` + in order to prevent issues under the upcoming PHP 7.3 release. + - [#147](https://github.com/zendframework/zend-code/pull/147) fixes the regular expression used for `@var` annotations to allow omission of the variable name.