Skip to content

PHP 8.4 #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"image": "opencodeco/phpctl:php83-devcontainer",
"image": "opencodeco/phpctl:php84-devcontainer",
"containerEnv": {
"PHP_VERSION": "83"
"PHP_VERSION": "84"
},
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/devcontainer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
php-str: 8.2
- php: 83
php-str: 8.3
- php: 84
php-str: 8.4

steps:
-
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ jobs:
- alpine: '3.20'
php: 83
without-watchr: ''
- alpine: '3.21'
php: 84
without-watchr: ''
steps:
-
name: Checkout
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ default: build

.PHONY: build
build:
@parallel --line-buffer PHP_VERSION={} ./bin/phpctl build ::: 81 82 83
@parallel --line-buffer PHP_VERSION={} ./bin/phpctl build ::: 81 82 83 84

.PHONY: test
test:
@parallel --line-buffer PHP_VERSION={} COMPOSER_AUTH= TERM= ./bin/notty ./lib/bashunit ./tests/ ::: 81 82 83
@parallel --line-buffer PHP_VERSION={} COMPOSER_AUTH= TERM= ./bin/notty ./lib/bashunit ./tests/ ::: 81 82 83 84
@[ -f phpctl.ini ] && rm phpctl.ini

.PHONY: install
Expand All @@ -16,4 +16,4 @@ install:

.PHONY: devcontainers
devcontainers:
@parallel --line-buffer PHP_VERSION={} ./src-devc/build.sh ::: 81 82 83
@parallel --line-buffer PHP_VERSION={} ./src-devc/build.sh ::: 81 82 83 84
6 changes: 3 additions & 3 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ nav_order: 2
| `co-phpunit` | [co-phpunit](https://github.com/hyperf/testing) is a Coroutine-aware PHPUnit for testing Hyperf projects. |
| `composer-require-checker` | [ComposerRequireChecker](https://github.com/maglnet/ComposerRequireChecker): A CLI tool to analyze composer dependencies and verify that no unknown symbols are used in the sources of a package. |
| `couscous` | [Couscous](https://github.com/CouscousPHP/Couscous): Couscous generates a GitHub pages website from your markdown documentation. |
| `deptrac` | [Deptrac](https://github.com/qossmic/deptrac): Deptrac is a static code analysis tool for PHP that helps you communicate, visualize and enforce architectural decisions in your projects. |
| `deptrac` | [Deptrac](https://github.com/deptrac/deptrac): Deptrac is a static code analysis tool for PHP that helps you communicate, visualize and enforce architectural decisions in your projects. |
| `exakat` | [Exakat](https://www.exakat.io) is a real time customizable static analyzer engine that analyse and fix code. |
| `frankenphp` | [FrankenPHP](https://frankenphp.dev): the Modern PHP App Server, written in Go. |
| `infection` | [Infection](https://infection.github.io) is a Mutation Testing Framework. |
| `pest` | [Pest](https://pestphp.com) is a testing framework with a focus on simplicity. |
| `php-cs-fixer` | [PHP Coding Standards Fixer (PHP CS Fixer)](https://cs.symfony.com/) fixes your code to follow standards. |
| `phpcbf` | [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) is an essential development tool that ensures your code remains clean and consistent. |
| `phpcs` | [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) is an essential development tool that ensures your code remains clean and consistent. |
| `phpcbf` | [PHP CodeSniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer/) is an essential development tool that ensures your code remains clean and consistent. |
| `phpcs` | [PHP CodeSniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer/) is an essential development tool that ensures your code remains clean and consistent. |
| `phpmd` | [PHP Mess Detector](https://phpmd.org/) looks for several potential problems within your source code. |
| `phpstan` | [PHPStan](https://phpstan.org/) finds bugs in your code without writing tests. It's open-source and free. |
| `phpunit` | [PHPUnit](https://phpunit.de) is a programmer-oriented testing framework for PHP. |
Expand Down
2 changes: 1 addition & 1 deletion examples/phpunit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ And everything should ok fine.

The command PhpStorm should be using will be something similar to:
```text
[docker://opencodeco/phpctl:php82/]:php /opt/project/examples/phpunit/vendor/phpunit/phpunit/phpunit --configuration /opt/project/examples/phpunit/phpunit.xml --teamcity
[docker://opencodeco/phpctl:php84/]:php /opt/project/examples/phpunit/vendor/phpunit/phpunit/phpunit --configuration /opt/project/examples/phpunit/phpunit.xml --teamcity
```

---
Expand Down
2 changes: 1 addition & 1 deletion rootfs/usr/local/bin/install-swoole
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env sh
set -e

SWOOLE_VERSION="5.1.4"
SWOOLE_VERSION="6.0.2"
echo "Installing Swoole $SWOOLE_VERSION"

# Download
Expand Down
110 changes: 59 additions & 51 deletions rootfs/usr/local/bin/install-tools
Original file line number Diff line number Diff line change
Expand Up @@ -2,117 +2,125 @@
set -e

box() {
local version="4.6.1"
_version="4.6.6"
if [ "$PHP_VERSION" = "81" ]; then
version="4.5.1"
_version="4.5.1"
fi
echo "Installing Box $version"
wget -q "https://github.com/box-project/box/releases/download/$version/box.phar" -O /usr/local/bin/box
echo "Installing Box $_version"
wget -q "https://github.com/box-project/box/releases/download/$_version/box.phar" -O /usr/local/bin/box
chmod a+x /usr/local/bin/box
}

co_phpunit() {
local version="3.1.3"
echo "Installing co-phpunit $version"
wget -q "https://raw.githubusercontent.com/hyperf/testing/v$version/co-phpunit" -O /usr/local/bin/co-phpunit
_version="3.1.55"
echo "Installing co-phpunit $_version"
wget -q "https://raw.githubusercontent.com/hyperf/testing/v$_version/co-phpunit" -O /usr/local/bin/co-phpunit
chmod a+x /usr/local/bin/co-phpunit
}

composer() {
local version="993f9fec74930f32f7015e71543243bf6d9b9e93"
echo "Installing Composer $version"
wget "https://raw.githubusercontent.com/composer/getcomposer.org/$version/web/installer" -O - -q | php -- --quiet
_version="e8882379a53c329ed348ca583cdc3f8ba6fc4d96"
echo "Installing Composer $_version"
wget "https://raw.githubusercontent.com/composer/getcomposer.org/$_version/web/installer" -O - -q | php -- --quiet
mv composer.phar /usr/local/bin/composer
chmod a+x /usr/local/bin/composer
}

composer_require_checker() {
local version="4.10.0"
_version="4.16.1"
if [ "$PHP_VERSION" = "81" ]; then
version="4.7.1"
_version="4.7.1"
fi
echo "Installing ComposerRequireChecker $version"
wget -q "https://github.com/maglnet/ComposerRequireChecker/releases/download/$version/composer-require-checker.phar" -O /usr/local/bin/composer-require-checker
echo "Installing ComposerRequireChecker $_version"
wget -q "https://github.com/maglnet/ComposerRequireChecker/releases/download/$_version/composer-require-checker.phar" -O /usr/local/bin/composer-require-checker
chmod a+x /usr/local/bin/composer-require-checker
}

couscous() {
local version="1.10.0"
echo "Installing Couscous $version"
wget -q "https://github.com/CouscousPHP/Couscous/releases/download/$version/couscous.phar" -O /usr/local/bin/couscous
_version="1.10.0"
echo "Installing Couscous $_version"
wget -q "https://github.com/CouscousPHP/Couscous/releases/download/$_version/couscous.phar" -O /usr/local/bin/couscous
chmod a+x /usr/local/bin/couscous
}

deptrac() {
local version="1.0.2"
echo "Installing Deptrac $version"
wget -q "https://github.com/qossmic/deptrac/releases/download/$version/deptrac.phar" -O /usr/local/bin/deptrac
_version="1.0.2"
echo "Installing Deptrac $_version"
wget -q "https://github.com/deptrac/deptrac/releases/download/$_version/deptrac.phar" -O /usr/local/bin/deptrac
chmod a+x /usr/local/bin/deptrac
}

exakat() {
local version="2.6.2"
echo "Installing Exakat $version"
wget -q "https://www.exakat.io/versions/index.php?file=exakat-$version.phar" -O /usr/local/bin/exakat
_version="2.6.2"
echo "Installing Exakat $_version"
wget -q "https://www.exakat.io/versions/index.php?file=exakat-$_version.phar" -O /usr/local/bin/exakat
chmod a+x /usr/local/bin/exakat
}

infection() {
local version="0.27.10"
echo "Installing Infection $version"
wget -q "https://github.com/infection/infection/releases/download/$version/infection.phar" -O /usr/local/bin/infection
_version="0.29.14"
if [ "$PHP_VERSION" = "81" ]; then
_version="0.27.10"
fi;
echo "Installing Infection $_version"
wget -q "https://github.com/infection/infection/releases/download/$_version/infection.phar" -O /usr/local/bin/infection
chmod a+x /usr/local/bin/infection
}

php_cs_fixer() {
local version="3.51.0"
echo "Installing PHP CS Fixer $version"
wget -q "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/releases/download/v$version/php-cs-fixer.phar" -O /usr/local/bin/php-cs-fixer
_version="3.75.0"
echo "Installing PHP CS Fixer $_version"
wget -q "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/releases/download/v$_version/php-cs-fixer.phar" -O /usr/local/bin/php-cs-fixer
chmod a+x /usr/local/bin/php-cs-fixer
}

phpcbf() {
local version="3.7.2"
echo "Installing PHP CodeSniffer $version (phpcbf)"
wget -q "https://github.com/squizlabs/PHP_CodeSniffer/releases/download/$version/phpcbf.phar" -O /usr/local/bin/phpcbf
_version="3.13.0"
echo "Installing PHP CodeSniffer $_version (phpcbf)"
wget -q "https://github.com/PHPCSStandards/PHP_CodeSniffer//releases/download/$_version/phpcbf.phar" -O /usr/local/bin/phpcbf
chmod a+x /usr/local/bin/phpcbf
}

phpcs() {
local version="3.7.2"
echo "Installing PHP CodeSniffer $version (phpcs)"
wget -q "https://github.com/squizlabs/PHP_CodeSniffer/releases/download/$version/phpcs.phar" -O /usr/local/bin/phpcs
_version="3.13.0"
echo "Installing PHP CodeSniffer $_version (phpcs)"
wget -q "https://github.com/PHPCSStandards/PHP_CodeSniffer//releases/download/$_version/phpcs.phar" -O /usr/local/bin/phpcs
chmod a+x /usr/local/bin/phpcs
}

phpmd() {
local version="2.15.0"
echo "Installing PHP Mess Detector $version"
wget -q "https://github.com/phpmd/phpmd/releases/download/$version/phpmd.phar" -O /usr/local/bin/phpmd
_version="2.15.0"
echo "Installing PHP Mess Detector $_version"
wget -q "https://github.com/phpmd/phpmd/releases/download/$_version/phpmd.phar" -O /usr/local/bin/phpmd
chmod a+x /usr/local/bin/phpmd
}

phpstan() {
local version="1.10.59"
echo "Installing PHPStan $version"
wget -q "https://github.com/phpstan/phpstan/releases/download/$version/phpstan.phar" -O /usr/local/bin/phpstan
_version="1.12.27"
echo "Installing PHPStan $_version"
wget -q "https://github.com/phpstan/phpstan/releases/download/$_version/phpstan.phar" -O /usr/local/bin/phpstan
chmod a+x /usr/local/bin/phpstan
}

phpunit() {
local version="11"
_version="11"
if [ "$PHP_VERSION" = "81" ]; then
version="10"
_version="10"
elif [ "$PHP_VERSION" = "84" ]; then
_version="12"
fi
echo "Installing PHPUnit $version"
wget -q "https://phar.phpunit.de/phpunit-$version.phar" -O /usr/local/bin/phpunit
echo "Installing PHPUnit $_version"
wget -q "https://phar.phpunit.de/phpunit-$_version.phar" -O /usr/local/bin/phpunit
chmod a+x /usr/local/bin/phpunit
}

pint() {
local version="1.14.0"
echo "Installing Pint $version"
wget -q "https://github.com/laravel/pint/releases/download/v$version/pint.phar" -O /usr/local/bin/pint
_version="1.22.1"
if [ "$PHP_VERSION" = "81" ]; then
_version="1.14.0"
fi;
echo "Installing Pint $_version"
wget -q "https://github.com/laravel/pint/releases/download/v$_version/pint.phar" -O /usr/local/bin/pint
chmod a+x /usr/local/bin/pint
}

Expand All @@ -123,9 +131,9 @@ psysh() {
}

watchr() {
local version="0.5.3"
echo "Installing watchr $version"
wget -q "https://github.com/flavioheleno/watchr/releases/download/v$version/watchr.phar" -O /usr/local/bin/watchr
_version="0.5.3"
echo "Installing watchr $_version"
wget -q "https://github.com/flavioheleno/watchr/releases/download/v$_version/watchr.phar" -O /usr/local/bin/watchr
chmod a+x /usr/local/bin/watchr
}

Expand Down
23 changes: 22 additions & 1 deletion src/docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,34 @@ build() {
without_watchr="--build-arg WITHOUT_WATCHR=1"
fi

if [[ -z $ALPINE ]]; then
case $PHP_VERSION in
"81")
ALPINE=3.19
;;
"82")
ALPINE=3.20
;;
"83")
ALPINE=3.20
;;
"84")
ALPINE=3.21
;;
*)
ALPINE=3.21
;;
esac
fi

echo -e "Building \033[0;32m$PHPCTL_IMAGE\033[0m"
# shellcheck disable=SC2068
# shellcheck disable=SC2154
$PHPCTL_RUNTIME buildx build \
--build-arg PHP="$PHP_VERSION" \
--build-arg COMPOSER_AUTH="$COMPOSER_AUTH" \
--build-arg HOST_USER="$(whoami)" \
--build-arg ALPINE="$ALPINE" \
$with_exakat \
$without_watchr \
${build[@]} -t "$PHPCTL_IMAGE" .
Expand Down Expand Up @@ -59,7 +80,7 @@ run() {
if [ -n "$GIT_EXEC_PATH" ]; then
# In a Git hook environment, we need to disable TTY allocation
PHPCTL_TTY="--label=no-tty"
fi
fi

# shellcheck disable=SC2046
# shellcheck disable=SC2068
Expand Down
9 changes: 8 additions & 1 deletion tests/tools_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,15 @@ function test_exakat() {
}

function test_infection() {
assert_matches "Infection - PHP Mutation Testing Framework version 0\.27\." "$(./bin/phpctl infection --version)"
[ "$PHP_VERSION" = "81" ] && _expected_version="0\.27\." || _expected_version="0\.29\."
assert_matches "Infection - PHP Mutation Testing Framework version ${_expected_version}" "$(./bin/phpctl infection --version)"
}

function test_php_cs_fixer() {
if [[ $PHP_VERSION = "84" ]]; then
# TODO: remove this when php-cs-fixer becomes stable with php 8.4
export PHP_CS_FIXER_IGNORE_ENV=yes
fi
assert_matches "PHP CS Fixer 3\." "$(./bin/phpctl php-cs-fixer --version)"
}

Expand All @@ -51,6 +56,8 @@ function test_phpstan() {
function test_phpunit() {
if [ "$PHP_VERSION" = "81" ]; then
assert_matches "PHPUnit 10\." "$(./bin/phpctl phpunit --version)"
elif [ "$PHP_VERSION" = "84" ]; then
assert_matches "PHPUnit 12\." "$(./bin/phpctl phpunit --version)"
else
assert_matches "PHPUnit 11\." "$(./bin/phpctl phpunit --version)"
fi
Expand Down