Skip to content

Commit

Permalink
Nc php8.1 (#9)
Browse files Browse the repository at this point in the history
* trim fix
* rector NullToStrictStringFuncCallArgRector
  • Loading branch information
MasterSalomon authored May 23, 2024
1 parent af0205a commit 2e88a79
Show file tree
Hide file tree
Showing 248 changed files with 588 additions and 588 deletions.
2 changes: 1 addition & 1 deletion library/Zend/Amf/Parse/TypeLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public static function getResourceParser($resource)
{
if(self::$_resourceLoader) {
$type = preg_replace("/[^A-Za-z0-9_]/", " ", get_resource_type($resource));
$type = str_replace(" ","", ucwords($type));
$type = str_replace(" ","", ucwords((string) $type));
return self::$_resourceLoader->load($type);
}
return false;
Expand Down
14 changes: 7 additions & 7 deletions library/Zend/Amf/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -559,11 +559,11 @@ protected function _handle(Zend_Amf_Request $request)
$message = '';

// Split the target string into its values.
$source = substr($targetURI, 0, strrpos($targetURI, '.'));
$source = substr((string) $targetURI, 0, strrpos((string) $targetURI, '.'));

if ($source) {
// Break off method name from namespace into source
$method = substr(strrchr($targetURI, '.'), 1);
$method = substr(strrchr((string) $targetURI, '.'), 1);
$return = $this->_dispatch($method, $body->getData(), $source);
} else {
// Just have a method name.
Expand All @@ -586,11 +586,11 @@ protected function _handle(Zend_Amf_Request $request)
$targetURI = $body->getTargetURI();

// Split the target string into its values.
$source = substr($targetURI, 0, strrpos($targetURI, '.'));
$source = substr((string) $targetURI, 0, strrpos((string) $targetURI, '.'));

if ($source) {
// Break off method name from namespace into source
$method = substr(strrchr($targetURI, '.'), 1);
$method = substr(strrchr((string) $targetURI, '.'), 1);
$return = $this->_dispatch($method, $body->getData(), $source);
} else {
// Just have a method name.
Expand All @@ -615,8 +615,8 @@ protected function _handle(Zend_Amf_Request $request)
$currentID = session_id();
$joint = "?";
if(isset($_SERVER['QUERY_STRING'])) {
if(!strpos($_SERVER['QUERY_STRING'], $currentID) !== FALSE) {
if(strrpos($_SERVER['QUERY_STRING'], "?") !== FALSE) {
if(!strpos((string) $_SERVER['QUERY_STRING'], $currentID) !== FALSE) {
if(strrpos((string) $_SERVER['QUERY_STRING'], "?") !== FALSE) {
$joint = "&";
}
}
Expand Down Expand Up @@ -999,7 +999,7 @@ protected function _castParameters($reflectionMethod, array $params)
foreach ($prototypes as $prototype) {
foreach ($prototype->getParameters() as $parameter) {
$type = $parameter->getType();
if (in_array(strtolower($type), $nonObjectTypes)) {
if (in_array(strtolower((string) $type), $nonObjectTypes)) {
continue;
}
$position = $parameter->getPosition();
Expand Down
4 changes: 2 additions & 2 deletions library/Zend/Application/Bootstrap/BootstrapAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ protected function _loadPluginResource($resource, $options)
if (isset($instance->_explicitType)) {
$resource = $instance->_explicitType;
}
$resource = strtolower($resource);
$resource = strtolower((string) $resource);
$this->_pluginResources[$resource] = $instance;

return $resource;
Expand Down Expand Up @@ -771,7 +771,7 @@ protected function _resolvePluginResourceName($resource)
$pluginName = $className;
$loader = $this->getPluginLoader();
foreach ($loader->getPaths() as $prefix => $paths) {
if (0 === strpos($className, $prefix)) {
if (0 === strpos($className, (string) $prefix)) {
$pluginName = substr($className, strlen((string) $prefix));
$pluginName = trim($pluginName, '_');
break;
Expand Down
4 changes: 2 additions & 2 deletions library/Zend/Application/Resource/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ protected function _setDefaults($type)
if (isset($options[$key]['email'])
&& !is_numeric($options[$key]['email'])
) {
$method = array('Zend_Mail', 'setDefault' . ucfirst($type));
$method = array('Zend_Mail', 'setDefault' . ucfirst((string) $type));
if (isset($options[$key]['name'])
&& !is_numeric(
$options[$key]['name']
Expand All @@ -113,7 +113,7 @@ protected function _setupTransport($options)

$transportName = $options['type'];
if (!Zend_Loader_Autoloader::autoload($transportName)) {
$transportName = ucfirst(strtolower($transportName));
$transportName = ucfirst(strtolower((string) $transportName));

if (!Zend_Loader_Autoloader::autoload($transportName)) {
$transportName = 'Zend_Mail_Transport_' . $transportName;
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Application/Resource/Modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function init()
foreach ($modules as $module => $moduleDirectory) {
$bootstrapClass = $this->_formatModuleName($module) . '_Bootstrap';
if (!class_exists($bootstrapClass, false)) {
$bootstrapPath = dirname($moduleDirectory) . '/Bootstrap.php';
$bootstrapPath = dirname((string) $moduleDirectory) . '/Bootstrap.php';
if (file_exists($bootstrapPath)) {
$eMsgTpl = 'Bootstrap file found for module "%s" but bootstrap class "%s" not found';
include_once $bootstrapPath;
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Application/Resource/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function getView()
$this->_view = new Zend_View($options);

if (isset($options['doctype'])) {
$this->_view->doctype()->setDoctype(strtoupper($options['doctype']));
$this->_view->doctype()->setDoctype(strtoupper((string) $options['doctype']));
if (isset($options['charset']) && $this->_view->doctype()->isHtml5()) {
$this->_view->headMeta()->setCharset($options['charset']);
}
Expand Down
10 changes: 5 additions & 5 deletions library/Zend/Auth/Adapter/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,9 @@ public function __construct(array $config)
// Double-quotes are used to delimit the realm string in the HTTP header,
// and colons are field delimiters in the password file.
if (empty($config['realm']) ||
!ctype_print($config['realm']) ||
strpos($config['realm'], ':') !== false ||
strpos($config['realm'], '"') !== false) {
!ctype_print((string) $config['realm']) ||
strpos((string) $config['realm'], ':') !== false ||
strpos((string) $config['realm'], '"') !== false) {
/**
* @see Zend_Auth_Adapter_Exception
*/
Expand All @@ -216,8 +216,8 @@ public function __construct(array $config)

if (in_array('digest', $this->_acceptSchemes)) {
if (empty($config['digest_domains']) ||
!ctype_print($config['digest_domains']) ||
strpos($config['digest_domains'], '"') !== false) {
!ctype_print((string) $config['digest_domains']) ||
strpos((string) $config['digest_domains'], '"') !== false) {
/**
* @see Zend_Auth_Adapter_Exception
*/
Expand Down
4 changes: 2 additions & 2 deletions library/Zend/Auth/Adapter/Ldap.php
Original file line number Diff line number Diff line change
Expand Up @@ -419,10 +419,10 @@ protected function _prepareOptions(Zend_Ldap $ldap, array $options)
break;
case 'memberIsDn':
$adapterOptions[$key] = ($value === true ||
$value === '1' || strcasecmp($value, 'true') == 0);
$value === '1' || strcasecmp((string) $value, 'true') == 0);
break;
default:
$adapterOptions[$key] = trim($value);
$adapterOptions[$key] = trim((string) $value);
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Barcode/Object/Code128.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ protected function _prepareBarcode()

foreach ($convertedChars as $barcodeChar) {
$barcodePattern = $this->_codingMap[$barcodeChar];
foreach (str_split($barcodePattern) as $c) {
foreach (str_split((string) $barcodePattern) as $c) {
$barcodeTable[] = array($c, $this->_barThinWidth, 0, 1);
}
}
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Barcode/Object/Code25.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ protected function _prepareBarcode()

$text = str_split($this->getText());
foreach ($text as $char) {
$barcodeChar = str_split($this->_codingMap[$char]);
$barcodeChar = str_split((string) $this->_codingMap[$char]);
foreach ($barcodeChar as $c) {
/* visible, width, top, length */
$width = $c ? $this->_barThickWidth : $this->_barThinWidth;
Expand Down
4 changes: 2 additions & 2 deletions library/Zend/Barcode/Object/Code25interleaved.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ protected function _prepareBarcode()
// Interleave
for ($ibar = 0; $ibar < 5; $ibar ++) {
// Draws char1 bar (fore color)
$barWidth = (substr($this->_codingMap[$char1], $ibar, 1))
$barWidth = (substr((string) $this->_codingMap[$char1], $ibar, 1))
? $this->_barThickWidth
: $this->_barThinWidth;

$barcodeTable[] = array(1, $barWidth, 0, 1);

// Left space corresponding to char2 (background color)
$barWidth = (substr($this->_codingMap[$char2], $ibar, 1))
$barWidth = (substr((string) $this->_codingMap[$char2], $ibar, 1))
? $this->_barThickWidth
: $this->_barThinWidth;
$barcodeTable[] = array(0, $barWidth, 0 , 1);
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Barcode/Object/Code39.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ protected function _prepareBarcode()
$text = str_split($this->getText());
$barcodeTable = array();
foreach ($text as $char) {
$barcodeChar = str_split($this->_codingMap[$char]);
$barcodeChar = str_split((string) $this->_codingMap[$char]);
$visible = true;
foreach ($barcodeChar as $c) {
/* visible, width, top, length */
Expand Down
4 changes: 2 additions & 2 deletions library/Zend/Barcode/Object/Ean13.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ protected function _prepareBarcode()

// First part
for ($i = 1; $i < 7; $i++) {
$bars = str_split($this->_codingMap[$parity[$i - 1]][$textTable[$i]]);
$bars = str_split((string) $this->_codingMap[$parity[$i - 1]][$textTable[$i]]);
foreach ($bars as $b) {
$barcodeTable[] = array($b , $this->_barThinWidth , 0 , 1);
}
Expand All @@ -140,7 +140,7 @@ protected function _prepareBarcode()

// Second part
for ($i = 7; $i < 13; $i++) {
$bars = str_split($this->_codingMap['C'][$textTable[$i]]);
$bars = str_split((string) $this->_codingMap['C'][$textTable[$i]]);
foreach ($bars as $b) {
$barcodeTable[] = array($b , $this->_barThinWidth , 0 , 1);
}
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Barcode/Object/Ean5.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ protected function _prepareBarcode()
$barcodeTable[] = array(0 , $this->_barThinWidth , 0 , 1);
$barcodeTable[] = array(1 , $this->_barThinWidth , 0 , 1);
}
$bars = str_split($this->_codingMap[$this->_getParity($i)][$textTable[$i]]);
$bars = str_split((string) $this->_codingMap[$this->_getParity($i)][$textTable[$i]]);
foreach ($bars as $b) {
$barcodeTable[] = array($b , $this->_barThinWidth , 0 , 1);
}
Expand Down
4 changes: 2 additions & 2 deletions library/Zend/Barcode/Object/Ean8.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ protected function _prepareBarcode()

// First part
for ($i = 0; $i < 4; $i++) {
$bars = str_split($this->_codingMap['A'][$textTable[$i]]);
$bars = str_split((string) $this->_codingMap['A'][$textTable[$i]]);
foreach ($bars as $b) {
$barcodeTable[] = array($b , $this->_barThinWidth , 0 , 1);
}
Expand All @@ -98,7 +98,7 @@ protected function _prepareBarcode()

// Second part
for ($i = 4; $i < 8; $i++) {
$bars = str_split($this->_codingMap['C'][$textTable[$i]]);
$bars = str_split((string) $this->_codingMap['C'][$textTable[$i]]);
foreach ($bars as $b) {
$barcodeTable[] = array($b , $this->_barThinWidth , 0 , 1);
}
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Barcode/Object/Postnet.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ protected function _prepareBarcode()
// Text to encode
$textTable = str_split($this->getText());
foreach ($textTable as $char) {
$bars = str_split($this->_codingMap[$char]);
$bars = str_split((string) $this->_codingMap[$char]);
foreach ($bars as $b) {
$barcodeTable[] = array(1 , $this->_barThinWidth , 0.5 - $b * 0.5 , 1);
$barcodeTable[] = array(0 , $this->_barThinWidth , 0 , 1);
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Barcode/Object/Royalmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ protected function _prepareBarcode()
// Text to encode
$textTable = str_split($this->getText());
foreach ($textTable as $char) {
$bars = str_split($this->_codingMap[$char]);
$bars = str_split((string) $this->_codingMap[$char]);
foreach ($bars as $b) {
$barcodeTable[] = array(1 , $this->_barThinWidth , ($b > 1 ? 3/8 : 0) , ($b % 2 ? 5/8 : 1));
$barcodeTable[] = array(0 , $this->_barThinWidth , 0 , 1);
Expand Down
8 changes: 4 additions & 4 deletions library/Zend/Barcode/Object/Upca.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ protected function _prepareBarcode()
$textTable = str_split($this->getText());

// First character
$bars = str_split($this->_codingMap['A'][$textTable[0]]);
$bars = str_split((string) $this->_codingMap['A'][$textTable[0]]);
foreach ($bars as $b) {
$barcodeTable[] = array($b , $this->_barThinWidth , 0 , $height);
}

// First part
for ($i = 1; $i < 6; $i++) {
$bars = str_split($this->_codingMap['A'][$textTable[$i]]);
$bars = str_split((string) $this->_codingMap['A'][$textTable[$i]]);
foreach ($bars as $b) {
$barcodeTable[] = array($b , $this->_barThinWidth , 0 , 1);
}
Expand All @@ -105,14 +105,14 @@ protected function _prepareBarcode()

// Second part
for ($i = 6; $i < 11; $i++) {
$bars = str_split($this->_codingMap['C'][$textTable[$i]]);
$bars = str_split((string) $this->_codingMap['C'][$textTable[$i]]);
foreach ($bars as $b) {
$barcodeTable[] = array($b , $this->_barThinWidth , 0 , 1);
}
}

// Last character
$bars = str_split($this->_codingMap['C'][$textTable[11]]);
$bars = str_split((string) $this->_codingMap['C'][$textTable[11]]);
foreach ($bars as $b) {
$barcodeTable[] = array($b , $this->_barThinWidth , 0 , $height);
}
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Barcode/Object/Upce.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ protected function _prepareBarcode()
$parity = $this->_parities[$system][$checksum];

for ($i = 1; $i < 7; $i++) {
$bars = str_split($this->_codingMap[$parity[$i - 1]][$textTable[$i]]);
$bars = str_split((string) $this->_codingMap[$parity[$i - 1]][$textTable[$i]]);
foreach ($bars as $b) {
$barcodeTable[] = array($b , $this->_barThinWidth , 0 , 1);
}
Expand Down
4 changes: 2 additions & 2 deletions library/Zend/Cache/Backend/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public function __construct(array $options = array())
}
if (isset($options['hashed_directory_perm']) && is_string($options['hashed_directory_perm'])) {
// See #ZF-4422
$this->_options['hashed_directory_perm'] = octdec($this->_options['hashed_directory_perm']);
$this->_options['hashed_directory_perm'] = octdec((string) $this->_options['hashed_directory_perm']);
}

if (isset($options['cache_file_umask'])) {
Expand All @@ -159,7 +159,7 @@ public function __construct(array $options = array())
}
if (isset($options['cache_file_perm']) && is_string($options['cache_file_perm'])) {
// See #ZF-4422
$this->_options['cache_file_perm'] = octdec($this->_options['cache_file_perm']);
$this->_options['cache_file_perm'] = octdec((string) $this->_options['cache_file_perm']);
}
}

Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Cache/Backend/Libmemcached.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function __construct(array $options = array())
if (is_int($name)) {
$optId = $name;
} else {
$optConst = 'Memcached::OPT_' . strtoupper($name);
$optConst = 'Memcached::OPT_' . strtoupper((string) $name);
if (defined($optConst)) {
$optId = constant($optConst);
} else {
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Cache/Backend/Sqlite.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ public function getIdsMatchingAnyTags($tags = array())
*/
public function getFillingPercentage()
{
$dir = dirname($this->_options['cache_db_complete_path']);
$dir = dirname((string) $this->_options['cache_db_complete_path']);
$free = disk_free_space($dir);
$total = disk_total_space($dir);
if ($total == 0) {
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Cache/Backend/Static.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public function save($data, $id, $tags = array(), $specificLifetime = false)
$extension = null;
if ($this->_isSerialized($data)) {
$data = unserialize($data);
$extension = '.' . ltrim($data[1], '.');
$extension = '.' . ltrim((string) $data[1], '.');
$data = $data[0];
}

Expand Down
16 changes: 8 additions & 8 deletions library/Zend/Cache/Core.php
Original file line number Diff line number Diff line change
Expand Up @@ -489,8 +489,8 @@ public function getIdsMatchingTags($tags = array())
$prefix = & $this->_options['cache_id_prefix'];
$prefixLen = strlen((string) $prefix);
foreach ($ids as &$id) {
if (strpos($id, $prefix) === 0) {
$id = substr($id, $prefixLen);
if (strpos((string) $id, (string) $prefix) === 0) {
$id = substr((string) $id, $prefixLen);
}
}
}
Expand Down Expand Up @@ -522,8 +522,8 @@ public function getIdsNotMatchingTags($tags = array())
$prefix = & $this->_options['cache_id_prefix'];
$prefixLen = strlen((string) $prefix);
foreach ($ids as &$id) {
if (strpos($id, $prefix) === 0) {
$id = substr($id, $prefixLen);
if (strpos((string) $id, (string) $prefix) === 0) {
$id = substr((string) $id, $prefixLen);
}
}
}
Expand Down Expand Up @@ -555,8 +555,8 @@ public function getIdsMatchingAnyTags($tags = array())
$prefix = & $this->_options['cache_id_prefix'];
$prefixLen = strlen((string) $prefix);
foreach ($ids as &$id) {
if (strpos($id, $prefix) === 0) {
$id = substr($id, $prefixLen);
if (strpos((string) $id, (string) $prefix) === 0) {
$id = substr((string) $id, $prefixLen);
}
}
}
Expand All @@ -582,8 +582,8 @@ public function getIds()
$prefix = & $this->_options['cache_id_prefix'];
$prefixLen = strlen((string) $prefix);
foreach ($ids as &$id) {
if (strpos($id, $prefix) === 0) {
$id = substr($id, $prefixLen);
if (strpos((string) $id, (string) $prefix) === 0) {
$id = substr((string) $id, $prefixLen);
}
}
}
Expand Down
Loading

0 comments on commit 2e88a79

Please sign in to comment.