Skip to content
This repository has been archived by the owner on Mar 1, 2023. It is now read-only.

fix : fixed naming of the config files #801

Open
wants to merge 11 commits into
base: master
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
27 changes: 27 additions & 0 deletions .build/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"description": "tools",
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"narrowspark/coding-standard": "^4.0.0",
"wikimedia/composer-merge-plugin": "^1.4.1"
},
"extra": {
"merge-plugin": {
"include": [
"../composer.json"
],
"merge-extra": false,
"merge-scripts": false
}
},
"scripts": {
"changelog": "changelog-generator generate --config=\"./../.changelog\" --file --prepend",
"cs": "php-cs-fixer fix --config=\"./../.php_cs\"",
"cs:check": "php-cs-fixer fix --config=\"./../.php_cs\" --dry-run",
"phpstan": "phpstan analyse -c ./../phpstan.neon",
"psalm": "psalm --threads=$(nproc)",
"psalm:fix": "psalm --alter --issues=all --threads=$(nproc)",
"infection": "infection --configuration=\"./../infection.json\" -j$(nproc)"
}
}
7 changes: 7 additions & 0 deletions .build/travis/configure_php.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

if [[ "$REMOVE_XDEBUG" = true ]]; then
phpenv config-rm xdebug.ini;
fi

echo date.timezone = Europe/Berlin >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
79 changes: 79 additions & 0 deletions .build/update-mirror-classes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/usr/bin/env php
<?php

$rootDir = \dirname(__DIR__, 1);

require $rootDir . '/vendor/symfony/filesystem/Exception/ExceptionInterface.php';

require $rootDir . '/vendor/symfony/filesystem/Exception/IOExceptionInterface.php';

require $rootDir . '/vendor/symfony/filesystem/Exception/IOException.php';

require $rootDir . '/vendor/symfony/filesystem/Filesystem.php';

require $rootDir . '/tests/AutoReview/MirrorSettings.php';

use Narrowspark\Automatic\Test\AutoReview\MirrorSettings;
use Symfony\Component\Filesystem\Filesystem;

$fs = new Filesystem();

$comment = MirrorSettings::COMMENT_STRING;

$regex = '/namespace ([a-zA-z]*)/s';
$aliasList = [];

foreach (MirrorSettings::MIRROR_LIST as $list) {
$outputSettings = $list['output'];

// remove output folder before creating new files.
$fs->remove($rootDir . \DIRECTORY_SEPARATOR . $outputSettings['path']);

foreach ($list['mirror_list'] as $path => $settings) {
$preparedOutputPath = \str_replace("/{$settings['path']}/", '/' . $outputSettings['path'].$settings['path'] . '/', $path);

$fs->copy($path, $preparedOutputPath, true);

$content = \file_get_contents($preparedOutputPath);
$content = \str_replace(["\nclass", "\nabstract class", "\ninterface"], ["\n{$comment}\nclass", "\n{$comment}\nabstract class", "\n{$comment}\ninterface"], $content);

$mirrorContent = \str_replace($settings['namespace'], $outputSettings['namespace'], $content);

\preg_match($regex, $content, $matches, \PREG_OFFSET_CAPTURE, 0);
\preg_match($regex, $mirrorContent, $mirrorMatches, \PREG_OFFSET_CAPTURE, 0);
\preg_match('/(abstract class |final class |class |interface |trait )([A-z]*)/s', $content, $classMatches, \PREG_OFFSET_CAPTURE, 0);

if (! array_key_exists($outputSettings['path'], $aliasList)) {
$aliasList[$outputSettings['path']] = [];
}

$aliasList[$outputSettings['path']][] = '\class_alias(' . $mirrorMatches[1][0] . '\\' . $classMatches[2][0] . '::class, ' . $matches[1][0] . '\\' . $classMatches[2][0] . '::class);' . "\n";

$fs->dumpFile($preparedOutputPath, $mirrorContent);

echo "Dumped {$preparedOutputPath}.\n";

$mirrorContent = $content = $matches = $mirrorMatches = null;
}
}

echo "\n";

$header = <<<'EOF'
/**
* This file is part of Narrowspark Framework.
*
* (c) Daniel Bannert <[email protected]>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
EOF;

foreach ($aliasList as $output => $aliases) {
$preparedOutputPath = 'src/'.rtrim($output, '/').'/alias.php';

$fs->dumpFile($rootDir . DIRECTORY_SEPARATOR . $preparedOutputPath, "<?php\n\ndeclare(strict_types=1);\n\n" . $header . "\n\n" . implode('', $aliases));

echo "Dumped {$preparedOutputPath}.\n";
}
2 changes: 1 addition & 1 deletion .github/SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Security Policy
===============

If you found any issues that might have security implications,
please send a report to security[at]symfony.com
please send a report to security[at]narrowspark.com
DO NOT PUBLISH SECURITY REPORTS PUBLICLY.

The full [Security Policy][1] is described in the official documentation.
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@ jobs:
fetch-depth: 2

- name: "Setup PHP"
uses: shivammathur/setup-php@1.8.2
uses: shivammathur/setup-php@2.1.0
with:
php-version: "7.4"
extensions: mbstring, xml, ctype, iconv, zip, dom, fileinfo, intl, sodium, curl, pdo, pdo_sqlite, inotify, pcntl, posix, xdebug
php-version: "7.4.2"
extensions: mbstring, xml, ctype, iconv, zip, dom, fileinfo, intl, sodium, curl, pdo, pdo_sqlite, inotify, pcntl, posix
ini-values: pcov.directory=api, date.timezone=Europe/Berlin, opcache.enable_cli=1, serialize_precision=14
coverage: none
pecl: true
tools: composer, composer-prefetcher
coverage: pcov
tools: composer, composer-prefetcher, pecl

- name: Install Xdebug
run: sudo pecl install -f xdebug-2.9.0
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/coding-standard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,19 @@ jobs:
fetch-depth: 2

- name: Setup PHP
uses: shivammathur/setup-php@1.8.2
uses: shivammathur/setup-php@2.1.0
with:
php-version: 7.4
php-version: "7.4.2"
extensions: mbstring, xml, ctype, iconv, zip, dom, fileinfo
tools: composer, composer-prefetcher, cs2pr

- name: "Install Narrowspark coding standard and Annotate a Github Pull Request"
run: composer global require narrowspark/coding-standard:3.4.0 --no-interaction --no-progress --profile --no-suggest --optimize-autoloader
- name: "Install Narrowspark coding standard"
run: |
composer global require narrowspark/coding-standard:3.4.0 --no-interaction --no-progress --profile --no-suggest --optimize-autoloader
# can be removed if bug with ClassAttributesSeparationFixer is fixed in newer version
composer global require friendsofphp/php-cs-fixer:2.16.x-dev

- name: "lint php code"
run: |
cd $GITHUB_WORKSPACE
/home/runner/.composer/vendor/bin/php-cs-fixer fix --config=$GITHUB_WORKSPACE/.php_cs -v --dry-run --stop-on-violation --format=checkstyle | cs2pr
/home/runner/.composer/vendor/bin/php-cs-fixer fix --config=$GITHUB_WORKSPACE/.php_cs -v --dry-run --format=checkstyle | cs2pr
7 changes: 3 additions & 4 deletions .github/workflows/continuous-integration-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: ["7.4"]
php-versions: ["7.4.2"]
dependencies: ["highest", "lowest"]

name: "PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }} OS and with ${{ matrix.dependencies }} dependencies"
Expand All @@ -26,14 +26,13 @@ jobs:
fetch-depth: 2

- name: "Setup PHP"
uses: shivammathur/setup-php@1.8.2
uses: shivammathur/setup-php@2.1.0
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, xml, ctype, iconv, zip, dom, fileinfo, intl, sodium, curl, pdo, pdo_sqlite, inotify, pcntl, posix
ini-values: post_max_size=256M, date.timezone=Europe/Berlin, opcache.enable_cli=1, serialize_precision=14
pecl: true
coverage: none
tools: composer, composer-prefetcher
tools: composer, composer-prefetcher, pecl

- name: "Configure Container"
env:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/continuous-integration-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
fail-fast: false
matrix:
operating-system: [windows-latest]
php-versions: ["7.4"]
php-versions: ["7.4.2"]
dependencies: ["highest", "lowest"]

name: "PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }} OS and with ${{ matrix.dependencies }} dependencies"
Expand All @@ -26,13 +26,13 @@ jobs:
fetch-depth: 2

- name: "Setup PHP"
uses: shivammathur/setup-php@1.8.2
uses: shivammathur/setup-php@2.1.0
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, xml, ctype, iconv, zip, dom, fileinfo, intl, sodium, curl, pdo, pdo_sqlite
ini-values: post_max_size=256M, date.timezone=Europe/Berlin, opcache.enable_cli=1, serialize_precision=14
pecl: true
tools: composer, composer-prefetcher
coverage: none
tools: composer, composer-prefetcher, pecl

- name: "Configure container"
env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/php-audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
max-parallel: 2
matrix:
operating-system: [ubuntu-latest]
php-versions: ["7.4"]
php-versions: ["7.4.2"]
dependencies: ["highest", "lowest"]

name: "Audit on PHP ${{ matrix.php-versions }} and ${{ matrix.operating-system }} OS"
Expand All @@ -27,7 +27,7 @@ jobs:
fetch-depth: 2

- name: Setup PHP
uses: shivammathur/setup-php@1.8.2
uses: shivammathur/setup-php@2.1.0
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, xml, ctype, iconv, zip, dom, fileinfo, intl, sodium, curl, pdo, pdo_sqlite, inotify, pcntl, posix
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/static-analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,11 @@ jobs:
fetch-depth: 2

- name: "Setup PHP"
uses: shivammathur/setup-php@1.8.2
uses: shivammathur/setup-php@2.1.0
with:
php-version: 7.4
php-version: "7.4.2"
extensions: mbstring, xml, ctype, iconv, zip, dom, fileinfo, intl, inotify, pcntl, posix
pecl: true
tools: composer, composer-prefetcher, cs2pr
tools: composer, composer-prefetcher, cs2pr, pecl

- name: "Configure Container"
env:
Expand Down Expand Up @@ -105,4 +104,4 @@ jobs:
$COMPOSER_UP
echo ::endgroup::

./vendor/bin/phpstan analyse -c ./phpstan.neon --memory-limit=-1 --error-format=checkstyle | cs2pr
php -d memory_limit=-1 vendor/bin/phpstan analyse --error-format=checkstyle | cs2pr
30 changes: 20 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,36 @@
# Ignoring those within your global gitignore will make it so
# they will never get commited within any project you have.

.php_cs.cache
composer.phar
/composer.lock

.php_cs.cache
.phpunit.result.cache
.phpunit.xdebug.filter

.textlintcache
.phpunit.xdebug-filter.php

infection.log

composer.phar
composer.lock
/.build/infection/
!/.build/infection/.gitkeep
/.build/php-cs-fixer/
!/.build/php-cs-fixer/.gitkeep
/.build/phpstan/
!/.build/phpstan/.gitkeep
/.build/phpunit/
!/.build/phpunit/.gitkeep
/.build/psalm/
!/.build/psalm/.gitkeep

/.build/composer.lock
/.build/vendor
/.build/logs/

/build/logs/
/build/vendor/
/vendor/
/node_modules/

/benchmark/cache/

/vendor
/.tmp
/node_modules

/src/Viserio/Component/Foundation/Tests/Fixture/storage
/src/Viserio/Component/HttpFoundation/Tests/Fixture/storage
Expand Down
8 changes: 0 additions & 8 deletions .mergify.yml

This file was deleted.

45 changes: 27 additions & 18 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
<?php
use Narrowspark\CS\Config\Config;

$header = <<<'EOF'
This file is part of Narrowspark Framework.

(c) Daniel Bannert <[email protected]>
declare(strict_types=1);

This source file is subject to the MIT license that is bundled
with this source code in the file LICENSE.
EOF;
use Ergebnis\License;
use Narrowspark\CS\Config\Config;

$config = new Config($header, [
$license = static function ($path) {
return License\Type\MIT::markdown(
$path . '/LICENSE.md',
License\Range::since(
License\Year::fromString('2018'),
new \DateTimeZone('UTC')
),
License\Holder::fromString('Daniel Bannert'),
License\Url::fromString('https://github.com/narrowspark/automatic')
);
};

$mainLicense = $license(__DIR__);
$mainLicense->save();

$config = new Config($mainLicense->header(), [
'native_function_invocation' => [
'exclude' => [
'fread',
Expand All @@ -25,19 +35,18 @@ $config = new Config($header, [
'glob',
],
],
'static_lambda' => false,
'final_public_method_for_abstract_class' => false,
'final_class' => false,
'phpdoc_to_return_type' => false,
// both are needed
'date_time_immutable' => false,
// @todo waiting for php-cs-fixer 2.16.2
'global_namespace_import' => [
'import_classes' => true,
'import_constants' => false,
'import_functions' => false,
],
'static_lambda' => false,
'final_class' => false,
'heredoc_indentation' => false,
'PhpCsFixerCustomFixers/no_commented_out_code' => false,
'PhpCsFixerCustomFixers/phpdoc_no_superfluous_param' => false,
'phpdoc_to_return_type' => false,
'php_unit_ordered_covers' => true,
'ordered_class_elements' => true,
]
]);

$config->getFinder()
Expand Down
Loading