Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CS: fix compliance with PSR12 #88

Merged
merged 1 commit into from
Dec 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion phpcs.xml.dist
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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