Missing class import via use statement (line '53', column '23'). Open
throw new \Exception('Configuration can only be either PHP or YAML based, not both.');
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Avoid assigning values to variables in if clauses and the like (line '34', column '13'). Open
public function register()
{
$container = $this->getContainer();
/** @var Tapestry $tapestry */
- 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 '38', column '13'). Open
public function register()
{
$container = $this->getContainer();
/** @var Tapestry $tapestry */
- 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 using static access to class '\Symfony\Component\Yaml\Yaml' in method 'getConfigurationFromPath'. Open
return Yaml::parse(file_get_contents($path));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Line exceeds 120 characters; contains 132 characters Open
if ($envConfigPathName = $this->identifyConfigurationPath($tapestry['currentWorkingDirectory'], $tapestry['environment'])) {
- Exclude checks
The variable $YAMLPath is not named in camelCase. Open
private function identifyConfigurationPath($configPath, $env = null)
{
$basePath = $configPath.DIRECTORY_SEPARATOR.'config'.(is_null($env) ? '' : ('-'.$env));
$PHPPath = $basePath.'.php';
$YAMLPath = $basePath.'.yaml';
- 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 $YAMLPath is not named in camelCase. Open
private function identifyConfigurationPath($configPath, $env = null)
{
$basePath = $configPath.DIRECTORY_SEPARATOR.'config'.(is_null($env) ? '' : ('-'.$env));
$PHPPath = $basePath.'.php';
$YAMLPath = $basePath.'.yaml';
- 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 $YAMLPath is not named in camelCase. Open
private function identifyConfigurationPath($configPath, $env = null)
{
$basePath = $configPath.DIRECTORY_SEPARATOR.'config'.(is_null($env) ? '' : ('-'.$env));
$PHPPath = $basePath.'.php';
$YAMLPath = $basePath.'.yaml';
- 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 $PHPPath is not named in camelCase. Open
private function identifyConfigurationPath($configPath, $env = null)
{
$basePath = $configPath.DIRECTORY_SEPARATOR.'config'.(is_null($env) ? '' : ('-'.$env));
$PHPPath = $basePath.'.php';
$YAMLPath = $basePath.'.yaml';
- 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 $PHPPath is not named in camelCase. Open
private function identifyConfigurationPath($configPath, $env = null)
{
$basePath = $configPath.DIRECTORY_SEPARATOR.'config'.(is_null($env) ? '' : ('-'.$env));
$PHPPath = $basePath.'.php';
$YAMLPath = $basePath.'.yaml';
- 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 $PHPPath is not named in camelCase. Open
private function identifyConfigurationPath($configPath, $env = null)
{
$basePath = $configPath.DIRECTORY_SEPARATOR.'config'.(is_null($env) ? '' : ('-'.$env));
$PHPPath = $basePath.'.php';
$YAMLPath = $basePath.'.yaml';
- 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();
}
}