[web-php] master: Enhancement: Enable `new_with_braces` fixer (#697)

From: Date: Tue, 29 Aug 2023 10:35:08 +0000
Subject: [web-php] master: Enhancement: Enable `new_with_braces` fixer (#697)
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-30993@lists.php.net to get a copy of this message
Author: Andreas Möller (localheinz) Committer: GitHub (web-flow) Pusher: kamil-tekiela Date: 2023-08-29T11:21:41+01:00 Commit: https://github.com/php/web-php/commit/73a9969168046405005b2f30cf55f24c786ba1c1 Raw diff: https://github.com/php/web-php/commit/73a9969168046405005b2f30cf55f24c786ba1c1.diff Enhancement: Enable new_with_braces fixer (#697) Changed paths: M .php-cs-fixer.php M images/supported-versions.php M include/branches.inc M include/shared-manual.inc Diff: diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 1a33af693..40d084767 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -33,6 +33,7 @@ ], 'indentation_type' => true, 'line_ending' => true, + 'new_with_braces' => true, 'no_extra_blank_lines' => true, 'no_trailing_whitespace' => true, 'ordered_class_elements' => true, diff --git a/images/supported-versions.php b/images/supported-versions.php index 772a8cc09..e63537264 100644 --- a/images/supported-versions.php +++ b/images/supported-versions.php @@ -154,7 +154,7 @@ function date_horiz_coord(DateTime $date) { <!-- Today --> <g class="today"> <?php - $now = new DateTime; + $now = new DateTime(); $x = date_horiz_coord($now); ?> <line x1="<?php echo $x ?>" y1="<?php echo $header_height ?>" x2="<?php echo $x ?>" y2="<?php echo $header_height + (count($branches) * $branch_height) ?>" /> diff --git a/include/branches.inc b/include/branches.inc index 23ffd6601..5a2ac26d2 100644 --- a/include/branches.inc +++ b/include/branches.inc @@ -130,7 +130,7 @@ function get_all_branches() { function get_active_branches($include_recent_eols = true) { $branches = []; - $now = new DateTime; + $now = new DateTime(); foreach ($GLOBALS['RELEASES'] as $major => $releases) { foreach ($releases as $version => $release) { @@ -164,7 +164,7 @@ function get_active_branches($include_recent_eols = true) { function get_eol_branches($always_include = null) { $always_include = $always_include ?: []; $branches = []; - $now = new DateTime; + $now = new DateTime(); // Gather the last release on each branch into a convenient array. foreach ($GLOBALS['OLDRELEASES'] as $major => $releases) { @@ -325,7 +325,7 @@ function get_branch_support_state($branch) { $security = get_branch_security_eol_date($branch); if ($initial && $bug && $security) { - $now = new DateTime; + $now = new DateTime(); if ($now >= $security) { return 'eol'; diff --git a/include/shared-manual.inc b/include/shared-manual.inc index 8e457b764..f17379bb3 100644 --- a/include/shared-manual.inc +++ b/include/shared-manual.inc @@ -41,7 +41,7 @@ function manual_notes($notes):void { $filename = substr($filename, 0, -4); } - $sorter = new Sorter; + $sorter = new Sorter(); $sorter->sort($notes); // Link target to add a note to the current manual page, @@ -394,7 +394,7 @@ function manual_footer() { // This function takes a DateTime object and returns a formated string of the time difference relative to now function relTime(DateTime $date) { - $current = new DateTime; + $current = new DateTime(); $diff = $current->diff($date); $units = ["year" => $diff->format("%y"), "month" => $diff->format("%m"),

« previous php.webmaster (#30993) next »