1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-22 13:32:56 +02:00

Add to phpcs ruleset

This commit is contained in:
Oliver Vogel
2025-03-31 15:32:07 +02:00
parent b63b0f26b2
commit 774fd9dfbd
5 changed files with 48 additions and 24 deletions

View File

@@ -17,6 +17,8 @@
<rule ref="Generic.Metrics.NestingLevel"/>
<rule ref="SlevomatCodingStandard.Arrays.SingleLineArrayWhitespace"/>
<rule ref="SlevomatCodingStandard.Arrays.DisallowImplicitArrayCreation"/>
<rule ref="SlevomatCodingStandard.Arrays.DisallowPartiallyKeyed"/>
<rule ref="SlevomatCodingStandard.Arrays.MultiLineArrayEndBracketPlacement"/>
<rule ref="SlevomatCodingStandard.Classes.ClassConstantVisibility"/>
<rule ref="SlevomatCodingStandard.Classes.ClassMemberSpacing"/>
<rule ref="SlevomatCodingStandard.Classes.ConstantSpacing"/>
@@ -26,6 +28,26 @@
<rule ref="SlevomatCodingStandard.Classes.PropertyDeclaration"/>
<rule ref="SlevomatCodingStandard.Classes.RequireSelfReference"/>
<rule ref="SlevomatCodingStandard.Classes.TraitUseDeclaration"/>
<rule ref="SlevomatCodingStandard.Classes.ClassStructure">
<properties>
<property name="methodGroups" type="array">
<element key="phpunit" value="setUp"/>
</property>
<property name="groups" type="array">
<element value="uses"/>
<element value="enum cases"/>
<element value="public constants"/>
<element value="constants"/>
<element value="public static properties, protected static properties, private static properties"/>
<element value="public properties, protected properties, private properties"/>
<element value="constructor"/>
<element value="phpunit"/>
<element value="static constructors"/>
<element value="methods"/>
<element value="magic methods"/>
</property>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
<properties>
<property name="rootNamespaces" type="array">

View File

@@ -26,13 +26,6 @@ interface ColorInterface
*/
public function colorspace(): ColorspaceInterface;
/**
* Cast color object to string
*
* @return string
*/
public function __toString(): string;
/**
* Cast color object to string
*
@@ -104,4 +97,11 @@ interface ColorInterface
* @return bool
*/
public function isClear(): bool;
/**
* Cast color object to string
*
* @return string
*/
public function __toString(): string;
}

View File

@@ -23,13 +23,6 @@ interface DrawableFactoryInterface
*/
public function create(): DrawableInterface;
/**
* Create the end product by invoking the factory
*
* @return DrawableInterface
*/
public function __invoke(): DrawableInterface;
/**
* Define the background color of the drawable object
*
@@ -46,4 +39,11 @@ interface DrawableFactoryInterface
* @return DrawableFactoryInterface
*/
public function border(mixed $color, int $size = 1): self;
/**
* Create the end product by invoking the factory
*
* @return DrawableInterface
*/
public function __invoke(): DrawableInterface;
}

View File

@@ -28,16 +28,6 @@ class FontFactory
}
}
/**
* Build font
*
* @return FontInterface
*/
public function __invoke(): FontInterface
{
return $this->font;
}
/**
* Set the filename of the font to be built
*
@@ -167,4 +157,14 @@ class FontFactory
return $this;
}
/**
* Build font
*
* @return FontInterface
*/
public function __invoke(): FontInterface
{
return $this->font;
}
}

View File

@@ -97,6 +97,7 @@ final class CollectionTest extends BaseTestCase
public function testGet(): void
{
// phpcs:ignore SlevomatCodingStandard.Arrays.DisallowPartiallyKeyed
$collection = new Collection([
'first',
'second',
@@ -129,6 +130,7 @@ final class CollectionTest extends BaseTestCase
public function testGetAtPosition(): void
{
// phpcs:ignore SlevomatCodingStandard.Arrays.DisallowPartiallyKeyed
$collection = new Collection([1, 2, 'foo' => 'bar']);
$this->assertEquals(1, $collection->getAtPosition(0));
$this->assertEquals(2, $collection->getAtPosition(1));