Skip to content

Commit

Permalink
Merge pull request #88 from Dealerdirect/feature/update-phpcs-ruleset
Browse files Browse the repository at this point in the history
CS: fix compliance with PSR12
  • Loading branch information
mjrider committed Dec 14, 2019
2 parents 6fa8d1e + b905338 commit 6f35da5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
6 changes: 5 additions & 1 deletion phpcs.xml.dist
Expand Up @@ -15,5 +15,9 @@
<rule ref="PHPCompatibility"/>
<config name="testVersion" value="5.3-"/>

<rule ref="PSR12"/>
<rule ref="PSR12">
<!-- Constant visibility can not be declared (yet) as the minimum supported PHP version is 5.3
and constant visibility was only introduced in PHP 7.1. -->
<exclude name="PSR12.Properties.ConstantVisibility.NotFound"/>
</rule>
</ruleset>
9 changes: 6 additions & 3 deletions src/Plugin.php
Expand Up @@ -269,7 +269,8 @@ private function cleanInstalledPaths()
// This might be a relative path as well
$alternativePath = realpath($this->getPHPCodeSnifferInstallPath() . DIRECTORY_SEPARATOR . $path);

if ((is_dir($path) === false || is_readable($path) === false) &&
if (
(is_dir($path) === false || is_readable($path) === false) &&
(is_dir($alternativePath) === false || is_readable($alternativePath) === false)
) {
unset($this->installedPaths[$key]);
Expand Down Expand Up @@ -362,7 +363,8 @@ function (PackageInterface $package) {
}
);

if (! $this->composer->getPackage() instanceof RootpackageInterface
if (
! $this->composer->getPackage() instanceof RootpackageInterface
&& $this->composer->getPackage()->getType() === self::PACKAGE_TYPE
) {
$codingStandardPackages[] = $this->composer->getPackage();
Expand Down Expand Up @@ -441,7 +443,8 @@ private function getMaxDepth()
$maxDepth = $extra[self::KEY_MAX_DEPTH];
$minDepth = $this->getMinDepth();

if ((string) (int) $maxDepth !== (string) $maxDepth /* Must be an integer or cleanly castable to one */
if (
(string) (int) $maxDepth !== (string) $maxDepth /* Must be an integer or cleanly castable to one */
|| $maxDepth <= $minDepth /* Larger than the minimum */
|| is_float($maxDepth) === true /* Within the boundaries of integer */
) {
Expand Down

0 comments on commit 6f35da5

Please sign in to comment.