Avoid assigning values to variables in if clauses and the like (line '153', column '17'). Open
public function getAssetBase64Encoded(string $path): string
{
try {
if ($fullPath = $this->getFileLocation($path)) {
$detector = new ExtensionMimeTypeDetector();
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid assigning values to variables in if clauses and the like (line '134', column '17'). Open
public function getAssetContents(string $path): string
{
try {
if ($fullPath = $this->getFileLocation($path)) {
$stream = $this->filesystem->readStream($fullPath);
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Missing function doc comment Open
public function __construct(
- Exclude checks
Variable "lp_theme_css" is not in valid camel caps format Open
global $lp_theme_css;
- Exclude checks
Missing function doc comment Open
public function getAssetBase64Encoded(string $path): string
- Exclude checks
Missing class doc comment Open
final class ThemeHelper
- Exclude checks
Variable "lp_theme_css" is not in valid camel caps format Open
$visualTheme = $lp_theme_css;
- Exclude checks
Missing function doc comment Open
public function getAssetContents(string $path): string
- Exclude checks
Add a single space around assignment operators Open
declare(strict_types=1);
- Exclude checks
Perl-style comments are not allowed. Use "// Comment." or "/* comment */" instead. Open
#[Autowire(service: 'oneup_flysystem.themes_filesystem')]
- Exclude checks
Closing brace must be on a line by itself Open
) {}
- Exclude checks
Missing function doc comment Open
public function getThemeAssetUrl(string $path, bool $absoluteUrl = false): string
- Exclude checks
Missing function doc comment Open
public function getThemeAssetLinkTag(string $path, bool $absoluteUrl = false): string
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
private readonly UserHelper $userHelper,
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
private readonly RouterInterface $router,
- Exclude checks
Closing brace must be on a line by itself Open
) {}
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
private readonly CidReqHelper $cidReqHelper,
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
private readonly AccessUrlHelper $accessUrlHelper,
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
private readonly SettingsCourseManager $settingsCourseManager,
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
private readonly SettingsManager $settingsManager,
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
private readonly FilesystemOperator $filesystem,
- Exclude checks
The variable $lp_theme_css is not named in camelCase. Open
public function getVisualTheme(): string
{
static $visualTheme;
global $lp_theme_css;
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $lp_theme_css is not named in camelCase. Open
public function getVisualTheme(): string
{
static $visualTheme;
global $lp_theme_css;
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}