Skip to content
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

Bump development version to 8.0. Rule supports 7.4 - 8.3 #6

Merged
merged 4 commits into from
Jun 2, 2024
Merged
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
10 changes: 5 additions & 5 deletions .github/workflows/buildTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ jobs:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ ubuntu-22.04 ]
php: [ '7.4', '8.0' ]
operating-system: [ ubuntu-latest ]
php: [ '7.4', '8.0', '8.1', '8.2', '8.3' ]
name: Build and test on ${{ matrix.php }}
steps:
- name: Checkout repository
Expand All @@ -22,7 +22,7 @@ jobs:
- name: Require php-cs-fixer
run: |
mkdir --parents ./tools/php-cs-fixer
composer require --working-dir=tools/php-cs-fixer friendsofphp/php-cs-fixer "friendsofphp/php-cs-fixer:3.0.0" --prefer-dist --no-progress
composer require --working-dir=tools/php-cs-fixer friendsofphp/php-cs-fixer "friendsofphp/php-cs-fixer" --prefer-dist --no-progress
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Unit tests
Expand All @@ -32,9 +32,9 @@ jobs:
- name: Psalm
run: |
./vendor/bin/psalm --monochrome --no-progress --stats --show-info=false
- name: DISABLED phpstan
- name: phpstan
run: |
echo ./vendor/bin/phpstan --no-interaction --no-ansi analyse
./vendor/bin/phpstan --no-interaction --no-ansi analyse
- name: Mess Detector Sources
run: |
./vendor/bin/phpmd src text codesize,controversial,design,naming,unusedcode,design
Expand Down
68 changes: 42 additions & 26 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,53 @@
->in(__DIR__);

$rules = [
'@PSR2' => true,
'@Symfony' => true,
'@PhpCsFixer' => true,
'@PhpCsFixer:risky' => true,
'@PHPUnit75Migration:risky' => true,
'@PHP71Migration:risky' => true,
'php_unit_dedicate_assert' => ['target' => '5.6'],
'array_syntax' => ['syntax' => 'short'],
'no_superfluous_phpdoc_tags' => true,
'native_function_invocation' => false,
'concat_space' => ['spacing' => 'one'],
'phpdoc_types_order' => ['null_adjustment' => 'always_first', 'sort_algorithm' => 'alpha'],
'single_line_comment_style' => [
'comment_types' => ['hash'],
],
'phpdoc_summary' => false,
'cast_spaces' => ['space' => 'none'],
'binary_operator_spaces' => ['default' => null, 'operators' => ['=' => 'align_single_space_minimal', '=>' => 'align_single_space_minimal']],
'no_unused_imports' => true,
'ordered_imports' => ['sort_algorithm' => 'alpha', 'imports_order' => ['const', 'class', 'function']],
'phpdoc_to_comment' => false,
'native_constant_invocation' => false,
'fully_qualified_strict_types' => false,
'@PER-CS' => true,
'@Symfony' => true,
'@PhpCsFixer' => true,
'@PHPUnit100Migration:risky' => true,
'@PHP80Migration:risky' => true,
'@PHP82Migration' => true,
'no_superfluous_phpdoc_tags' => true,
'native_function_invocation' => false,
'concat_space' => ['spacing' => 'one'],
'phpdoc_types_order' => ['null_adjustment' => 'always_first', 'sort_algorithm' => 'alpha'],
'single_line_comment_style' => ['comment_types' => [ /* 'hash' */],],
'phpdoc_summary' => false,
'cast_spaces' => ['space' => 'none'],
'binary_operator_spaces' => ['default' => null, 'operators' => ['=' => 'align_single_space_minimal', '=>' => 'align_single_space_minimal_by_scope']],
'no_unused_imports' => true,
'ordered_imports' => ['sort_algorithm' => 'alpha', 'imports_order' => ['const', 'class', 'function']],
'control_structure_braces' => true,
'control_structure_continuation_position' => true,
'date_time_create_from_format_call' => true,
'date_time_immutable' => true,
'nullable_type_declaration_for_default_null_value' => true,
'phpdoc_line_span' => ['const' => 'single', 'method' => 'single', 'property' => 'single'],
'simplified_null_return' => true,
'statement_indentation' => true,
'blank_line_before_statement' => ['statements' => ['continue', 'declare', 'default', 'exit', 'goto', 'include', 'include_once', 'require', 'require_once', 'return', 'switch']],
'simplified_if_return' => true,
'use_arrow_functions' => false,
'fully_qualified_strict_types' => false,
'phpdoc_to_comment' => false,
];
if (version_compare(PHP_VERSION, '7.3.0', '>=')) {
$rules['@PHP73Migration'] = true;
}

$config = new PhpCsFixer\Config();
$config->setRiskyAllowed(true)
->setRules($rules)
->setFinder($finder);

if (class_exists('PhpCsFixer\Runner\Parallel\ParallelConfigFactory')) {
$config->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect());
}

if (false) {
$resolver = new \PhpCsFixer\Console\ConfigurationResolver($config, [], '', new \PhpCsFixer\ToolInfo());
echo "\n\n# DUMPING EFFECTIVE RULES #################\n";
var_export($resolver->getRules());
echo "\n\n###########################################\n";

die();
}

return $config;
12 changes: 4 additions & 8 deletions .provision/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
FROM php:7.4-cli
FROM php:8.0-cli

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

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

ENV PATH "$PATH:/home/app/.composer/vendor/bin"
ENV PATH "$PATH:/root/.composer/vendor/bin"

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

# WORKDIR /home/app/ # TODO app dir or var/www !?
WORKDIR /var/www/
5 changes: 2 additions & 3 deletions .provision/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
version: '3.6'
services:
php:
build:
context: .
image: php7.4-cli/phpstan-factory-rule
image: php8.0-cli/phpstan-factory-rule
volumes:
- ./..:/var/www
extra_hosts:
- "host.docker.internal:${XDEBUG_REMOTE_HOST:-127.0.0.1}"
environment:
PHP_IDE_CONFIG: "serverName=php-cli-74.local"
PHP_IDE_CONFIG: "serverName=php-cli-80.local"
26 changes: 13 additions & 13 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"name": "ebln/phpstan-factory-rule",
"type": "phpstan-extension",
"description": "PHPStan rule to enforce instanciation by factories",
"license": "MIT",
"type": "phpstan-extension",
"authors": [
{
"name": "ebln",
"email": "[email protected]"
}
],
"require": {
"php": "7.4 - 8.3",
"php": "7.4 - 8.4",
"ebln/phpstan-factory-mark": "^1.1",
"phpstan/phpstan": "^0.12 || ^1"
"phpstan/phpstan": "^1.11"
},
"require-dev": {
"ergebnis/composer-normalize": "^2.15",
Expand All @@ -21,6 +21,16 @@
"roave/security-advisories": "dev-latest",
"vimeo/psalm": "^4.12"
},
"autoload": {
"psr-4": {
"Ebln\\PHPStan\\EnforceFactory\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Test\\Ebln\\PHPStan\\EnforceFactory\\": "tests/"
}
},
"config": {
"allow-plugins": {
"ergebnis/composer-normalize": true
Expand All @@ -34,16 +44,6 @@
]
}
},
"autoload": {
"psr-4": {
"Ebln\\PHPStan\\EnforceFactory\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Test\\Ebln\\PHPStan\\EnforceFactory\\": "tests/"
}
},
"scripts": {
"coverage": "XDEBUG_MODE=coverage phpunit --coverage-html coverage --coverage-text --colors=auto && chown -R 1000:1000 coverage",
"quality": [
Expand Down
Loading
Loading