It seems like the GitHub access token used for retrieving details about this repository from
GitHub became invalid. This might prevent certain types of inspections from being run (in
particular,
everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Using logical operators such as and instead of && is generally not recommended.
PHP has two types of connecting operators (logical operators, and boolean operators):
Logical Operators
Boolean Operator
AND - meaning
and
&&
OR - meaning
or
||
The difference between these is the order in which they are executed. In most cases,
you would want to use a boolean operator like &&, or ||.
Let’s take a look at a few examples:
// Logical operators have lower precedence:$f=falseortrue;// is executed like this:($f=false)ortrue;// Boolean operators have higher precedence:$f=false||true;// is executed like this:$f=(false||true);
Logical Operators are used for Control-Flow
One case where you explicitly want to use logical operators is for control-flow
such as this:
$x===5ordie('$x must be 5.');// Instead ofif($x!==5){die('$x must be 5.');}
Since die introduces problems of its own, f.e. it makes our code hardly
testable, and prevents any kind of more sophisticated error handling; you probably
do not want to use this in real-world code. Unfortunately, logical operators
cannot be combined with throw at this point:
// The following is currently a parse error.$x===5orthrownewRuntimeException('$x must be 5.');
These limitations lead to logical operators rarely being of use in current
PHP code.
The trait Idable provides a method equalsId that in turn relies on the
method getId(). If this method does not exist on a class mixing in this
trait, the method will fail.
Adding the getId() as an abstract method to the trait will make sure it
is available.
Accessing id on the interface Illuminate\Contracts\Auth\Authenticatable suggest that you code against a concrete implementation. How about adding an instanceof check?
If you access a property on an interface, you most likely code against a
concrete implementation of the interface.
75% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have
checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that
someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.
Loading history...
31
}
32
33
public function deleteAttachment(Attachment $attachment)
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: