takeawaytown/laravel-uuid

View on GitHub

Showing 109 of 109 total issues

Argument 2 (raw_output) is 1 but \md5() takes bool
Open

                $uuid = md5($namespace . $node, 1);
Severity: Minor
Found in src/Classes/Uuid.php by phan

Returning type int but __get() is declared to return \TakeawayTown\LaravelUuid\Classes\number|null|string
Open

                    return (int) 1;
Severity: Minor
Found in src/Classes/Uuid.php by phan

Returning type int but __get() is declared to return \TakeawayTown\LaravelUuid\Classes\number|null|string
Open

                    return (int) 3;
Severity: Minor
Found in src/Classes/Uuid.php by phan

Saw possibly unextractable annotation for a fragment of comment '* @param string uuid of the model.': after string, did not see an element name (will guess based on comment order)
Open

   * @param  string  uuid of the model.
Severity: Info
Found in src/Traits/Uuid.php by phan

Static call to undeclared method \TakeawayTown\LaravelUuid\Classes\Uuid,1::creating
Open

    static::creating(function ($model) {
Severity: Critical
Found in src/Traits/Uuid.php by phan

Call to undeclared function \config()
Open

        $model->{config('uuid.uuid_column')} = $uuid;
Severity: Critical
Found in src/Traits/Uuid.php by phan

Call to method __construct from undeclared class \TakeawayTown\LaravelUuid\Classes\InvalidArgumentException (Did you mean class \InvalidArgumentException)
Open

            throw new InvalidArgumentException('Input must be a 128-bit integer.');
Severity: Critical
Found in src/Classes/Uuid.php by phan

Define a constant instead of duplicating this literal "uuid.uuid_column" 6 times.
Open

      if (!$model->{config('uuid.uuid_column')}) {
Severity: Critical
Found in src/Traits/Uuid.php by sonar-php

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Call to undeclared function \config()
Open

    $results = $query->where(config('uuid.uuid_column'), $uuid);
Severity: Critical
Found in src/Traits/Uuid.php by phan
Severity
Category
Status
Source
Language