Skip to content

Commit

Permalink
fix tests + fix property filter
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Mar 10, 2017
1 parent 09d6d64 commit 2b9449f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
10 changes: 9 additions & 1 deletion src/ObjectCalisthenics/Helper/PropertyFilter.php
Expand Up @@ -2,6 +2,8 @@

namespace ObjectCalisthenics\Helper;

use Nette\Utils\Strings;

final class PropertyFilter
{
/**
Expand All @@ -14,7 +16,13 @@ final class PropertyFilter
public static function filterOutScalarProperties(array $propertyList): array
{
return array_filter($propertyList, function ($property) {
return !in_array($property['type'], self::$scalarPropertyTypes, true);
foreach (self::$scalarPropertyTypes as $scalarPropertyType) {
if (Strings::startsWith($property['type'], $scalarPropertyType)) {
return false;
}
}

return true;
});
}
}
Expand Up @@ -38,7 +38,7 @@ final class OneObjectOperatorPerLineSniff implements Sniff
private $callerTokens;

/**
* mixed[]
* mixed[].
*/
private $tokens;

Expand All @@ -50,7 +50,7 @@ final class OneObjectOperatorPerLineSniff implements Sniff
/**
* @return int[]
*/
public function register() : array
public function register(): array
{
return [T_VARIABLE];
}
Expand Down
2 changes: 1 addition & 1 deletion src/ObjectCalisthenics/ruleset.xml
Expand Up @@ -71,7 +71,7 @@
<rule ref="ObjectCalisthenics.Classes.ForbiddenPublicProperty">
<properties>
<property name="filesToBeSkipped" type="array"
value="ForbiddenPublicPropertySniff.php,ClassElementLengthSniff.php,FunctionNameLengthSniff.php,AbstractDataStructureLengthSniff.php,MaxNestingLevelSniff.php,FunctionLengthSniff.php,ConstantNameLengthSniff.php,ClassNameLengthSniff.php,VariableNameLengthSniff.php,MethodPerClassLimitSniff.php,PropertyPerClassLimitSniff.php,InstancePropertyPerClassLimitSniff.php"
value="ForbiddenPublicPropertySniff.php,ClassElementLengthSniff.php,FunctionNameLengthSniff.php,AbstractDataStructureLengthSniff.php,MaxNestingLevelSniff.php,FunctionLengthSniff.php,ConstantNameLengthSniff.php,ClassNameLengthSniff.php,VariableNameLengthSniff.php,MethodPerClassLimitSniff.php,PropertyPerClassLimitSniff.php,InstancePropertyPerClassLimitSniff.php,OneObjectOperatorPerLineSniff.php"
/>
</properties>
</rule>
Expand Down
Expand Up @@ -129,7 +129,17 @@ trait TestTrait
trait OkTestTrait
{
/**
* @var array
* @var string[]
*/
protected $array1;

/**
* @var string[]
*/
protected $array2;

/**
* @var string[]
*/
protected $array3;
}

0 comments on commit 2b9449f

Please sign in to comment.