src/bin/schemaFromObject.php
Missing class import via use statement (line '275', column '19'). Open
Open
$nugget = new \Activerules\Nugget\Nugget();
- 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
Missing class import via use statement (line '38', column '18'). Open
Open
$files = new \DirectoryIterator($objectDir);
- 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
Missing class import via use statement (line '36', column '19'). Open
Open
$nugget = new \Activerules\Nugget\Nugget();
- 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
Missing class import via use statement (line '194', column '19'). Open
Open
$nugget = new \Activerules\Nugget\Nugget();
- 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
Define a constant instead of duplicating this literal ".json" 4 times. Open
Open
$objFile = realpath($schemaDir . '/' . $refSchemaName . '.json');
- Read upRead up
- Exclude checks
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.
Argument 3 (defs)
is string
but \resolvePropertyReference()
takes array
defined at /code/src/bin/schemaFromObject.php:309
Open
Open
resolvePropertyReference($prop, $def, $defs);
- Exclude checks
Argument 1 (schema)
is false|string
but \populateRef()
takes object
defined at /code/src/bin/schemaFromObject.php:68
Open
Open
populateRef($name, $defs);
- Exclude checks
Reference to undeclared property \Activerules\Nugget\Nugget->schemaBuilder
Open
Open
$nugget->schemaBuilder->mergeRequired($parentDef, $schemaDef);
- Exclude checks
Argument 1 (refString)
is object
but \loadRef()
takes string
defined at /code/src/bin/schemaFromObject.php:358
Open
Open
loadRef($def, $defs);
- Exclude checks
Reference to undeclared property \Activerules\Nugget\Nugget->schemaBuilder
Open
Open
$nugget->schemaBuilder->mergeProps($parentDef, $schemaDef);
- Exclude checks
Argument 2 (ref)
is array
but \populateRef()
takes string
defined at /code/src/bin/schemaFromObject.php:68
Open
Open
populateRef($name, $defs);
- Exclude checks
Reference to undeclared property \Activerules\Nugget\Nugget->schemaBuilder
Open
Open
$props[$property] = $nugget->schemaBuilder->loadPropertyFile($propertyFile);
- Exclude checks
A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 34 and the first side effect is on line 2. Open
Open
<?php
- Exclude checks
PHP keywords must be lowercase; expected "and" but found "AND" Open
Open
if (isset($parentDef->extends) AND is_string($parentDef->extends)) {
- Exclude checks
PHP keywords must be lowercase; expected "and" but found "AND" Open
Open
if (isset($schemaDef->extends) AND is_string($schemaDef->extends)) {
- Exclude checks
Whitespace found at end of line Open
Open
*
- Exclude checks
Whitespace found at end of line Open
Open
*
- Exclude checks