mirror of
https://github.com/chylex/Lightning-Tracker.git
synced 2025-03-14 12:15:42 +01:00
Fix formatting & missing return type hints
This commit is contained in:
parent
fd923d9b57
commit
5746cf7541
src
Database
Logging
Pages
Components
Models/Tracker
Views
Validation
@ -16,7 +16,7 @@ final class MilestoneTable extends AbstractTrackerTable{
|
||||
parent::__construct($db, $tracker);
|
||||
}
|
||||
|
||||
public function addMilestone(string $title){
|
||||
public function addMilestone(string $title): void{
|
||||
$this->db->beginTransaction();
|
||||
|
||||
try{
|
||||
@ -43,7 +43,7 @@ final class MilestoneTable extends AbstractTrackerTable{
|
||||
}
|
||||
}
|
||||
|
||||
public function moveMilestoneUp(int $id){
|
||||
public function moveMilestoneUp(int $id): void{
|
||||
$this->db->beginTransaction();
|
||||
|
||||
try{
|
||||
@ -61,7 +61,7 @@ final class MilestoneTable extends AbstractTrackerTable{
|
||||
}
|
||||
}
|
||||
|
||||
public function moveMilestoneDown(int $id){
|
||||
public function moveMilestoneDown(int $id): void{
|
||||
$this->db->beginTransaction();
|
||||
|
||||
try{
|
||||
@ -90,7 +90,7 @@ final class MilestoneTable extends AbstractTrackerTable{
|
||||
}
|
||||
}
|
||||
|
||||
private function swapMilestonesInternal(int $id, int $current_ordering, int $other_ordering){
|
||||
private function swapMilestonesInternal(int $id, int $current_ordering, int $other_ordering): void{
|
||||
$stmt = $this->db->prepare('UPDATE milestones SET ordering = ? WHERE ordering = ? AND tracker_id = ?');
|
||||
$stmt->bindValue(1, $current_ordering, PDO::PARAM_INT);
|
||||
$stmt->bindValue(2, $other_ordering, PDO::PARAM_INT);
|
||||
@ -166,7 +166,7 @@ SQL;
|
||||
return $results;
|
||||
}
|
||||
|
||||
public function deleteById(int $id){
|
||||
public function deleteById(int $id): void{
|
||||
$this->db->beginTransaction();
|
||||
|
||||
try{
|
||||
|
@ -86,7 +86,7 @@ SQL;
|
||||
return (bool)$this->fetchOneColumn($stmt);
|
||||
}
|
||||
|
||||
public function removeUserId(int $user_id){
|
||||
public function removeUserId(int $user_id): void{
|
||||
$stmt = $this->db->prepare('DELETE FROM tracker_members WHERE user_id = ? AND tracker_id = ?');
|
||||
$stmt->bindValue(1, $user_id, PDO::PARAM_INT);
|
||||
$stmt->bindValue(2, $this->getTrackerId(), PDO::PARAM_INT);
|
||||
|
@ -61,7 +61,7 @@ final class TrackerTable extends AbstractTable{
|
||||
}
|
||||
}
|
||||
|
||||
public function changeSettings(int $id, string $name, bool $hidden){
|
||||
public function changeSettings(int $id, string $name, bool $hidden): void{
|
||||
$stmt = $this->db->prepare('UPDATE trackers SET name = ?, hidden = ? WHERE id = ?');
|
||||
$stmt->bindValue(1, $name);
|
||||
$stmt->bindValue(2, $hidden, PDO::PARAM_BOOL);
|
||||
|
@ -10,7 +10,7 @@ function protect(string $text): string{
|
||||
return htmlspecialchars($text, ENT_HTML5 | ENT_QUOTES | ENT_SUBSTITUTE);
|
||||
}
|
||||
|
||||
function bind(PDOStatement $stmt, string $param, $value, int $type = PDO::PARAM_STR){
|
||||
function bind(PDOStatement $stmt, string $param, $value, int $type = PDO::PARAM_STR): void{
|
||||
if (strpos($stmt->queryString, ':'.$param) !== false){
|
||||
$stmt->bindValue($param, $value, $type);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ namespace Logging;
|
||||
use Exception;
|
||||
|
||||
final class Log{
|
||||
public static function critical(Exception $e){
|
||||
public static function critical(Exception $e): void{
|
||||
error_log($e->getMessage());
|
||||
// TODO
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ HTML;
|
||||
*
|
||||
* @param array $data
|
||||
*/
|
||||
public function fill(array $data){
|
||||
public function fill(array $data): void{
|
||||
$this->is_filled = true;
|
||||
|
||||
foreach($this->fields as $name => $field){
|
||||
@ -210,7 +210,7 @@ HTML;
|
||||
return new ReloadFormAction($data);
|
||||
}
|
||||
|
||||
public function invalidateField(string $name, string $message){
|
||||
public function invalidateField(string $name, string $message): void{
|
||||
$this->fields[$name]->addError($message);
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ namespace Pages\Components;
|
||||
use Pages\IViewable;
|
||||
|
||||
final class ProgressBarComponent implements IViewable{
|
||||
public static function echoHead(){
|
||||
public static function echoHead(): void{
|
||||
echo <<<HTML
|
||||
<link rel="stylesheet" type="text/css" href="~resources/css/progressbar.css">
|
||||
HTML;
|
||||
|
@ -30,7 +30,7 @@ class IssueEditModel extends BasicTrackerPageModel{
|
||||
* @param FormSelect $select
|
||||
* @param AbstractIssueTag[] $items
|
||||
*/
|
||||
private static function setupIssueTagOptions(FormSelect $select, array $items){
|
||||
private static function setupIssueTagOptions(FormSelect $select, array $items): void{
|
||||
foreach($items as $item){
|
||||
$select->addOption($item->getId(), $item->getTitle(), 'issue-tag issue-'.$item->getKind().'-'.$item->getId());
|
||||
}
|
||||
@ -39,8 +39,8 @@ class IssueEditModel extends BasicTrackerPageModel{
|
||||
private Permissions $perms;
|
||||
private FormComponent $form;
|
||||
|
||||
private ?IssueDetail $issue = null;
|
||||
private ?int $issue_id;
|
||||
private ?IssueDetail $issue;
|
||||
|
||||
/** @noinspection HtmlMissingClosingTag */
|
||||
public function __construct(Request $req, TrackerInfo $tracker, Permissions $perms, ?int $issue_id){
|
||||
|
@ -26,7 +26,7 @@ abstract class AbstractPage implements IViewable{
|
||||
protected abstract function getHeading(): string;
|
||||
protected abstract function getLayout(): string;
|
||||
|
||||
protected function echoPageHead(){
|
||||
protected function echoPageHead(): void{
|
||||
}
|
||||
|
||||
protected abstract function echoPageBody(): void;
|
||||
|
@ -31,7 +31,7 @@ HTML;
|
||||
return self::LAYOUT_FULL;
|
||||
}
|
||||
|
||||
protected final function echoPageHead(){
|
||||
protected final function echoPageHead(): void{
|
||||
FormComponent::echoHead();
|
||||
SidemenuComponent::echoHead();
|
||||
ProgressBarComponent::echoHead();
|
||||
|
@ -28,7 +28,7 @@ class AccountPage extends AbstractPage{
|
||||
return self::LAYOUT_CONDENSED;
|
||||
}
|
||||
|
||||
protected function echoPageHead(){
|
||||
protected function echoPageHead(): void{
|
||||
SidemenuComponent::echoHead();
|
||||
FormComponent::echoHead();
|
||||
}
|
||||
@ -57,7 +57,7 @@ HTML;
|
||||
HTML;
|
||||
}
|
||||
|
||||
protected function echoAccountPageColumn(){
|
||||
protected function echoAccountPageColumn(): void{
|
||||
$logon_user = $this->model->getLogonUser();
|
||||
|
||||
$form = new FormComponent();
|
||||
|
@ -17,7 +17,7 @@ class AccountSecurityPage extends AccountPage{
|
||||
return parent::getTitle().' - Security';
|
||||
}
|
||||
|
||||
protected function echoAccountPageColumn(){
|
||||
protected function echoAccountPageColumn(): void{
|
||||
echo <<<HTML
|
||||
<h3>Change Password</h3>
|
||||
<article>
|
||||
|
@ -23,7 +23,7 @@ class LoginPage extends AbstractPage{
|
||||
return self::LAYOUT_COMPACT;
|
||||
}
|
||||
|
||||
protected function echoPageHead(){
|
||||
protected function echoPageHead(): void{
|
||||
FormComponent::echoHead();
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ class RegisterPage extends AbstractPage{
|
||||
return self::LAYOUT_COMPACT;
|
||||
}
|
||||
|
||||
protected function echoPageHead(){
|
||||
protected function echoPageHead(): void{
|
||||
FormComponent::echoHead();
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ class SettingsPage extends AbstractPage{
|
||||
return self::LAYOUT_CONDENSED;
|
||||
}
|
||||
|
||||
protected function echoPageHead(){
|
||||
protected function echoPageHead(): void{
|
||||
FormComponent::echoHead();
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ class TrackersPage extends AbstractPage{
|
||||
return self::LAYOUT_FULL;
|
||||
}
|
||||
|
||||
protected function echoPageHead(){
|
||||
protected function echoPageHead(): void{
|
||||
TableComponent::echoHead();
|
||||
FormComponent::echoHead();
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ class UsersPage extends AbstractPage{
|
||||
return self::LAYOUT_FULL;
|
||||
}
|
||||
|
||||
protected function echoPageHead(){
|
||||
protected function echoPageHead(): void{
|
||||
TableComponent::echoHead();
|
||||
FormComponent::echoHead();
|
||||
DateTimeComponent::echoHead();
|
||||
|
@ -26,7 +26,7 @@ class IssuesPage extends AbstractTrackerPage{
|
||||
return self::LAYOUT_FULL;
|
||||
}
|
||||
|
||||
protected function echoPageHead(){
|
||||
protected function echoPageHead(): void{
|
||||
TableComponent::echoHead();
|
||||
FormComponent::echoHead();
|
||||
SidemenuComponent::echoHead();
|
||||
|
@ -24,7 +24,7 @@ class MembersPage extends AbstractTrackerPage{
|
||||
return self::LAYOUT_FULL;
|
||||
}
|
||||
|
||||
protected function echoPageHead(){
|
||||
protected function echoPageHead(): void{
|
||||
TableComponent::echoHead();
|
||||
FormComponent::echoHead();
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ class MilestonesPage extends AbstractTrackerPage{
|
||||
return self::LAYOUT_FULL;
|
||||
}
|
||||
|
||||
protected function echoPageHead(){
|
||||
protected function echoPageHead(): void{
|
||||
TableComponent::echoHead();
|
||||
FormComponent::echoHead();
|
||||
ProgressBarComponent::echoHead();
|
||||
|
@ -23,7 +23,7 @@ class SettingsPage extends AbstractTrackerPage{
|
||||
return self::LAYOUT_COMPACT;
|
||||
}
|
||||
|
||||
protected function echoPageHead(){
|
||||
protected function echoPageHead(): void{
|
||||
FormComponent::echoHead();
|
||||
}
|
||||
|
||||
|
@ -7,10 +7,6 @@ use Exception;
|
||||
use Throwable;
|
||||
|
||||
final class ValidationException extends Exception{
|
||||
public static function forField(string $field, string $message): ValidationException{
|
||||
return new ValidationException([new InvalidField($field, $message)]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @var InvalidField[]
|
||||
*/
|
||||
|
@ -27,7 +27,7 @@ final class Validator{
|
||||
/**
|
||||
* @throws ValidationException
|
||||
*/
|
||||
public function validate(){
|
||||
public function validate(): void{
|
||||
$errors = [];
|
||||
|
||||
foreach($this->validators as $validator){
|
||||
|
Loading…
Reference in New Issue
Block a user