Skip to content

Commit 6207cd4

Browse files
committed
Rework the live_component_post_install function
1 parent 4013968 commit 6207cd4

File tree

2 files changed

+34
-11
lines changed

2 files changed

+34
-11
lines changed

.github/workflows/.utils.sh

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,43 @@ _run_task() {
2929
}
3030
export -f _run_task
3131

32-
install_property_info_for_version() {
32+
# Install specific versions of PropertyInfo and TypeInfo based on PHP and Symfony versions
33+
# To remove in Symfony UX 4.0
34+
live_component_post_install() {
3335
local php_version="$1"
3436
local symfony_version="$2"
3537

36-
if [ "$symfony_version" = "7.4.*" ]; then
37-
composer require symfony/property-info:7.4.* symfony/type-info:7.4.*
38-
elif [ "$symfony_version" = "8.0.*" ]; then
39-
composer require symfony/property-info:8.0.* symfony/type-info:8.0.*
40-
elif [ "$php_version" = "8.2" ]; then
38+
# Lowest PHP version
39+
if [ "$php_version" = "8.1" ]; then
40+
# no-op, let Composer install the best PropertyInfo version (defined in composer.json), but do not require TypeInfo
41+
return 0
42+
fi
43+
44+
if [ "$php_version" = "8.2" ]; then
45+
# PropertyInfo 7.1 (experimental PropertyTypeExtractorInterface::getType) and TypeInfo 7.2 (lowest non-experimental)
4146
composer require symfony/property-info:7.1.* symfony/type-info:7.2.*
42-
elif [ "$php_version" = "8.3" ]; then
47+
return $?
48+
fi
49+
50+
if [ "$php_version" = "8.3" ]; then
51+
# Install PropertyInfo 7.2 and TypeInfo 7.2, ensuring they are compatible together in LiveComponent
4352
composer require symfony/property-info:7.2.* symfony/type-info:7.2.*
44-
elif [ "$php_version" = "8.4" ]; then
53+
return $?
54+
fi
55+
56+
if [ "$php_version" = "8.4" ]; then
57+
# Install PropertyInfo 7.3 (deprecate PropertyTypeExtractorInterface::getTypes) and TypeInfo 7.3 (new features and deprecations)
4558
composer require symfony/property-info:7.3.* symfony/type-info:7.3.*
59+
return $?
4660
fi
61+
62+
if [ "$php_version" = "8.5" ]; then
63+
# Install PropertyInfo 7.3 (deprecate PropertyTypeExtractorInterface::getTypes) and TypeInfo 7.3 (new features and deprecations)
64+
composer require symfony/property-info:7.3.* symfony/type-info:7.3.*
65+
return $?
66+
fi
67+
68+
echo "No specific PropertyInfo/TypeInfo installation for PHP \"$php_version\" and Symfony \"$symfony_version\""
69+
return 1
4770
}
48-
export -f install_property_info_for_version
71+
export -f live_component_post_install

.github/workflows/unit-tests.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ jobs:
123123
'(cd src/{} \
124124
&& $COMPOSER_MIN_STAB \
125125
&& $COMPOSER_UP \
126-
&& if [ {} = LiveComponent ]; then install_property_info_for_version \"${{ matrix.php-version }}\" \"${{ matrix.symfony-version }}\"; fi \
126+
&& if [ {} = LiveComponent ]; then live_component_post_install \"${{ matrix.php-version }}\" \"${{ matrix.symfony-version }}\"; fi \
127127
&& $PHPUNIT)'"
128128
129129
- name: Run packages tests (Windows)
@@ -138,7 +138,7 @@ jobs:
138138
'(cd src/$PACKAGE \
139139
&& $COMPOSER_MIN_STAB \
140140
&& $COMPOSER_UP \
141-
&& if [ "$PACKAGE" = "LiveComponent" ]; then install_property_info_for_version \"${{ matrix.php-version }}\" \"${{ matrix.symfony-version }}\"; fi \
141+
&& if [ "$PACKAGE" = "LiveComponent" ]; then live_component_post_install \"${{ matrix.php-version }}\" \"${{ matrix.symfony-version }}\"; fi \
142142
&& $PHPUNIT)'; then
143143
FAILED_PACKAGES="$FAILED_PACKAGES $PACKAGE"
144144
fi

0 commit comments

Comments
 (0)