Skip to content

Commit df294f8

Browse files
committed
Rework the live_component_post_install function
1 parent d2ea654 commit df294f8

File tree

2 files changed

+25
-15
lines changed

2 files changed

+25
-15
lines changed

.github/workflows/.utils.sh

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

32-
install_property_info_for_version() {
33-
local php_version="$1"
34-
local symfony_version="$2"
35-
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
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() {
35+
local php_version=$1
36+
local symfony_version=$2
37+
38+
if [ "$php_version" = "8.1" ]; then
39+
# no-op, let Composer install the best PropertyInfo version (defined in composer.json), but do not require TypeInfo
40+
return 0
41+
fi
42+
43+
if [ "$php_version" = "8.2" ]; then
44+
# PropertyInfo 7.1 (experimental PropertyTypeExtractorInterface::getType) and TypeInfo 7.2 (lowest non-experimental)
4145
composer require symfony/property-info:7.1.* symfony/type-info:7.2.*
42-
elif [ "$php_version" = "8.3" ]; then
43-
composer require symfony/property-info:7.2.* symfony/type-info:7.2.*
44-
elif [ "$php_version" = "8.4" ]; then
46+
return $?
47+
fi
48+
49+
if [ "$php_version" = "8.3" ]; then
50+
# Install PropertyInfo 7.3 (deprecate PropertyTypeExtractorInterface::getTypes) and TypeInfo 7.3 (new features and deprecations)
4551
composer require symfony/property-info:7.3.* symfony/type-info:7.3.*
52+
return $?
4653
fi
54+
55+
# Install the best TypeInfo version available
56+
composer require symfony/type-info
4757
}
48-
export -f install_property_info_for_version
58+
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)