Skip to content

Commit 58b60f9

Browse files
committed
Added lowercase PHPCS rules.
1 parent 558bcb7 commit 58b60f9

File tree

4 files changed

+82
-10
lines changed

4 files changed

+82
-10
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"require-dev": {
2828
"bamarni/composer-bin-plugin": "^1.8.2",
2929
"dealerdirect/phpcodesniffer-composer-installer": "^1.2",
30+
"drevops/phpcs-standard": "^0.2.0",
3031
"drupal/coder": "^8.3.31",
3132
"ergebnis/composer-normalize": "^2.48.2",
3233
"phpstan/phpstan": "^2.1.32",

composer.lock

Lines changed: 69 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phpcs.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
<rule ref="Drupal">
77
<exclude name="Drupal.Commenting.ClassComment.Short" />
88
</rule>
9+
<rule ref="Generic.PHP.RequireStrictTypes" />
10+
<rule ref="DrevOps.NamingConventions.LocalVariableSnakeCase"/>
11+
<rule ref="DrevOps.NamingConventions.ParameterSnakeCase"/>
912

1013
<!-- Show sniff codes in all reports -->
1114
<arg value="s"/>

tests/Traits/ReflectionTrait.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,38 +26,38 @@ trait ReflectionTrait {
2626
* Method result.
2727
*/
2828
protected static function callProtectedMethod(object|string $object, string $name, array $args = []) {
29-
$objectOrClass = is_object($object) ? $object::class : $object;
29+
$object_or_class = is_object($object) ? $object::class : $object;
3030

31-
if (!class_exists($objectOrClass)) {
32-
throw new \InvalidArgumentException(sprintf('Class %s does not exist', $objectOrClass));
31+
if (!class_exists($object_or_class)) {
32+
throw new \InvalidArgumentException(sprintf('Class %s does not exist', $object_or_class));
3333
}
3434

35-
$class = new \ReflectionClass($objectOrClass);
35+
$class = new \ReflectionClass($object_or_class);
3636

3737
if (!$class->hasMethod($name)) {
3838
throw new \InvalidArgumentException(sprintf('Method %s does not exist', $name));
3939
}
4040

4141
$method = $class->getMethod($name);
4242

43-
$originalAccessibility = $method->isPublic();
43+
$original_accessibility = $method->isPublic();
4444

4545
// Set method accessibility to true, so it can be invoked.
4646
$method->setAccessible(TRUE);
4747

4848
// If the method is static, we won't pass an object instance to invokeArgs()
4949
// Otherwise, we ensure to pass the object instance.
50-
$invokeObject = $method->isStatic() ? NULL : (is_object($object) ? $object : NULL);
50+
$invoke_object = $method->isStatic() ? NULL : (is_object($object) ? $object : NULL);
5151

5252
// Ensure we have an object for non-static methods.
53-
if (!$method->isStatic() && $invokeObject === NULL) {
53+
if (!$method->isStatic() && $invoke_object === NULL) {
5454
throw new \InvalidArgumentException("An object instance is required for non-static methods");
5555
}
5656

57-
$result = $method->invokeArgs($invokeObject, $args);
57+
$result = $method->invokeArgs($invoke_object, $args);
5858

5959
// Reset the method's accessibility to its original state.
60-
$method->setAccessible($originalAccessibility);
60+
$method->setAccessible($original_accessibility);
6161

6262
return $result;
6363
}

0 commit comments

Comments
 (0)