Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
6 changes: 3 additions & 3 deletions src/NodeAnalyzer/AttributeFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);

Expand All @@ -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 = [];

Expand Down
7 changes: 2 additions & 5 deletions src/Rules/LiveComponent/LivePropHydrationMethodsRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -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".',
Expand All @@ -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".',
Expand All @@ -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);
Expand Down
Loading