Skip to content

Commit

Permalink
Fix build with slevomat/coding-standard 8 (#981)
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabus authored Aug 26, 2022
1 parent 5c70b32 commit d534f19
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 45 deletions.
21 changes: 6 additions & 15 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -29,30 +29,21 @@
<exclude name="Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps"/>
</rule>

<!-- Disable the rules that will require PHP 7.4 -->
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint">
<properties>
<property name="enableNativeTypeHint" value="false"/>
</properties>
</rule>

<rule ref="Squiz.Classes.ClassFileName.NoMatch">
<exclude-pattern>*/tests/Common/Util/ClassUtilsTest.php</exclude-pattern>
<exclude-pattern>tests/Common/Util/ClassUtilsTest.php</exclude-pattern>
</rule>

<!-- Disable the rules that will require PHP 7.4 -->
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint">
<properties>
<property name="enableNativeTypeHint" value="false"/>
</properties>
<rule ref="SlevomatCodingStandard.Commenting.RequireOneLineDocComment.MultiLineDocComment">
<!-- This sniff produces annotations that PHPUnit 7 does not understand. -->
<exclude-pattern>tests</exclude-pattern>
</rule>

<rule ref="Squiz.Classes.ClassFileName.NoMatch">
<exclude-pattern>*/tests/Common/Util/ClassUtilsTest.php</exclude-pattern>
<exclude-pattern>tests/Common/Util/ClassUtilsTest.php</exclude-pattern>
</rule>

<rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses">
<exclude-pattern>*/tests/*</exclude-pattern>
<exclude-pattern>tests/*</exclude-pattern>
</rule>

<rule ref="PSR1.Classes.ClassDeclaration.MissingNamespace">
Expand Down
16 changes: 4 additions & 12 deletions src/Proxy/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
*/
class InvalidArgumentException extends BaseInvalidArgumentException implements ProxyException
{
/**
* @return self
*/
/** @return self */
public static function proxyDirectoryRequired()
{
return new self('You must configure a proxy directory. See docs for details');
Expand Down Expand Up @@ -47,17 +45,13 @@ public static function invalidPlaceholder($name)
return new self(sprintf('Provided placeholder for "%s" must be either a string or a valid callable', $name));
}

/**
* @return self
*/
/** @return self */
public static function proxyNamespaceRequired()
{
return new self('You must configure a proxy namespace');
}

/**
* @return self
*/
/** @return self */
public static function unitializedProxyExpected(Proxy $proxy)
{
return new self(sprintf('Provided proxy of type "%s" must not be initialized.', get_class($proxy)));
Expand Down Expand Up @@ -97,9 +91,7 @@ public static function classMustNotBeFinal($className)
return new self(sprintf('Unable to create a proxy for a final class "%s".', $className));
}

/**
* @param mixed $value
*/
/** @param mixed $value */
public static function invalidAutoGenerateMode($value): self
{
return new self(sprintf('Invalid auto generate mode "%s" given.', $value));
Expand Down
24 changes: 6 additions & 18 deletions src/Proxy/ProxyGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,7 @@ public function generateProxyClass(ClassMetadata $class, $fileName = false)
rename($tmpFileName, $fileName);
}

/**
* @throws InvalidArgumentException
*/
/** @throws InvalidArgumentException */
private function verifyClassCanBeProxied(ClassMetadata $class)
{
if ($class->getReflectionClass()->isFinal()) {
Expand Down Expand Up @@ -1099,9 +1097,7 @@ private function buildParametersString(array $parameters, array $renameParameter
return implode(', ', $parameterDefinitions);
}

/**
* @return string|null
*/
/** @return string|null */
private function getParameterType(ReflectionParameter $parameter)
{
if (! $parameter->hasType()) {
Expand All @@ -1115,9 +1111,7 @@ private function getParameterType(ReflectionParameter $parameter)
return $this->formatType($parameter->getType(), $declaringFunction, $parameter);
}

/**
* @return string
*/
/** @return string */
private function getParameterDefaultValue(ReflectionParameter $parameter)
{
if (! $parameter->isDefaultValueAvailable()) {
Expand Down Expand Up @@ -1171,9 +1165,7 @@ static function (ReflectionParameter $parameter) {
);
}

/**
* @return string
*/
/** @return string */
private function getMethodReturnType(ReflectionMethod $method)
{
if (! $method->hasReturnType()) {
Expand All @@ -1183,9 +1175,7 @@ private function getMethodReturnType(ReflectionMethod $method)
return ': ' . $this->formatType($method->getReturnType(), $method);
}

/**
* @return bool
*/
/** @return bool */
private function shouldProxiedMethodReturn(ReflectionMethod $method)
{
if (! $method->hasReturnType()) {
Expand All @@ -1199,9 +1189,7 @@ private function shouldProxiedMethodReturn(ReflectionMethod $method)
);
}

/**
* @return string
*/
/** @return string */
private function formatType(
ReflectionType $type,
ReflectionMethod $method,
Expand Down

0 comments on commit d534f19

Please sign in to comment.