diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 86bfa10..15690e1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -71,7 +71,7 @@ jobs: - name: Install PHP uses: shivammathur/setup-php@v2 with: - php-version: 8.2 + php-version: ${{ matrix.php }} tools: symfony-cli diff --git a/src/NodeAnalyzer/AttributeFinder.php b/src/NodeAnalyzer/AttributeFinder.php index cdb187c..ac8bea0 100644 --- a/src/NodeAnalyzer/AttributeFinder.php +++ b/src/NodeAnalyzer/AttributeFinder.php @@ -16,7 +16,7 @@ */ final class AttributeFinder { - public static function findAttribute(ClassMethod | Property | ClassLike | Param $node, string $desiredAttributeClass): ?Attribute + public static function findAttribute(ClassMethod|Property|ClassLike|Param $node, string $desiredAttributeClass): ?Attribute { $attributes = self::findAttributes($node); @@ -38,7 +38,7 @@ public static function findAttribute(ClassMethod | Property | ClassLike | Param * * @param string[] $desiredAttributeClasses */ - public static function findAnyAttribute(ClassMethod | Property | ClassLike | Param $node, array $desiredAttributeClasses): ?Attribute + public static function findAnyAttribute(ClassMethod|Property|ClassLike|Param $node, array $desiredAttributeClasses): ?Attribute { $attributes = self::findAttributes($node); @@ -58,7 +58,7 @@ public static function findAnyAttribute(ClassMethod | Property | ClassLike | Par /** * @return Attribute[] */ - private static function findAttributes(ClassMethod | Property | ClassLike | Param $node): array + private static function findAttributes(ClassMethod|Property|ClassLike|Param $node): array { $attributes = []; diff --git a/src/Rules/LiveComponent/LivePropHydrationMethodsRule.php b/src/Rules/LiveComponent/LivePropHydrationMethodsRule.php index 10d8d6f..f839c2f 100644 --- a/src/Rules/LiveComponent/LivePropHydrationMethodsRule.php +++ b/src/Rules/LiveComponent/LivePropHydrationMethodsRule.php @@ -62,7 +62,7 @@ public function processNode(Node $node, Scope $scope): array $propertyName = $property->props[0]->name->toString(); // Ensure that "dehydrateWith" is specified when "hydrateWith" is specified - if ($hydrateWith !== null && $dehydrateWith === null) { + if ($dehydrateWith === null) { $errors[] = RuleErrorBuilder::message( sprintf( 'Property "%s" has a #[LiveProp] attribute with "hydrateWith" but is missing "dehydrateWith".', @@ -78,7 +78,7 @@ public function processNode(Node $node, Scope $scope): array } // Ensure that "hydrateWith" is specified when "dehydrateWith" is specified - if ($dehydrateWith !== null && $hydrateWith === null) { + if ($hydrateWith === null) { $errors[] = RuleErrorBuilder::message( sprintf( 'Property "%s" has a #[LiveProp] attribute with "dehydrateWith" but is missing "hydrateWith".', @@ -93,9 +93,6 @@ public function processNode(Node $node, Scope $scope): array continue; } - // At this point, both $hydrateWith and $dehydrateWith are guaranteed to be non-null (validated above) - assert($hydrateWith !== null && $dehydrateWith !== null); - // Get method reflections using PHPStan's reflection system $hydrateMethodExists = $reflClass->hasMethod($hydrateWith); $dehydrateMethodExists = $reflClass->hasMethod($dehydrateWith);