Skip to content

Commit

Permalink
fix: Use correct var names, fix docblock/types
Browse files Browse the repository at this point in the history
  • Loading branch information
zooley committed Aug 9, 2023
1 parent 4269c6e commit debae40
Show file tree
Hide file tree
Showing 43 changed files with 359 additions and 304 deletions.
2 changes: 1 addition & 1 deletion app/Modules/Groups/Mail/OwnerAuthorized.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function envelope(): Envelope
/**
* Build the message.
*
* @return $this
* @return self
*/
public function build()
{
Expand Down
6 changes: 3 additions & 3 deletions app/Modules/Groups/Mail/OwnerAuthorizedManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class OwnerAuthorizedManager extends Mailable
/**
* List of people authorized
*
* @var array
* @var array<int,\App\Modules\Groups\Models\Member>
*/
protected $people;

Expand All @@ -47,7 +47,7 @@ class OwnerAuthorizedManager extends Mailable
*
* @param User $user
* @param Group $group
* @param array $people
* @param array<int,\App\Modules\Groups\Models\Member> $people
* @return void
*/
public function __construct(User $user, Group $group, $people = array())
Expand Down Expand Up @@ -96,7 +96,7 @@ public function envelope(): Envelope
/**
* Build the message.
*
* @return $this
* @return self
*/
public function build()
{
Expand Down
2 changes: 1 addition & 1 deletion app/Modules/Groups/Mail/OwnerRemoved.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function envelope(): Envelope
/**
* Build the message.
*
* @return $this
* @return self
*/
public function build()
{
Expand Down
6 changes: 3 additions & 3 deletions app/Modules/Groups/Mail/OwnerRemovedManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class OwnerRemovedManager extends Mailable
/**
* List of people authorized
*
* @var array
* @var array<int,\App\Modules\Groups\Models\Member>
*/
protected $people;

Expand All @@ -47,7 +47,7 @@ class OwnerRemovedManager extends Mailable
*
* @param User $user
* @param Group $group
* @param array $people
* @param array<int,\App\Modules\Groups\Models\Member> $people
* @return void
*/
public function __construct(User $user, Group $group, $people = array())
Expand Down Expand Up @@ -96,7 +96,7 @@ public function envelope(): Envelope
/**
* Build the message.
*
* @return $this
* @return self
*/
public function build()
{
Expand Down
1 change: 1 addition & 0 deletions app/Modules/Groups/Models/FieldOfScience.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Facades\DB;
use App\Modules\History\Traits\Historable;

Expand Down
1 change: 1 addition & 0 deletions app/Modules/Groups/Models/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Collection;
Expand Down
9 changes: 7 additions & 2 deletions app/Modules/Groups/Models/UnixGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public function generateShortname(string $name): string
}
}

return 'rcs' . str_pad($this->groupid, 4, '0', STR_PAD_LEFT) . $lastchar;
return 'rcs' . str_pad("{$this->groupid}", 4, '0', STR_PAD_LEFT) . $lastchar;
}

/**
Expand Down Expand Up @@ -288,7 +288,12 @@ public function removeMember(int $userid): bool
}
}*/

return $member->delete();
if (!$member->delete())
{
return false;
}

return true;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/Modules/Groups/Providers/GroupsServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public function registerViews(): void
$this->loadViewsFrom(array_merge(array_map(function ($path)
{
return $path . '/modules/' . $this->name;
}, config('view.paths')), [$sourcePath]), $this->name);
}, config('view.paths', [])), [$sourcePath]), $this->name);

/*View::composer(
'users::site.profile', ProfileComposer::class
Expand Down
14 changes: 7 additions & 7 deletions app/Modules/History/Helpers/Diff.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ class Diff
/**
* Description for 'edits'
*
* @var array
* @var array<int,\App\Modules\History\Helpers\Diff\Operation>
*/
public $edits;

/**
* Constructor.
* Computes diff between sequences of strings.
*
* @param array $from_lines An array of strings. (Typically these are lines from a file.)
* @param array $to_lines An array of strings.
* @param array<int,string> $from_lines An array of strings. (Typically these are lines from a file.)
* @param array<int,string> $to_lines An array of strings.
* @return void
*/
public function __construct($from_lines, $to_lines)
Expand Down Expand Up @@ -110,7 +110,7 @@ public function lcs()
*
* This reconstructs the $from_lines parameter passed to the constructor.
*
* @return array The original sequence of strings.
* @return array<int,string> The original sequence of strings.
*/
public function orig()
{
Expand All @@ -131,7 +131,7 @@ public function orig()
*
* This reconstructs the $to_lines parameter passed to the constructor.
*
* @return array The sequence of strings.
* @return array<int,string> The sequence of strings.
*/
public function closing()
{
Expand All @@ -152,8 +152,8 @@ public function closing()
*
* This is here only for debugging purposes.
*
* @param unknown $from_lines
* @param unknown $to_lines
* @param array<int,string> $from_lines
* @param array<int,string> $to_lines
* @return void
*/
public function _check($from_lines, $to_lines)
Expand Down
115 changes: 78 additions & 37 deletions app/Modules/History/Helpers/Diff/Engine.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,63 @@
class Engine
{
/**
* Description for 'AX_XREF_LENGTH'
* @var int
*/
const MAX_XREF_LENGTH = 10000;

/**
* @var array
*/
public $xchanged = array();

/**
* @var array
*/
public $ychanged = array();

/**
* @var array
*/
public $xv = array();

/**
* @var array
*/
public $yv = array();

/**
* @var array
*/
public $xind = array();

/**
* @var array
*/
public $yind = array();

/**
* @var array|int
*/
public $seq = 0;

/**
* @var array
*/
public $in_seq = array();

/**
* @var int
*/
public $lcs;

/**
* Short description for 'diff'
*
* Long description (if any) ...
*
* @param array $from_lines Parameter description (if any) ...
* @param array $to_lines Parameter description (if any) ...
* @return array Return description (if any) ...
* @param array<int,string> $from_lines
* @param array<int,string> $to_lines
* @return array<int,Operation>
*/
public function diff($from_lines, $to_lines)
{
Expand Down Expand Up @@ -178,33 +223,29 @@ public function _line_hash($line)
return $line;
}

// Divide the Largest Common Subsequence (LCS) of the sequences
// [XOFF, XLIM) and [YOFF, YLIM) into NCHUNKS approximately equally
// sized segments.
//
// Returns (LCS, PTS). LCS is the length of the LCS. PTS is an
// array of NCHUNKS+1 (X, Y) indexes giving the diving points between
// sub sequences. The first sub-sequence is contained in [X0, X1),
// [Y0, Y1), the second in [X1, X2), [Y1, Y2) and so on. Note
// that (X0, Y0) == (XOFF, YOFF) and
// (X[NCHUNKS], Y[NCHUNKS]) == (XLIM, YLIM).
//
// This function assumes that the first lines of the specified portions
// of the two files do not match, and likewise that the last lines do not
// match. The caller must trim matching lines from the beginning and end
// of the portions it is going to specify.

/**
* Short description for '_diag'
* Divide the Largest Common Subsequence (LCS) of the sequences
* [XOFF, XLIM) and [YOFF, YLIM) into NCHUNKS approximately equally
* sized segments.
*
* Long description (if any) ...
* Returns (LCS, PTS). LCS is the length of the LCS. PTS is an
* array of NCHUNKS+1 (X, Y) indexes giving the diving points between
* sub sequences. The first sub-sequence is contained in [X0, X1),
* [Y0, Y1), the second in [X1, X2), [Y1, Y2) and so on. Note
* that (X0, Y0) == (XOFF, YOFF) and
* (X[NCHUNKS], Y[NCHUNKS]) == (XLIM, YLIM).
*
* This function assumes that the first lines of the specified portions
* of the two files do not match, and likewise that the last lines do not
* match. The caller must trim matching lines from the beginning and end
* of the portions it is going to specify.
*
* @param number $xoff Parameter description (if any) ...
* @param number $xlim Parameter description (if any) ...
* @param number $yoff Parameter description (if any) ...
* @param number $ylim Parameter description (if any) ...
* @param number $nchunks Parameter description (if any) ...
* @return mixed Return description (if any) ...
* @param int $xoff
* @param int $xlim
* @param int $yoff
* @param int $ylim
* @param int $nchunks
* @return array<int,mixed>
*/
public function _diag($xoff, $xlim, $yoff, $ylim, $nchunks)
{
Expand Down Expand Up @@ -312,8 +353,8 @@ public function _diag($xoff, $xlim, $yoff, $ylim, $nchunks)
*
* Long description (if any) ...
*
* @param unknown $ypos Parameter description (if any) ...
* @return integer Return description (if any) ...
* @param int $ypos
* @return int
*/
public function _lcs_pos($ypos)
{
Expand Down Expand Up @@ -360,10 +401,10 @@ public function _lcs_pos($ypos)
* Note that XLIM, YLIM are exclusive bounds.
* All line numbers are origin-0 and discarded lines are not counted.
*
* @param number $xoff Parameter description (if any) ...
* @param number $xlim Parameter description (if any) ...
* @param number $yoff Parameter description (if any) ...
* @param number $ylim Parameter description (if any) ...
* @param int $xoff
* @param int $xlim
* @param int $yoff
* @param int $ylim
* @return void
*/
public function _compareseq($xoff, $xlim, $yoff, $ylim)
Expand Down Expand Up @@ -434,9 +475,9 @@ public function _compareseq($xoff, $xlim, $yoff, $ylim)
*
* This is extracted verbatim from analyze.c (GNU diffutils-2.7).
*
* @param array $lines Parameter description (if any) ...
* @param array &$changed Parameter description (if any) ...
* @param array $other_changed Parameter description (if any) ...
* @param array<int,string> $lines
* @param array<int,string> &$changed
* @param array<int,string> $other_changed
* @return void
*/
public function _shift_boundaries($lines, &$changed, $other_changed)
Expand Down
Loading

0 comments on commit debae40

Please sign in to comment.