diff --git a/composer.json b/composer.json index 4ad0de3e0b..aeed2060e3 100644 --- a/composer.json +++ b/composer.json @@ -37,8 +37,8 @@ "require-dev": { "phpunit/phpunit": "^7|^8|^9", "php-parallel-lint/php-parallel-lint": "^1.3", - "rector/rector": "^0.12.19", - "yoast/phpunit-polyfills": "2.0" + "yoast/phpunit-polyfills": "2.0", + "rector/rector": "^1.2" }, "archive": { "exclude": ["/demos", "/documentation", "/tests"] diff --git a/library/Zend/Http/UserAgent/AbstractDevice.php b/library/Zend/Http/UserAgent/AbstractDevice.php index c1a8e40365..c0b100f47b 100644 --- a/library/Zend/Http/UserAgent/AbstractDevice.php +++ b/library/Zend/Http/UserAgent/AbstractDevice.php @@ -301,7 +301,7 @@ protected function _getDefaultFeatures() $server = []; // gets info from user agent chain - $uaExtract = $this->extractFromUserAgent($this->getUserAgent()); + $uaExtract = static::extractFromUserAgent($this->getUserAgent()); if (is_array($uaExtract)) { foreach ($uaExtract as $key => $info) { diff --git a/library/Zend/Locale/Format.php b/library/Zend/Locale/Format.php index 8a5c8d5232..985fa02486 100644 --- a/library/Zend/Locale/Format.php +++ b/library/Zend/Locale/Format.php @@ -807,7 +807,7 @@ public static function convertPhpToIsoFormat($format) } } - return implode($converted); + return implode('', $converted); } /** diff --git a/library/Zend/Markup/Renderer/RendererAbstract.php b/library/Zend/Markup/Renderer/RendererAbstract.php index fcebcce328..1f4fd413d8 100644 --- a/library/Zend/Markup/Renderer/RendererAbstract.php +++ b/library/Zend/Markup/Renderer/RendererAbstract.php @@ -126,7 +126,7 @@ public function __construct($options = []) } if (isset($options['encoding'])) { - $this->setEncoding($options['encoding']); + static::setEncoding($options['encoding']); } if (isset($options['parser'])) { $this->setParser($options['parser']); diff --git a/library/Zend/Pdf/Action/URI.php b/library/Zend/Pdf/Action/URI.php index c8c663ad09..10a199ef78 100644 --- a/library/Zend/Pdf/Action/URI.php +++ b/library/Zend/Pdf/Action/URI.php @@ -107,7 +107,7 @@ public static function create($uri, $isMap = false) */ public function setUri($uri) { - $this->_validateUri($uri); + static::_validateUri($uri); $this->_actionDictionary->touch(); $this->_actionDictionary->URI = new Zend_Pdf_Element_String($uri); diff --git a/library/Zend/Pdf/Element.php b/library/Zend/Pdf/Element.php index fec0e0b19e..7f27361a7b 100644 --- a/library/Zend/Pdf/Element.php +++ b/library/Zend/Pdf/Element.php @@ -29,6 +29,7 @@ */ abstract class Zend_Pdf_Element { + public $value; const TYPE_BOOL = 1; const TYPE_NUMERIC = 2; const TYPE_STRING = 3; diff --git a/library/Zend/Pdf/Element/String.php b/library/Zend/Pdf/Element/String.php index a2a44deb32..9bac8f0465 100644 --- a/library/Zend/Pdf/Element/String.php +++ b/library/Zend/Pdf/Element/String.php @@ -257,7 +257,7 @@ public static function unescape($str) } } - return implode($outEntries); + return implode('', $outEntries); } } diff --git a/library/Zend/Pdf/Element/String/Binary.php b/library/Zend/Pdf/Element/String/Binary.php index fe1e0ac8a1..ff072e47d7 100644 --- a/library/Zend/Pdf/Element/String/Binary.php +++ b/library/Zend/Pdf/Element/String/Binary.php @@ -81,7 +81,7 @@ public static function unescape($inStr) $chunks[] = '0'; } - return pack('H*' , implode($chunks)); + return pack('H*' , implode('', $chunks)); } diff --git a/library/Zend/Search/Lucene/Document/Html.php b/library/Zend/Search/Lucene/Document/Html.php index 31422cde0b..bae69cb1ef 100644 --- a/library/Zend/Search/Lucene/Document/Html.php +++ b/library/Zend/Search/Lucene/Document/Html.php @@ -478,6 +478,6 @@ public function getHtmlBody() $outputFragments[] = $this->_doc->saveXML($bodyNodes->item($count)); } - return implode($outputFragments); + return implode('', $outputFragments); } } diff --git a/library/Zend/Service/Rackspace/Files/Container.php b/library/Zend/Service/Rackspace/Files/Container.php index 4ab3d8fb71..086d7b5be5 100644 --- a/library/Zend/Service/Rackspace/Files/Container.php +++ b/library/Zend/Service/Rackspace/Files/Container.php @@ -24,6 +24,7 @@ class Zend_Service_Rackspace_Files_Container { + public $service; const ERROR_PARAM_FILE_CONSTRUCT = 'The Zend_Service_Rackspace_Files passed in construction is not valid'; const ERROR_PARAM_ARRAY_CONSTRUCT = 'The array passed in construction is not valid'; diff --git a/library/Zend/Service/WindowsAzure/Storage/Blob.php b/library/Zend/Service/WindowsAzure/Storage/Blob.php index 3e0f2fd801..52acfade65 100644 --- a/library/Zend/Service/WindowsAzure/Storage/Blob.php +++ b/library/Zend/Service/WindowsAzure/Storage/Blob.php @@ -1127,7 +1127,7 @@ public function putPage($containerName = '', $blobName = '', $startByteOffset = $size = strlen($contents); if ($size >= self::MAX_BLOB_TRANSFER_SIZE) { require_once 'Zend/Service/WindowsAzure/Exception.php'; - throw new Zend_Service_WindowsAzure_Exception('Page blob size must not be larger than ' + self::MAX_BLOB_TRANSFER_SIZE . ' bytes.'); + throw new Zend_Service_WindowsAzure_Exception('Page blob size must not be larger than ' . self::MAX_BLOB_TRANSFER_SIZE . ' bytes.'); } // Create metadata headers diff --git a/library/Zend/Soap/Client/Local.php b/library/Zend/Soap/Client/Local.php index 11444fc5cb..2d0f34e6d4 100644 --- a/library/Zend/Soap/Client/Local.php +++ b/library/Zend/Soap/Client/Local.php @@ -42,6 +42,7 @@ */ class Zend_Soap_Client_Local extends Zend_Soap_Client { + public $server; /** * Server object * diff --git a/library/Zend/Validate/Abstract.php b/library/Zend/Validate/Abstract.php index 3b2bbdba14..eb939770ea 100644 --- a/library/Zend/Validate/Abstract.php +++ b/library/Zend/Validate/Abstract.php @@ -233,7 +233,7 @@ protected function _createMessage($messageKey, $value) } elseif (is_array($value)) { $value = $this->_implodeRecursive($value); } else { - $value = implode((array) $value); + $value = implode('', (array) $value); } if ($this->getObscureValue()) { diff --git a/library/Zend/Validate/Hostname.php b/library/Zend/Validate/Hostname.php index c587f428cd..d24bf2bd47 100644 --- a/library/Zend/Validate/Hostname.php +++ b/library/Zend/Validate/Hostname.php @@ -2421,6 +2421,6 @@ protected function decodePunycode($encoded) } } - return implode($decoded); + return implode('', $decoded); } } diff --git a/library/Zend/Wildfire/Plugin/FirePhp.php b/library/Zend/Wildfire/Plugin/FirePhp.php index 67e588a3a2..1e9da387fd 100644 --- a/library/Zend/Wildfire/Plugin/FirePhp.php +++ b/library/Zend/Wildfire/Plugin/FirePhp.php @@ -46,6 +46,7 @@ */ class Zend_Wildfire_Plugin_FirePhp implements Zend_Wildfire_Plugin_Interface { + public $objectFilters; /** * Plain log style. */ @@ -816,10 +817,7 @@ public function flushMessages($protocolUri) foreach( $this->_messages as $message ) { if (!$message->getDestroy()) { - $this->send($message->getMessage(), - $message->getLabel(), - $message->getStyle(), - $message->getOptions()); + static::send($message->getMessage(), $message->getLabel(), $message->getStyle(), $message->getOptions()); } } diff --git a/library/Zend/XmlRpc/Value.php b/library/Zend/XmlRpc/Value.php index 9654660ed8..b721443ec4 100644 --- a/library/Zend/XmlRpc/Value.php +++ b/library/Zend/XmlRpc/Value.php @@ -158,7 +158,7 @@ public function saveXml() { if (!$this->_xml) { $this->generateXml(); - $this->_xml = (string) $this->getGenerator(); + $this->_xml = (string) static::getGenerator(); } return $this->_xml; } @@ -526,6 +526,6 @@ protected static function _extractTypeAndValue(SimpleXMLElement $xml, &$type, &$ */ protected function _setXML($xml) { - $this->_xml = $this->getGenerator()->stripDeclaration($xml); + $this->_xml = static::getGenerator()->stripDeclaration($xml); } } diff --git a/rector.php b/rector.php index 9d4840f4a4..ebb4301cc7 100644 --- a/rector.php +++ b/rector.php @@ -4,7 +4,21 @@ use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector; use Rector\Config\RectorConfig; +use Rector\Php53\Rector\FuncCall\DirNameFileConstantToDirConstantRector; +use Rector\Php53\Rector\Ternary\TernaryToElvisRector; +use Rector\Php54\Rector\Array_\LongArrayToShortArrayRector; +use Rector\Php55\Rector\Class_\ClassConstantToSelfClassRector; +use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector; +use Rector\Php56\Rector\FuncCall\PowToExpRector; +use Rector\Php70\Rector\FuncCall\MultiDirnameRector; +use Rector\Php70\Rector\FuncCall\RandomFunctionRector; +use Rector\Php70\Rector\StmtsAwareInterface\IfIssetToCoalescingRector; +use Rector\Php70\Rector\Ternary\TernaryToNullCoalescingRector; +use Rector\Php70\Rector\Variable\WrapVariableVariableNameInCurlyBracesRector; +use Rector\Php71\Rector\FuncCall\RemoveExtraParametersRector; +use Rector\Php71\Rector\List_\ListToArrayDestructRector; use Rector\Set\ValueObject\LevelSetList; +use Rector\ValueObject\PhpVersion; return static function (RectorConfig $rectorConfig): void { $rectorConfig->paths([ @@ -15,9 +29,27 @@ // register a single rule // https://github.com/rectorphp/rector/blob/main/docs/rector_rules_overview.md#completedynamicpropertiesrector $rectorConfig->rule(CompleteDynamicPropertiesRector::class); + $rectorConfig->skip([ + MultiDirnameRector::class, + DirNameFileConstantToDirConstantRector::class, + ListToArrayDestructRector::class, + ClassConstantToSelfClassRector::class, + RemoveExtraParametersRector::class, + IfIssetToCoalescingRector::class, + StringClassNameToClassConstantRector::class, + TernaryToElvisRector::class, + RandomFunctionRector::class, + LongArrayToShortArrayRector::class, + WrapVariableVariableNameInCurlyBracesRector::class, + TernaryToNullCoalescingRector::class, + PowToExpRector::class, + __DIR__ . '/tests/Zend/Loader/_files/ParseError.php', + ]); + $a = pow(12, 23); // define sets of rules - // $rectorConfig->sets([ - // LevelSetList::UP_TO_PHP_82 - // ]); + $rectorConfig->sets([ + LevelSetList::UP_TO_PHP_82 + ]); + $rectorConfig->phpVersion(PhpVersion::PHP_71); }; diff --git a/tests/Zend/Layout/FunctionalTest.php b/tests/Zend/Layout/FunctionalTest.php index b37405b12e..7d762e4c2b 100644 --- a/tests/Zend/Layout/FunctionalTest.php +++ b/tests/Zend/Layout/FunctionalTest.php @@ -57,7 +57,6 @@ public static function main() protected function set_up() { $this->bootstrap = [$this, 'appBootstrap']; - parent::set_up(); } public function appBootstrap()