Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #8 from lubiana/update_for_php8.0
Browse files Browse the repository at this point in the history
push dependencies for php 8.0 inspection
  • Loading branch information
erinbit authored Apr 11, 2024
2 parents f79ff4c + 121b531 commit 14843f2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM php:7.4-cli-alpine
FROM php:8.0-cli-alpine

# Install PHP CodeSniffer
ARG PHPCS_RELEASE="3.5.3"
ARG PHPCS_RELEASE="3.6.0"
RUN pear install PHP_CodeSniffer-$PHPCS_RELEASE

# Install the PHPCompatibility standard
ARG PHPCOMP_RELEASE="9.3.4"
ARG PHPCOMP_RELEASE="9.3.5"
RUN set -eux &&\
apk --no-cache add git &&\
mkdir -p "/opt/" &&\
Expand All @@ -17,7 +17,7 @@ RUN set -eux &&\
# Configure phpcs defaults
RUN phpcs --config-set installed_paths /opt/PHPCompatibility &&\
phpcs --config-set default_standard PHPCompatibility &&\
phpcs --config-set testVersion 7.4 &&\
phpcs --config-set testVersion 8.0 &&\
phpcs --config-set report_width 120

# Configure PHP with all the memory we might need (unlimited)
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ phpco() { docker run --init -v $PWD:/mnt/src:cached --rm -u "$(id -u):$(id -g)"
You can also add this snippet to your `.bashrc` or similar shell startup script. That way it will always be available whenever you open a new shell.

## Running phpco-docker
Now you can directly use the tool. This command will do a full check of all your code in the current directory for PHP 7.4 compatibility.
Now you can directly use the tool. This command will do a full check of all your code in the current directory for PHP 8.0 compatibility.
```
phpco -p --colors --extensions=php --runtime-set testVersion 7.4 .
phpco -p --colors --extensions=php --runtime-set testVersion 8.0 .
```

As it completes you will see a list of found warnings and errors in your code. If you are getting a lot of warnings, but only want to deal with the stuff that will actually break, add `-n` to only show errors.

If you have also updated all of your dependencies and are sure they support the PHP version you want to migrate to, you can exclude the `vendor` folder completely to only check your own code. Checking for PHP version 7.4 is the default so we can also remove that part.
If you have also updated all of your dependencies and are sure they support the PHP version you want to migrate to, you can exclude the `vendor` folder completely to only check your own code. Checking for PHP version 8.0 is the default so we can also remove that part.

```
phpco -p --colors --extensions=php . -n --ignore="vendor/"
Expand Down

0 comments on commit 14843f2

Please sign in to comment.