Showing 229 of 251 total issues

Function field has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function field(string $fieldName, array $options = []): self
    {
        $type = $options['type'] ?? 'string';
        unset($options['type']);
        if ($type === 'time' && $this->getDatabasePlatform() instanceof OraclePlatform) {
Severity: Minor
Found in src/Schema/Migrator.php - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function createFakeForeignModel has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected function createFakeForeignModel(): Model
    {
        $fakeModel = new Model($this->getOwner()->getPersistence(), [
            'table' => $this->foreignTable,
            'idField' => $this->foreignIdField,
Severity: Minor
Found in src/Model/Join.php - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function set has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function set(string $field, $value)
    {
        $this->getModel()->assertOnlyField($field);

        $f = $this->getField($field);
Severity: Minor
Found in src/Model.php - About 45 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method _renderConditionBinaryReuse has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        string $sqlLeft,
        string $sqlRight,
        \Closure $makeSqlFx,
        bool $allowReuseLeft = true,
        bool $allowReuseRight = true,
Severity: Minor
Found in src/Persistence/Sql/Sqlite/Query.php - About 45 mins to fix

Method _renderConditionBinaryReuse has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        string $sqlLeft,
        string $sqlRight,
        \Closure $makeSqlFx,
        bool $allowReuseLeft = true,
        bool $allowReuseRight = true,
Severity: Minor
Found in src/Persistence/Sql/Query.php - About 45 mins to fix

Function __construct has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct(array $conditions = [], string $junction = self::AND)
    {
        if (!in_array($junction, [self::OR, self::AND], true)) {
            throw (new Exception('Unsupported compound condition junction'))
                ->addMoreInfo('junction', $junction);
Severity: Minor
Found in src/Model/Scope.php - About 45 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function typecastSaveField has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function typecastSaveField(Field $field, $value)
    {
        // SQL Expression cannot be converted
        if ($value instanceof Persistence\Sql\Expressionable) {
            return $value;
Severity: Minor
Found in src/Persistence.php - About 45 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method _copy has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    protected function _copy(Model $source, Model $destination, array $references, array $exclusions, array $transforms): Model
Severity: Minor
Found in src/Util/DeepCopy.php - About 35 mins to fix

Method where has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function where($field, $operator = null, $value = null, $kind = 'where', $numArgs = null)
Severity: Minor
Found in src/Persistence/Sql/Query.php - About 35 mins to fix

Method onHookToTheirModel has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    protected function onHookToTheirModel(Model $theirModel, string $spot, \Closure $fx, array $args = [], int $priority = 5): int
Severity: Minor
Found in src/Reference.php - About 35 mins to fix

Function consume has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function consume($expr, string $escapeMode): string
    {
        if (!is_object($expr)) {
            switch ($escapeMode) {
                case self::ESCAPE_PARAM:
Severity: Minor
Found in src/Persistence/Sql/Expression.php - About 35 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function normalize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    #[\Override]
    public function normalize($value)
    {
        $value = parent::normalize($value);
        if ($value === null) {
Severity: Minor
Found in src/Field/EmailField.php - About 35 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function setLimitOrder has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function setLimitOrder(Model $model, Query $query): void
    {
        if ($model->isEntity()) { // TODO pass model only
            $model = $model->getModel();
        }
Severity: Minor
Found in src/Persistence/Sql.php - About 35 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function _insert has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function _insert(array $row): void
    {
        // find any row values that do not correspond to fields, they may correspond to references instead
        $refs = [];
        foreach ($row as $key => $value) {
Severity: Minor
Found in src/Model.php - About 35 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function _renderConditionLikeOperator has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    #[\Override]
    protected function _renderConditionLikeOperator(bool $negated, string $sqlLeft, string $sqlRight): string
    {
        $isMysql5x = !Connection::isServerMariaDb($this->connection)
            && Connection::getServerMinorVersion($this->connection) < 600;
Severity: Minor
Found in src/Persistence/Sql/Mysql/Query.php - About 35 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function createIndex has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function createIndex(array $fields, bool $isUnique): void
    {
        $fields = array_map(fn ($field) => $this->resolvePersistenceField($field), $fields);
        $table = reset($fields)->getOwner()->table;

Severity: Minor
Found in src/Schema/Migrator.php - About 35 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function stripDatabaseFromTableName has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function stripDatabaseFromTableName(string $tableName): string
    {
        $platform = $this->getDatabasePlatform();
        $lastDotPos = strrpos($tableName, '.');
        if ($lastDotPos !== false) {
Severity: Minor
Found in src/Schema/Migrator.php - About 35 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Avoid too many return statements within this method.
Open

                    return self::castFloatToString($v);
Severity: Major
Found in src/Persistence/Sql/Expression.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

                    return '1 = 1'; // always true
Severity: Major
Found in src/Persistence/Sql/Query.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

            return $this->_renderConditionRegexpOperator($operator === 'not regexp', $field, $value);
Severity: Major
Found in src/Persistence/Sql/Query.php - About 30 mins to fix
Severity
Category
Status
Source
Language