Skip to content

Commit 767404b

Browse files
committed
docker + phpstan lvl9 + refactor
1 parent 3a97cc2 commit 767404b

9 files changed

+406
-145
lines changed

Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM composer:latest AS composer
2+
FROM php:8.1-fpm
3+
COPY --from=composer /usr/bin/composer /usr/bin/composer
4+
LABEL org.opencontainers.image.description="php-chmod is a PHP library for easily changing permissions recursively."
5+
WORKDIR /app
6+
COPY . .
7+
RUN apt-get update && apt-get -y upgrade && apt-get -y install zip
8+
RUN composer update

README.md

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
| Version | PHP | Documentation |
1717
|---------|------|---------------|
18-
| ^1.1 | ^7.4 | current |
18+
| ^2.0 | ^7.4 | current |
1919

2020
### Requirements
2121

@@ -63,7 +63,7 @@ require __DIR__ . '/vendor/autoload.php';
6363
->setExcludedFileModes([0400, 0444, 0640])
6464
->setExcludedDirectoryModes([0750])
6565
->scan([__DIR__])
66-
->fix();
66+
->fix(); // void
6767
```
6868

6969
### Documentation
@@ -128,6 +128,18 @@ scanner:
128128
$result->setPaths($paths);
129129
```
130130

131+
`doExcludeFiles` excludes all files:
132+
133+
```php
134+
$result->doExcludeFiles();
135+
```
136+
137+
`doExcludeDirectories` excludes all directories:
138+
139+
```php
140+
$result->doExcludeDirectories();
141+
```
142+
131143
`dryRun` returns an array of the concerned files/directories:
132144

133145
```php
@@ -151,6 +163,40 @@ issues).
151163
If you have a suggestion to improve this, please fork the repo and create a pull request. You can also open an issue
152164
with the tag "enhancement". Finally, don't forget to give the project a star! Thanks again!
153165

166+
#### Docker
167+
168+
If you are using docker, you can use the following command to get started:
169+
170+
```bash
171+
docker-compose up --build -d
172+
```
173+
174+
Next, access the container:
175+
176+
```bash
177+
docker exec -it php-chmod bash
178+
```
179+
180+
#### Tools
181+
182+
PHP Coding Standards Fixer:
183+
184+
```bash
185+
composer run-script php-cs-fixer
186+
```
187+
188+
PHP Stan:
189+
190+
```
191+
composer run-script phpstan
192+
```
193+
194+
Unit tests:
195+
196+
```bash
197+
composer run-script test
198+
```
199+
154200
### License
155201

156202
It is distributed under the MIT License. See `LICENSE` for more information.

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
},
2424
"require-dev": {
2525
"ergebnis/composer-normalize": "^2.28",
26-
"friendsofphp/php-cs-fixer": "^3.9",
26+
"friendsofphp/php-cs-fixer": "^3.11",
2727
"phpstan/phpstan": "^1.8",
2828
"phpunit/phpunit": "^9.5"
2929
},
@@ -45,8 +45,8 @@
4545
"sort-packages": true
4646
},
4747
"scripts": {
48-
"php-cs-fixer": "./vendor/bin/php-cs-fixer fix . --dry-run --diff",
49-
"phpstan": "./vendor/bin/phpstan analyse src tests --level=5",
48+
"php-cs-fixer": "./vendor/bin/php-cs-fixer fix .",
49+
"phpstan": "./vendor/bin/phpstan analyse src --level=9",
5050
"test": "./vendor/bin/phpunit --bootstrap vendor/autoload.php --colors=always tests/"
5151
}
5252
}

docker-compose.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: "3"
2+
3+
services:
4+
app:
5+
build: .
6+
image: php-chmod:2.0
7+
container_name: "php-chmod"
8+
ports:
9+
- "8080:80"
10+
volumes:
11+
- ./:/app

0 commit comments

Comments
 (0)