Skip to content

Commit 3e8ae8c

Browse files
authored
Bump development version to 8.0. Rule supports 7.4 - 8.3 (#6)
* Bump dependencies - require php >=7.4 - require phpstan ^1.11 - deal with deprecated TypeUtils::* * Fix CI * Bump Dev PHP to 8.0 * Full blown CI
1 parent 5fa3b16 commit 3e8ae8c

File tree

7 files changed

+1537
-836
lines changed

7 files changed

+1537
-836
lines changed

.github/workflows/buildTest.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ jobs:
77
runs-on: ${{ matrix.operating-system }}
88
strategy:
99
matrix:
10-
operating-system: [ ubuntu-22.04 ]
11-
php: [ '7.4', '8.0' ]
10+
operating-system: [ ubuntu-latest ]
11+
php: [ '7.4', '8.0', '8.1', '8.2', '8.3' ]
1212
name: Build and test on ${{ matrix.php }}
1313
steps:
1414
- name: Checkout repository
@@ -22,7 +22,7 @@ jobs:
2222
- name: Require php-cs-fixer
2323
run: |
2424
mkdir --parents ./tools/php-cs-fixer
25-
composer require --working-dir=tools/php-cs-fixer friendsofphp/php-cs-fixer "friendsofphp/php-cs-fixer:3.0.0" --prefer-dist --no-progress
25+
composer require --working-dir=tools/php-cs-fixer friendsofphp/php-cs-fixer "friendsofphp/php-cs-fixer" --prefer-dist --no-progress
2626
- name: Install dependencies
2727
run: composer install --prefer-dist --no-progress
2828
- name: Unit tests
@@ -32,9 +32,9 @@ jobs:
3232
- name: Psalm
3333
run: |
3434
./vendor/bin/psalm --monochrome --no-progress --stats --show-info=false
35-
- name: DISABLED phpstan
35+
- name: phpstan
3636
run: |
37-
echo ./vendor/bin/phpstan --no-interaction --no-ansi analyse
37+
./vendor/bin/phpstan --no-interaction --no-ansi analyse
3838
- name: Mess Detector Sources
3939
run: |
4040
./vendor/bin/phpmd src text codesize,controversial,design,naming,unusedcode,design

.php-cs-fixer.dist.php

Lines changed: 42 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,53 @@
88
->in(__DIR__);
99

1010
$rules = [
11-
'@PSR2' => true,
12-
'@Symfony' => true,
13-
'@PhpCsFixer' => true,
14-
'@PhpCsFixer:risky' => true,
15-
'@PHPUnit75Migration:risky' => true,
16-
'@PHP71Migration:risky' => true,
17-
'php_unit_dedicate_assert' => ['target' => '5.6'],
18-
'array_syntax' => ['syntax' => 'short'],
19-
'no_superfluous_phpdoc_tags' => true,
20-
'native_function_invocation' => false,
21-
'concat_space' => ['spacing' => 'one'],
22-
'phpdoc_types_order' => ['null_adjustment' => 'always_first', 'sort_algorithm' => 'alpha'],
23-
'single_line_comment_style' => [
24-
'comment_types' => ['hash'],
25-
],
26-
'phpdoc_summary' => false,
27-
'cast_spaces' => ['space' => 'none'],
28-
'binary_operator_spaces' => ['default' => null, 'operators' => ['=' => 'align_single_space_minimal', '=>' => 'align_single_space_minimal']],
29-
'no_unused_imports' => true,
30-
'ordered_imports' => ['sort_algorithm' => 'alpha', 'imports_order' => ['const', 'class', 'function']],
31-
'phpdoc_to_comment' => false,
32-
'native_constant_invocation' => false,
33-
'fully_qualified_strict_types' => false,
11+
'@PER-CS' => true,
12+
'@Symfony' => true,
13+
'@PhpCsFixer' => true,
14+
'@PHPUnit100Migration:risky' => true,
15+
'@PHP80Migration:risky' => true,
16+
'@PHP82Migration' => true,
17+
'no_superfluous_phpdoc_tags' => true,
18+
'native_function_invocation' => false,
19+
'concat_space' => ['spacing' => 'one'],
20+
'phpdoc_types_order' => ['null_adjustment' => 'always_first', 'sort_algorithm' => 'alpha'],
21+
'single_line_comment_style' => ['comment_types' => [ /* 'hash' */],],
22+
'phpdoc_summary' => false,
23+
'cast_spaces' => ['space' => 'none'],
24+
'binary_operator_spaces' => ['default' => null, 'operators' => ['=' => 'align_single_space_minimal', '=>' => 'align_single_space_minimal_by_scope']],
25+
'no_unused_imports' => true,
26+
'ordered_imports' => ['sort_algorithm' => 'alpha', 'imports_order' => ['const', 'class', 'function']],
27+
'control_structure_braces' => true,
28+
'control_structure_continuation_position' => true,
29+
'date_time_create_from_format_call' => true,
30+
'date_time_immutable' => true,
31+
'nullable_type_declaration_for_default_null_value' => true,
32+
'phpdoc_line_span' => ['const' => 'single', 'method' => 'single', 'property' => 'single'],
33+
'simplified_null_return' => true,
34+
'statement_indentation' => true,
35+
'blank_line_before_statement' => ['statements' => ['continue', 'declare', 'default', 'exit', 'goto', 'include', 'include_once', 'require', 'require_once', 'return', 'switch']],
36+
'simplified_if_return' => true,
37+
'use_arrow_functions' => false,
38+
'fully_qualified_strict_types' => false,
39+
'phpdoc_to_comment' => false,
3440
];
35-
if (version_compare(PHP_VERSION, '7.3.0', '>=')) {
36-
$rules['@PHP73Migration'] = true;
37-
}
3841

3942
$config = new PhpCsFixer\Config();
4043
$config->setRiskyAllowed(true)
4144
->setRules($rules)
4245
->setFinder($finder);
4346

47+
if (class_exists('PhpCsFixer\Runner\Parallel\ParallelConfigFactory')) {
48+
$config->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect());
49+
}
50+
51+
if (false) {
52+
$resolver = new \PhpCsFixer\Console\ConfigurationResolver($config, [], '', new \PhpCsFixer\ToolInfo());
53+
echo "\n\n# DUMPING EFFECTIVE RULES #################\n";
54+
var_export($resolver->getRules());
55+
echo "\n\n###########################################\n";
56+
57+
die();
58+
}
59+
4460
return $config;

.provision/Dockerfile

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,23 @@
1-
FROM php:7.4-cli
1+
FROM php:8.0-cli
22

33
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
44

55
RUN apt-get update \
66
&& apt-get install -y git nano zip unzip zlib1g-dev libzip-dev \
7-
&& pecl install -o xdebug-3.0.4 \
7+
&& pecl install -o xdebug \
88
&& docker-php-ext-enable xdebug \
99
&& apt-get -y autoremove \
1010
&& apt-get clean \
1111
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* /tmp/pear/* \
12-
&& groupadd --gid 1000 app \
13-
&& useradd --uid 1000 --gid app --shell /bin/bash --create-home app \
1412
&& touch /var/log/xdebug.log && chgrp 1000 /var/log/xdebug.log && chmod g+w /var/log/xdebug.log \
1513
&& sed -i -e '/alias l\|export\|eval/s/#//' /root/.bashrc \
1614
&& mkdir --parents /var/www/src /var/www/tests \
17-
&& chown 1000:1000 /var/www/src /var/www/tests \
1815
&& true
1916
COPY 30-xdebug-config.ini /usr/local/etc/php/conf.d/
2017

21-
ENV PATH "$PATH:/home/app/.composer/vendor/bin"
18+
ENV PATH "$PATH:/root/.composer/vendor/bin"
2219

2320
RUN composer global require friendsofphp/php-cs-fixer \
24-
&& sed -i -e '/alias l\|export\|eval/s/#//' /home/app/.bashrc
21+
&& sed -i -e '/alias l\|export\|eval/s/#//' /root/.bashrc
2522

26-
# WORKDIR /home/app/ # TODO app dir or var/www !?
2723
WORKDIR /var/www/

.provision/docker-compose.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
version: '3.6'
21
services:
32
php:
43
build:
54
context: .
6-
image: php7.4-cli/phpstan-factory-rule
5+
image: php8.0-cli/phpstan-factory-rule
76
volumes:
87
- ./..:/var/www
98
extra_hosts:
109
- "host.docker.internal:${XDEBUG_REMOTE_HOST:-127.0.0.1}"
1110
environment:
12-
PHP_IDE_CONFIG: "serverName=php-cli-74.local"
11+
PHP_IDE_CONFIG: "serverName=php-cli-80.local"

composer.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
{
22
"name": "ebln/phpstan-factory-rule",
3-
"type": "phpstan-extension",
43
"description": "PHPStan rule to enforce instanciation by factories",
54
"license": "MIT",
5+
"type": "phpstan-extension",
66
"authors": [
77
{
88
"name": "ebln",
99
"email": "[email protected]"
1010
}
1111
],
1212
"require": {
13-
"php": "7.4 - 8.3",
13+
"php": "7.4 - 8.4",
1414
"ebln/phpstan-factory-mark": "^1.1",
15-
"phpstan/phpstan": "^0.12 || ^1"
15+
"phpstan/phpstan": "^1.11"
1616
},
1717
"require-dev": {
1818
"ergebnis/composer-normalize": "^2.15",
@@ -21,6 +21,16 @@
2121
"roave/security-advisories": "dev-latest",
2222
"vimeo/psalm": "^4.12"
2323
},
24+
"autoload": {
25+
"psr-4": {
26+
"Ebln\\PHPStan\\EnforceFactory\\": "src/"
27+
}
28+
},
29+
"autoload-dev": {
30+
"psr-4": {
31+
"Test\\Ebln\\PHPStan\\EnforceFactory\\": "tests/"
32+
}
33+
},
2434
"config": {
2535
"allow-plugins": {
2636
"ergebnis/composer-normalize": true
@@ -34,16 +44,6 @@
3444
]
3545
}
3646
},
37-
"autoload": {
38-
"psr-4": {
39-
"Ebln\\PHPStan\\EnforceFactory\\": "src/"
40-
}
41-
},
42-
"autoload-dev": {
43-
"psr-4": {
44-
"Test\\Ebln\\PHPStan\\EnforceFactory\\": "tests/"
45-
}
46-
},
4747
"scripts": {
4848
"coverage": "XDEBUG_MODE=coverage phpunit --coverage-html coverage --coverage-text --colors=auto && chown -R 1000:1000 coverage",
4949
"quality": [

0 commit comments

Comments
 (0)