diff --git a/src/CompareClasses.php b/src/CompareClasses.php index 0fd69d7..2378ef8 100644 --- a/src/CompareClasses.php +++ b/src/CompareClasses.php @@ -92,8 +92,9 @@ private function examineSymbol( yield from ($this->classBasedComparisons)($oldSymbol, $newClass); } - private function isInternalDocComment(string $comment): bool + private function isInternalDocComment(string|null $comment): bool { - return Regex\matches($comment, '/\s+@internal\s+/'); + return $comment !== null + && Regex\matches($comment, '/\s+@internal\s+/'); } } diff --git a/src/DetectChanges/BCBreak/ClassBased/ClassBecameInternal.php b/src/DetectChanges/BCBreak/ClassBased/ClassBecameInternal.php index 5695264..3c9de87 100644 --- a/src/DetectChanges/BCBreak/ClassBased/ClassBecameInternal.php +++ b/src/DetectChanges/BCBreak/ClassBased/ClassBecameInternal.php @@ -32,8 +32,9 @@ public function __invoke(ReflectionClass $fromClass, ReflectionClass $toClass): return Changes::empty(); } - private function isInternalDocComment(string $comment): bool + private function isInternalDocComment(string|null $comment): bool { - return Regex\matches($comment, '/\s+@internal\s+/'); + return $comment !== null + && Regex\matches($comment, '/\s+@internal\s+/'); } } diff --git a/src/DetectChanges/BCBreak/ClassBased/ExcludeInternalClass.php b/src/DetectChanges/BCBreak/ClassBased/ExcludeInternalClass.php index c33ba88..a6a8412 100644 --- a/src/DetectChanges/BCBreak/ClassBased/ExcludeInternalClass.php +++ b/src/DetectChanges/BCBreak/ClassBased/ExcludeInternalClass.php @@ -26,8 +26,9 @@ public function __invoke(ReflectionClass $fromClass, ReflectionClass $toClass): return ($this->check)($fromClass, $toClass); } - private function isInternalDocComment(string $comment): bool + private function isInternalDocComment(string|null $comment): bool { - return Regex\matches($comment, '/\s+@internal\s+/'); + return $comment !== null + && Regex\matches($comment, '/\s+@internal\s+/'); } } diff --git a/src/DetectChanges/BCBreak/ClassBased/MethodRemoved.php b/src/DetectChanges/BCBreak/ClassBased/MethodRemoved.php index 0e9be95..e6134a7 100644 --- a/src/DetectChanges/BCBreak/ClassBased/MethodRemoved.php +++ b/src/DetectChanges/BCBreak/ClassBased/MethodRemoved.php @@ -58,8 +58,9 @@ private function accessibleMethods(ReflectionClass $class): array ); } - private function isInternalDocComment(string $comment): bool + private function isInternalDocComment(string|null $comment): bool { - return Regex\matches($comment, '/\s+@internal\s+/'); + return $comment !== null + && Regex\matches($comment, '/\s+@internal\s+/'); } } diff --git a/src/DetectChanges/BCBreak/ClassBased/PropertyRemoved.php b/src/DetectChanges/BCBreak/ClassBased/PropertyRemoved.php index b3cbb31..ad400fb 100644 --- a/src/DetectChanges/BCBreak/ClassBased/PropertyRemoved.php +++ b/src/DetectChanges/BCBreak/ClassBased/PropertyRemoved.php @@ -50,8 +50,9 @@ private function accessibleProperties(ReflectionClass $class): array }); } - private function isInternalDocComment(string $comment): bool + private function isInternalDocComment(string|null $comment): bool { - return Regex\matches($comment, '/\s+@internal\s+/'); + return $comment !== null + && Regex\matches($comment, '/\s+@internal\s+/'); } } diff --git a/src/DetectChanges/BCBreak/FunctionBased/ExcludeInternalFunction.php b/src/DetectChanges/BCBreak/FunctionBased/ExcludeInternalFunction.php index 4cda2f5..8fa713d 100644 --- a/src/DetectChanges/BCBreak/FunctionBased/ExcludeInternalFunction.php +++ b/src/DetectChanges/BCBreak/FunctionBased/ExcludeInternalFunction.php @@ -29,8 +29,9 @@ public function __invoke( return ($this->check)($fromFunction, $toFunction); } - private function isInternalDocComment(string $comment): bool + private function isInternalDocComment(string|null $comment): bool { - return Regex\matches($comment, '/\s+@internal\s+/'); + return $comment !== null + && Regex\matches($comment, '/\s+@internal\s+/'); } } diff --git a/src/DetectChanges/BCBreak/FunctionBased/FunctionBecameInternal.php b/src/DetectChanges/BCBreak/FunctionBased/FunctionBecameInternal.php index 354d61f..8dd5d0a 100644 --- a/src/DetectChanges/BCBreak/FunctionBased/FunctionBecameInternal.php +++ b/src/DetectChanges/BCBreak/FunctionBased/FunctionBecameInternal.php @@ -43,8 +43,9 @@ public function __invoke( return Changes::empty(); } - private function isInternalDocComment(string $comment): bool + private function isInternalDocComment(string|null $comment): bool { - return Regex\matches($comment, '/\s+@internal\s+/'); + return $comment !== null + && Regex\matches($comment, '/\s+@internal\s+/'); } } diff --git a/src/DetectChanges/BCBreak/InterfaceBased/ExcludeInternalInterface.php b/src/DetectChanges/BCBreak/InterfaceBased/ExcludeInternalInterface.php index 2fc7ccf..46d63f9 100644 --- a/src/DetectChanges/BCBreak/InterfaceBased/ExcludeInternalInterface.php +++ b/src/DetectChanges/BCBreak/InterfaceBased/ExcludeInternalInterface.php @@ -26,8 +26,9 @@ public function __invoke(ReflectionClass $fromInterface, ReflectionClass $toInte return ($this->check)($fromInterface, $toInterface); } - private function isInternalDocComment(string $comment): bool + private function isInternalDocComment(string|null $comment): bool { - return Regex\matches($comment, '/\s+@internal\s+/'); + return $comment !== null + && Regex\matches($comment, '/\s+@internal\s+/'); } } diff --git a/src/DetectChanges/BCBreak/MethodBased/ExcludeInternalMethod.php b/src/DetectChanges/BCBreak/MethodBased/ExcludeInternalMethod.php index 5c62cc0..1a2bdf6 100644 --- a/src/DetectChanges/BCBreak/MethodBased/ExcludeInternalMethod.php +++ b/src/DetectChanges/BCBreak/MethodBased/ExcludeInternalMethod.php @@ -26,8 +26,9 @@ public function __invoke(ReflectionMethod $fromMethod, ReflectionMethod $toMetho return ($this->check)($fromMethod, $toMethod); } - private function isInternalDocComment(string $comment): bool + private function isInternalDocComment(string|null $comment): bool { - return Regex\matches($comment, '/\s+@internal\s+/'); + return $comment !== null + && Regex\matches($comment, '/\s+@internal\s+/'); } } diff --git a/src/DetectChanges/BCBreak/PropertyBased/ExcludeInternalProperty.php b/src/DetectChanges/BCBreak/PropertyBased/ExcludeInternalProperty.php index 385632d..911646d 100644 --- a/src/DetectChanges/BCBreak/PropertyBased/ExcludeInternalProperty.php +++ b/src/DetectChanges/BCBreak/PropertyBased/ExcludeInternalProperty.php @@ -23,8 +23,9 @@ public function __invoke(ReflectionProperty $fromProperty, ReflectionProperty $t return ($this->propertyBased)($fromProperty, $toProperty); } - private function isInternalDocComment(string $comment): bool + private function isInternalDocComment(string|null $comment): bool { - return Regex\matches($comment, '/\s+@internal\s+/'); + return $comment !== null + && Regex\matches($comment, '/\s+@internal\s+/'); } } diff --git a/src/DetectChanges/BCBreak/PropertyBased/PropertyBecameInternal.php b/src/DetectChanges/BCBreak/PropertyBased/PropertyBecameInternal.php index 6968634..3d387c4 100644 --- a/src/DetectChanges/BCBreak/PropertyBased/PropertyBecameInternal.php +++ b/src/DetectChanges/BCBreak/PropertyBased/PropertyBecameInternal.php @@ -40,8 +40,9 @@ public function __invoke(ReflectionProperty $fromProperty, ReflectionProperty $t return Changes::empty(); } - private function isInternalDocComment(string $comment): bool + private function isInternalDocComment(string|null $comment): bool { - return Regex\matches($comment, '/\s+@internal\s+/'); + return $comment !== null + && Regex\matches($comment, '/\s+@internal\s+/'); } } diff --git a/src/DetectChanges/BCBreak/TraitBased/ExcludeInternalTrait.php b/src/DetectChanges/BCBreak/TraitBased/ExcludeInternalTrait.php index 969bfec..9a89fba 100644 --- a/src/DetectChanges/BCBreak/TraitBased/ExcludeInternalTrait.php +++ b/src/DetectChanges/BCBreak/TraitBased/ExcludeInternalTrait.php @@ -26,8 +26,9 @@ public function __invoke(ReflectionClass $fromTrait, ReflectionClass $toTrait): return ($this->check)($fromTrait, $toTrait); } - private function isInternalDocComment(string $comment): bool + private function isInternalDocComment(string|null $comment): bool { - return Regex\matches($comment, '/\s+@internal\s+/'); + return $comment !== null + && Regex\matches($comment, '/\s+@internal\s+/'); } }