1
0
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:
chylex 2020-08-07 10:16:25 +02:00
parent fd923d9b57
commit 5746cf7541
23 changed files with 29 additions and 33 deletions

View File

@ -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{

View File

@ -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);

View File

@ -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);

View File

@ -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);
}

View File

@ -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
}

View File

@ -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);
}

View File

@ -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;

View File

@ -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){

View File

@ -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;

View File

@ -31,7 +31,7 @@ HTML;
return self::LAYOUT_FULL;
}
protected final function echoPageHead(){
protected final function echoPageHead(): void{
FormComponent::echoHead();
SidemenuComponent::echoHead();
ProgressBarComponent::echoHead();

View File

@ -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();

View File

@ -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>

View File

@ -23,7 +23,7 @@ class LoginPage extends AbstractPage{
return self::LAYOUT_COMPACT;
}
protected function echoPageHead(){
protected function echoPageHead(): void{
FormComponent::echoHead();
}

View File

@ -23,7 +23,7 @@ class RegisterPage extends AbstractPage{
return self::LAYOUT_COMPACT;
}
protected function echoPageHead(){
protected function echoPageHead(): void{
FormComponent::echoHead();
}

View File

@ -23,7 +23,7 @@ class SettingsPage extends AbstractPage{
return self::LAYOUT_CONDENSED;
}
protected function echoPageHead(){
protected function echoPageHead(): void{
FormComponent::echoHead();
}

View File

@ -28,7 +28,7 @@ class TrackersPage extends AbstractPage{
return self::LAYOUT_FULL;
}
protected function echoPageHead(){
protected function echoPageHead(): void{
TableComponent::echoHead();
FormComponent::echoHead();
}

View File

@ -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();

View File

@ -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();

View File

@ -24,7 +24,7 @@ class MembersPage extends AbstractTrackerPage{
return self::LAYOUT_FULL;
}
protected function echoPageHead(){
protected function echoPageHead(): void{
TableComponent::echoHead();
FormComponent::echoHead();
}

View File

@ -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();

View File

@ -23,7 +23,7 @@ class SettingsPage extends AbstractTrackerPage{
return self::LAYOUT_COMPACT;
}
protected function echoPageHead(){
protected function echoPageHead(): void{
FormComponent::echoHead();
}

View File

@ -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[]
*/

View File

@ -27,7 +27,7 @@ final class Validator{
/**
* @throws ValidationException
*/
public function validate(){
public function validate(): void{
$errors = [];
foreach($this->validators as $validator){