Explicitly set blank_line_before_statement to exclude include* and require*

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2022-08-07 20:55:02 +02:00
parent da8b3ce479
commit 97a76669a2
18 changed files with 14 additions and 45 deletions
+1 -1
View File
@@ -20,9 +20,9 @@ $finder = PhpCsFixer\Finder::create()
$config = new PhpCsFixer\Config();
$config
->setRules(array(
'@PSR12' => true,
'@PhpCsFixer' => true,
'array_syntax' => array('syntax' => 'long'),
'blank_line_before_statement' => array('statements' => array('break', 'case', 'continue', 'declare', 'default', 'exit', 'goto', 'phpdoc', 'return', 'switch', 'throw', 'try', 'yield', 'yield_from')),
))
->setFinder($finder)
;
-7
View File
@@ -8,13 +8,9 @@
*/
$api = true;
require_once 'scripts/pi-hole/php/FTL.php';
require_once 'scripts/pi-hole/php/password.php';
require_once 'scripts/pi-hole/php/database.php';
require_once 'scripts/pi-hole/php/auth.php';
check_cors();
@@ -117,18 +113,15 @@ if (isset($_GET['enable']) && $auth) {
// Set POST parameters and invoke script to add domain to list
$_POST['domain'] = $_GET['add'];
$_POST['action'] = 'add_domain';
require 'scripts/pi-hole/php/groups.php';
} elseif (isset($_GET['sub'])) {
// Set POST parameters and invoke script to remove domain from list
$_POST['domain'] = $_GET['sub'];
$_POST['action'] = 'delete_domain_string';
require 'scripts/pi-hole/php/groups.php';
} else {
// Set POST parameters and invoke script to get all domains
$_POST['action'] = 'get_domains';
require 'scripts/pi-hole/php/groups.php';
}
-4
View File
@@ -9,13 +9,9 @@
$api = true;
header('Content-type: application/json');
require 'scripts/pi-hole/php/database.php';
require 'scripts/pi-hole/php/password.php';
require 'scripts/pi-hole/php/auth.php';
require_once 'scripts/pi-hole/php/func.php';
check_cors();
-2
View File
@@ -8,9 +8,7 @@
*/
$indexpage = true;
require 'scripts/pi-hole/php/header.php';
require_once 'scripts/pi-hole/php/gravity.php';
?>
<!-- Sourceing CSS colors from stylesheet to be used in JS code -->
-2
View File
@@ -1,6 +1,5 @@
<?php
require 'auth.php';
require 'password.php';
check_cors();
?>
@@ -34,7 +33,6 @@ body {
if ($auth) {
if (strlen($pwhash) > 0) {
echo '<div class="qrcode">';
require_once '../../vendor/qrcode.php';
$qr = QRCode::getMinimumQRCode($pwhash, QR_ERROR_CORRECT_LEVEL_Q);
// The size of each block (in pixels) should be an integer
-1
View File
@@ -1,7 +1,6 @@
<?php
require_once 'func.php';
require_once 'auth.php';
// Authentication checks
-1
View File
@@ -1,7 +1,6 @@
<?php
require_once 'func.php';
require_once 'auth.php';
// Authentication checks
-5
View File
@@ -41,7 +41,6 @@ function SQLite3_connect_try($filename, $mode, $trytoreconnect)
return SQLite3_connect_try($filename, $mode, false);
}
// If we should not try again (or are already trying again!), we return the exception string
// so the user gets it on the dashboard
return $filename.': '.$exception->getMessage();
@@ -154,7 +153,6 @@ function add_to_table($db, $table, $domains, $comment = null, $wildcardstyle = f
if ($returnnum) {
return $num;
}
if (1 === $num) {
$plural = '';
} else {
@@ -172,7 +170,6 @@ function add_to_table($db, $table, $domains, $comment = null, $wildcardstyle = f
if ($returnnum) {
return $num;
}
$finalcount = intval($db->querySingle($countquery));
$modified = $finalcount - $initialcount;
@@ -256,7 +253,6 @@ function remove_from_table($db, $table, $domains, $returnnum = false, $type = -1
if ($returnnum) {
return $num;
}
if (1 === $num) {
$plural = '';
} else {
@@ -274,7 +270,6 @@ function remove_from_table($db, $table, $domains, $returnnum = false, $type = -1
if ($returnnum) {
return $num;
}
if (1 === $num) {
$plural = '';
} else {
-1
View File
@@ -7,7 +7,6 @@ header('Content-Type: text/event-stream');
header('Cache-Control: no-cache');
require 'password.php';
require 'auth.php';
if (!$auth) {
-1
View File
@@ -108,7 +108,6 @@ function checkfile($filename)
if (is_readable($filename)) {
return $filename;
}
// substitute dummy file
return '/dev/null';
}
-1
View File
@@ -18,7 +18,6 @@ function gravity_last_update($raw = false)
// Array output
return array('file_exists' => false);
}
// String output
return 'Gravity database not available';
}
-2
View File
@@ -8,9 +8,7 @@
*/
require_once 'auth.php';
require_once 'func.php';
require_once 'database.php';
// Authentication checks
-4
View File
@@ -8,13 +8,9 @@
*/
require 'scripts/pi-hole/php/auth.php';
require 'scripts/pi-hole/php/password.php';
require_once 'scripts/pi-hole/php/FTL.php';
require_once 'scripts/pi-hole/php/func.php';
require 'scripts/pi-hole/php/theme.php';
$scriptname = basename($_SERVER['SCRIPT_FILENAME']);
$hostname = gethostname() ? gethostname() : '';
-2
View File
@@ -8,9 +8,7 @@
*/
require_once 'auth.php';
require_once 'func.php';
require_once 'database.php';
// Authentication checks
-2
View File
@@ -8,9 +8,7 @@
*/
require_once 'auth.php';
require_once 'func.php';
require_once 'database.php';
// Authentication checks
+2 -1
View File
@@ -63,7 +63,8 @@ function readStaticLeasesFile($origin_file = '/etc/dnsmasq.d/04-pihole-static-dh
} elseif (0 == strlen($two)) {
// dhcp-host=mac,hostname - no IP
array_push($dhcp_static_leases, array('hwaddr' => $mac, 'IP' => '', 'host' => $one));
} else { // dhcp-host=mac,IP,hostname
} else {
// dhcp-host=mac,IP,hostname
array_push($dhcp_static_leases, array('hwaddr' => $mac, 'IP' => $one, 'host' => $two));
}
} elseif (validIP($one) && validDomain($mac)) {
-3
View File
@@ -8,11 +8,8 @@
*/
require 'password.php';
require 'auth.php'; // Also imports func.php
require 'database.php';
require 'savesettings.php';
if ('cli' !== php_sapi_name()) {
+11 -5
View File
@@ -9,9 +9,7 @@
*/
require 'scripts/pi-hole/php/header.php';
require 'scripts/pi-hole/php/savesettings.php';
require_once 'scripts/pi-hole/php/FTL.php';
// Reread ini file as things might have been changed
@@ -544,8 +542,16 @@ if (0 !== $FTLpid) {
</div>
<div class="row">
<div class="col-md-12">
<div><input type="checkbox" name="DHCP_rapid_commit" id="DHCP_rapid_commit" class="DHCPgroup" <?php if ($DHCP_rapid_commit) { ?>checked<?php } if (!$DHCP) { ?> disabled<?php } ?>>&nbsp;<label for="DHCP_rapid_commit"><strong>Enable DHCPv4 rapid commit (fast address assignment)</strong></label></div>
<div><input type="checkbox" name="useIPv6" id="useIPv6" class="DHCPgroup" <?php if ($DHCPIPv6) { ?>checked<?php } if (!$DHCP) { ?> disabled<?php } ?>>&nbsp;<label for="useIPv6"><strong>Enable IPv6 support (SLAAC + RA)</strong></label></div>
<div><input type="checkbox" name="DHCP_rapid_commit" id="DHCP_rapid_commit" class="DHCPgroup"
<?php
if ($DHCP_rapid_commit) { ?>checked<?php }
if (!$DHCP) { ?> disabled<?php } ?>
>&nbsp;<label for="DHCP_rapid_commit"><strong>Enable DHCPv4 rapid commit (fast address assignment)</strong></label></div>
<div><input type="checkbox" name="useIPv6" id="useIPv6" class="DHCPgroup"
<?php
if ($DHCPIPv6) { ?>checked<?php }
if (!$DHCP) { ?> disabled<?php } ?>
>&nbsp;<label for="useIPv6"><strong>Enable IPv6 support (SLAAC + RA)</strong></label></div>
</div>
</div>
</div>
@@ -556,7 +562,7 @@ if (0 !== $FTLpid) {
<!-- DHCP Leases Box -->
<div class="row">
<?php
$dhcp_leases = array();
$dhcp_leases = array();
if ($DHCP) {
// Read leases file
$leasesfile = true;