PHP Linting Tweaks

PHP syntax checking was being weird so I spent some time to make some
corrections. The problem was I was just using the wrong protocal, PEAR
when I've been coding to the PSR12 standard. Easy fix.
This commit is contained in:
Ro 2022-10-10 11:49:04 -07:00
parent 77eb8dd1a8
commit 7890715ea6
No known key found for this signature in database
GPG key ID: FF5888875DC19043
3 changed files with 28 additions and 16 deletions

View file

@ -1,6 +1,8 @@
<?php
return (new PhpCsFixer\Config())
$config = new PhpCsFixer\Config();
return $config
->setRiskyAllowed(true)
->setRules([
'@PSR12' => true,
'array_indentation' => true,
@ -20,7 +22,7 @@ return (new PhpCsFixer\Config())
'multiline_whitespace_before_semicolons' => [
'strategy' => 'no_multi_line',
],
'single_quote' => true,
'single_quote' => false,
'binary_operator_spaces' => [
'default' => 'single_space',
@ -50,7 +52,6 @@ return (new PhpCsFixer\Config())
'extra',
'parenthesis_brace_block',
'throw',
]
],
'no_multiline_whitespace_around_double_arrow' => true,
@ -68,5 +69,6 @@ return (new PhpCsFixer\Config())
'ordered_imports' => [
'sort_algorithm' => 'none',
],
//Other rules here...
])
->setLineEnding("\n");

View file

@ -3,7 +3,6 @@
namespace brain\utility;
use Carbon\Carbon;
use brain\data\Settings;
class Maintenance
{

View file

@ -2,12 +2,13 @@
namespace brain\utility;
use function _\filter;
use function _\find;
use brain\data\Book;
use brain\data\Settings;
use Mni\FrontYAML\Parser;
use function _\filter;
use function _\find;
class Sorting
{
private static $p_tags = [];
@ -16,6 +17,7 @@ class Sorting
public function __construct()
{
}
public static function tags()
{
$pages = (new Book('../content/pages'))->getContents();
@ -36,6 +38,7 @@ class Sorting
return self::$p_tags;
}
private static function tagPages($tag, $pages)
{
$tagged = [];
@ -52,6 +55,7 @@ class Sorting
return $tagged;
}
public static function archive()
{
$pages = (new Book('../content/pages'))->getContents();
@ -64,10 +68,13 @@ class Sorting
if (!find($years, ['year' => trim($date[0])])) {
$findPages = filter($pages, ['createdYear' => trim($date[0])]);
// var_dump($findPages);
array_push($years, [
'year' => trim($date[0]),
'count' => count($findPages),
]);
array_push(
$years,
[
'year' => trim($date[0]),
'count' => count($findPages),
]
);
}
}
foreach ($years as $year) {
@ -77,12 +84,15 @@ class Sorting
foreach ($filtered as $obj) {
$month = date('m', date($obj['rawCreated']));
if (!find($sorted, ['month' => $month])) {
$perMonth = filter($pages, [
'path' => $year['year'] . '/' . $month,
'deleted' => false,
'published' => true,
'layout' => 'page',
]);
$perMonth = filter(
$pages,
[
'path' => $year['year'] . '/' . $month,
'deleted' => false,
'published' => true,
'layout' => 'page',
]
);
array_push($sorted, [
'month' => $month,
'full_month' => date('F', date($obj['rawCreated'])),
@ -99,6 +109,7 @@ class Sorting
return self::$p_archive;
}
public static function page($page)
{
$config = new Settings();