Commit 465348f9 authored by xjm's avatar xjm

Issue #2759789 by mfernea, Mile23, andriyun, dawehner, klausi: Fix...

Issue #2759789 by mfernea, Mile23, andriyun, dawehner, klausi: Fix 'Drupal.Semantics.FunctionAlias' coding standard
parent 2242f4ad
......@@ -104,7 +104,7 @@ public function close() {
* If writing the data is not possible.
*/
private function write($data) {
$result = fputs($this->_fd, $data);
$result = fwrite($this->_fd, $data);
if ($result === FALSE) {
throw new Exception('Unable to write data: ' . substr($data, 0, 20));
}
......
......@@ -328,7 +328,7 @@ public static function mergeDeepArray(array $arrays, $preserve_integer_keys = FA
// Renumber integer keys as array_merge_recursive() does unless
// $preserve_integer_keys is set to TRUE. Note that PHP automatically
// converts array keys that are integer strings (e.g., '1') to integers.
if (is_integer($key) && !$preserve_integer_keys) {
if (is_int($key) && !$preserve_integer_keys) {
$result[] = $value;
}
// Recurse when both values are arrays.
......
......@@ -75,7 +75,7 @@ public function mail(array $message) {
$mail_body = preg_replace('@\r?\n@', $line_endings, $message['body']);
// For headers, PHP's API suggests that we use CRLF normally,
// but some MTAs incorrectly replace LF with CRLF. See #234403.
$mail_headers = join("\n", $mimeheaders);
$mail_headers = implode("\n", $mimeheaders);
$request = \Drupal::request();
......
......@@ -117,7 +117,7 @@ public function _testColor($theme, $test_values) {
$stylesheets = $this->config('color.theme.' . $theme)->get('stylesheets');
foreach ($stylesheets as $stylesheet) {
$this->assertPattern('|' . file_url_transform_relative(file_create_url($stylesheet)) . '|', 'Make sure the color stylesheet is included in the content. (' . $theme . ')');
$stylesheet_content = join("\n", file($stylesheet));
$stylesheet_content = implode("\n", file($stylesheet));
$this->assertTrue(strpos($stylesheet_content, 'color: #123456') !== FALSE, 'Make sure the color we changed is in the color stylesheet. (' . $theme . ')');
}
......@@ -129,7 +129,7 @@ public function _testColor($theme, $test_values) {
$this->drupalGet('<front>');
$stylesheets = $this->config('color.theme.' . $theme)->get('stylesheets');
foreach ($stylesheets as $stylesheet) {
$stylesheet_content = join("\n", file($stylesheet));
$stylesheet_content = implode("\n", file($stylesheet));
$this->assertTrue(strpos($stylesheet_content, 'color: ' . $test_values['scheme_color']) !== FALSE, 'Make sure the color we changed is in the color stylesheet. (' . $theme . ')');
}
......@@ -141,7 +141,7 @@ public function _testColor($theme, $test_values) {
$stylesheets = \Drupal::state()->get('drupal_css_cache_files') ?: [];
$stylesheet_content = '';
foreach ($stylesheets as $uri) {
$stylesheet_content .= join("\n", file(drupal_realpath($uri)));
$stylesheet_content .= implode("\n", file(drupal_realpath($uri)));
}
$this->assertTrue(strpos($stylesheet_content, 'public://') === FALSE, 'Make sure the color paths have been translated to local paths. (' . $theme . ')');
$config->set('css.preprocess', 0);
......
......@@ -130,7 +130,7 @@ public function testBlockDisplay() {
$this->assertIdenticalResultset($view, $expected_result, $map);
// Check the number of results given by the display is the expected.
$this->assertEqual(sizeof($view->result), $this->blockDisplayResults,
$this->assertEqual(count($view->result), $this->blockDisplayResults,
format_string('There are exactly @results comments. Expected @expected',
['@results' => count($view->result), '@expected' => $this->blockDisplayResults]
)
......
......@@ -135,7 +135,7 @@ public static function generateSampleValue(FieldDefinitionInterface $field_defin
$values['title'] = mt_rand(0, 1) ? $random->sentences(4) : '';
break;
}
$values['uri'] = 'http://www.' . $random->word($domain_length) . '.' . $tlds[mt_rand(0, (sizeof($tlds) - 1))];
$values['uri'] = 'http://www.' . $random->word($domain_length) . '.' . $tlds[mt_rand(0, (count($tlds) - 1))];
}
else {
$values['uri'] = 'base:' . $random->name(mt_rand(1, 64));
......
......@@ -363,7 +363,7 @@ function simpletest_phpunit_run_command(array $unescaped_test_classnames, $phpun
// exec in a subshell so that the environment is isolated when running tests
// via the simpletest UI.
$ret = exec(join($command, " "), $output, $status);
$ret = exec(implode(" ", $command), $output, $status);
chdir($old_cwd);
putenv('SIMPLETEST_DB=');
......
......@@ -897,7 +897,7 @@ function system_requirements($phase) {
$requirements['trusted_host_patterns'] = [
'title' => t('Trusted Host Settings'),
'value' => t('Enabled'),
'description' => t('The trusted_host_patterns setting is set to allow %trusted_host_patterns', ['%trusted_host_patterns' => join(', ', $trusted_host_patterns)]),
'description' => t('The trusted_host_patterns setting is set to allow %trusted_host_patterns', ['%trusted_host_patterns' => implode(', ', $trusted_host_patterns)]),
];
}
}
......
......@@ -1383,7 +1383,7 @@ function system_time_zones($blank = NULL, $grouped = FALSE) {
$city = array_pop($split);
$region = array_shift($split);
if (!empty($region)) {
$grouped_zones[$region][$key] = empty($split) ? $city : $city . ' (' . join('/', $split) . ')';
$grouped_zones[$region][$key] = empty($split) ? $city : $city . ' (' . implode('/', $split) . ')';
}
else {
$grouped_zones[$key] = $value;
......
......@@ -88,6 +88,7 @@
</rule>
<rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Scope/MethodScopeSniff.php"/>
<rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/EmptyInstallSniff.php"/>
<rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/FunctionAliasSniff.php"/>
<rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/FunctionTSniff.php">
<exclude name="Drupal.Semantics.FunctionT.NotLiteralString"/>
<exclude name="Drupal.Semantics.FunctionT.ConcatString"/>
......
......@@ -39,7 +39,7 @@ public function testGarbageCollection() {
for ($i = 0; $i <= 3; $i++) {
$store->setWithExpire('key_' . $i, $this->randomObject(), rand(500, 100000));
}
$this->assertIdentical(sizeof($store->getAll()), 4, 'Four items were written to the storage.');
$this->assertIdentical(count($store->getAll()), 4, 'Four items were written to the storage.');
// Manually expire the data.
for ($i = 0; $i <= 3; $i++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment