Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for PHP 8.2 #438

Merged
merged 8 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Http/UserAgent/AbstractDevice.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Locale/Format.php
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ public static function convertPhpToIsoFormat($format)
}
}

return implode($converted);
return implode('', $converted);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Markup/Renderer/RendererAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Pdf/Action/URI.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions library/Zend/Pdf/Element.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
*/
abstract class Zend_Pdf_Element
{
public $value;
const TYPE_BOOL = 1;
const TYPE_NUMERIC = 2;
const TYPE_STRING = 3;
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Pdf/Element/String.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public static function unescape($str)
}
}

return implode($outEntries);
return implode('', $outEntries);
}

}
2 changes: 1 addition & 1 deletion library/Zend/Pdf/Element/String/Binary.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public static function unescape($inStr)
$chunks[] = '0';
}

return pack('H*' , implode($chunks));
return pack('H*' , implode('', $chunks));
}


Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Search/Lucene/Document/Html.php
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,6 @@ public function getHtmlBody()
$outputFragments[] = $this->_doc->saveXML($bodyNodes->item($count));
}

return implode($outputFragments);
return implode('', $outputFragments);
}
}
1 change: 1 addition & 0 deletions library/Zend/Service/Rackspace/Files/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Service/WindowsAzure/Storage/Blob.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions library/Zend/Soap/Client/Local.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
*/
class Zend_Soap_Client_Local extends Zend_Soap_Client
{
public $server;
/**
* Server object
*
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Validate/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Validate/Hostname.php
Original file line number Diff line number Diff line change
Expand Up @@ -2421,6 +2421,6 @@ protected function decodePunycode($encoded)
}
}

return implode($decoded);
return implode('', $decoded);
}
}
6 changes: 2 additions & 4 deletions library/Zend/Wildfire/Plugin/FirePhp.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
*/
class Zend_Wildfire_Plugin_FirePhp implements Zend_Wildfire_Plugin_Interface
{
public $objectFilters;
/**
* Plain log style.
*/
Expand Down Expand Up @@ -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());
}
}

Expand Down
4 changes: 2 additions & 2 deletions library/Zend/XmlRpc/Value.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
}
}
38 changes: 35 additions & 3 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand All @@ -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);
};
1 change: 0 additions & 1 deletion tests/Zend/Layout/FunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public static function main()
protected function set_up()
{
$this->bootstrap = [$this, 'appBootstrap'];
parent::set_up();
}

public function appBootstrap()
Expand Down
Loading