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

Commit

Permalink
Merge pull request #2 from symplify/move-source-here
Browse files Browse the repository at this point in the history
Move symplify/packages/package-builder source here
  • Loading branch information
samsonasik authored Feb 5, 2023
2 parents 613b6ac + 8481ba7 commit b38dd41
Show file tree
Hide file tree
Showing 16 changed files with 238 additions and 51 deletions.
6 changes: 5 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@
LICENSE export-ignore
phpunit.xml export-ignore
*.md export-ignore
docs/ export-ignore
docs/ export-ignore
/easy-ci.php export-ignore
/ecs.php export-ignore
/phpstan.neon export-ignore
/rector.php export-ignore
23 changes: 0 additions & 23 deletions .github/workflows/auto_closer.yaml

This file was deleted.

65 changes: 65 additions & 0 deletions .github/workflows/code_analysis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Code Analysis

on:
pull_request: null
push:
branches:
- main

env:
# see https://github.com/composer/composer/issues/9368#issuecomment-718112361
COMPOSER_ROOT_VERSION: "dev-main"

jobs:
code_analysis:
strategy:
fail-fast: false
matrix:
actions:
-
name: 'PHPStan'
run: composer phpstan --ansi

-
name: 'Composer Validate'
run: composer validate --ansi

-
name: 'Rector'
run: composer rector --ansi

-
name: 'Coding Standard'
run: composer fix-cs --ansi

-
name: 'Tests'
run: vendor/bin/phpunit

-
name: 'PHP Linter'
run: vendor/bin/parallel-lint src tests

-
name: 'Check Commented Code'
run: vendor/bin/easy-ci check-commented-code src tests --ansi

-
name: 'Check Active Classes'
run: vendor/bin/easy-ci check-active-class src --ansi

name: ${{ matrix.actions.name }}
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
# see https://github.com/shivammathur/setup-php
- uses: shivammathur/setup-php@v2
with:
php-version: 8.1
coverage: none

# composer install cache - https://github.com/ramsey/composer-install
- uses: "ramsey/composer-install@v2"

- run: ${{ matrix.actions.run }}
43 changes: 24 additions & 19 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,16 @@
"symfony/finder": "^6.2"
},
"require-dev": {
"symplify/symplify-kernel": "^11.2",
"phpunit/phpunit": "^9.5.26"
"php-parallel-lint/php-parallel-lint": "^1.3",
"phpstan/extension-installer": "^1.2",
"phpunit/phpunit": "^9.5.26",
"rector/rector": "^0.15.10",
"symplify/easy-ci": "^11.1",
"symplify/easy-coding-standard": "^11.1",
"symplify/phpstan-extensions": "^11.1",
"symplify/phpstan-rules": "11.2.3.72",
"symplify/symplify-kernel": "^11.1",
"tomasvotruba/unused-public": "^0.0.34"
},
"autoload": {
"psr-4": {
Expand All @@ -30,23 +38,20 @@
"dev-main": "11.2-dev"
}
},
"conflict": {
"symplify/phpstan-rules": "<11.1.24",
"symplify/rule-doc-generator-contracts": "<11.1.25",
"symplify/php-config-printer": "<11.1.25",
"symplify/autowire-array-parameter": "<11.1.25",
"symplify/phpstan-extensions": "<11.1.25",
"symplify/rule-doc-generator": "<11.1.25",
"symplify/smart-file-system": "<11.1.25",
"symplify/symfony-static-dumper": "<11.1.25",
"symplify/config-transformer": "<11.1.24",
"symplify/coding-standard": "<11.1.24",
"symplify/easy-parallel": "<11.1.25",
"symplify/easy-testing": "<11.1.25",
"symplify/symplify-kernel": "<11.1.25",
"symplify/easy-ci": "<11.1.24",
"symplify/monorepo-builder": "<11.1.24"
"scripts": {
"check-cs": "vendor/bin/ecs check --ansi",
"fix-cs": "vendor/bin/ecs check --fix --ansi",
"phpstan": "vendor/bin/phpstan analyse --ansi --error-format symplify",
"rector": "vendor/bin/rector process --dry-run --ansi"
},
"minimum-stability": "dev",
"prefer-stable": true
"prefer-stable": true,
"config": {
"sort-packages": true,
"platform-check": false,
"allow-plugins": {
"cweagans/composer-patches": true,
"phpstan/extension-installer": true
}
}
}
12 changes: 12 additions & 0 deletions easy-ci.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

use Symplify\PackageBuilder\DependencyInjection\CompilerPass\AutowireInterfacesCompilerPass;
use Symplify\EasyCI\Config\EasyCIConfig;

return static function (EasyCIConfig $easyCIConfig): void {
$easyCIConfig->typesToSkip([
AutowireInterfacesCompilerPass::class,
]);
};
21 changes: 21 additions & 0 deletions ecs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

use Symplify\EasyCodingStandard\Config\ECSConfig;
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;

return static function (ECSConfig $ecsConfig): void {
$ecsConfig->paths([
__DIR__ . '/ecs.php',
__DIR__ . '/rector.php',
__DIR__ . '/easy-ci.php',
__DIR__ . '/src',
__DIR__ . '/tests',
]);

$ecsConfig->sets([
SetList::COMMON,
SetList::PSR_12,
]);
};
46 changes: 46 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
parameters:
ignoreErrors:
-
message: "#^Parameter \\#1 \\$path of function dirname expects string, string\\|false given\\.$#"
count: 1
path: src/Composer/VendorDirProvider.php

-
message: "#^Call to an undefined method Symfony\\\\Component\\\\DependencyInjection\\\\ContainerInterface\\:\\:getParameterBag\\(\\)\\.$#"
count: 1
path: src/Parameter/ParameterProvider.php

-
message: "#^Parameter \\#1 \\$objectOrClass of class ReflectionClass constructor expects class\\-string\\<T of object\\>\\|T of object, string given\\.$#"
count: 1
path: src/Reflection/ClassLikeExistenceChecker.php

-
message: "#^Parameter \\#1 \\$objectOrClass of class ReflectionClass constructor expects class\\-string\\<T of object\\>\\|T of object, string given\\.$#"
count: 2
path: src/Reflection/PrivatesCaller.php

-
message: "#^Call to method setConfigs\\(\\) on an unknown class Symplify\\\\PackageBuilder\\\\Contract\\\\HttpKernel\\\\ExtraConfigAwareKernelInterface\\.$#"
count: 1
path: src/Testing/AbstractKernelTestCase.php

-
message: "#^Class Symplify\\\\PackageBuilder\\\\Contract\\\\HttpKernel\\\\ExtraConfigAwareKernelInterface not found\\.$#"
count: 2
path: src/Testing/AbstractKernelTestCase.php

-
message: "#^PHPDoc tag @var for variable \\$kernel contains unknown class Symplify\\\\PackageBuilder\\\\Contract\\\\HttpKernel\\\\ExtraConfigAwareKernelInterface\\.$#"
count: 1
path: src/Testing/AbstractKernelTestCase.php

-
message: "#^Parameter \\#1 \\$kernel of method Symplify\\\\PackageBuilder\\\\Testing\\\\AbstractKernelTestCase\\:\\:bootAndReturnKernel\\(\\) expects Symfony\\\\Component\\\\HttpKernel\\\\KernelInterface, Symplify\\\\PackageBuilder\\\\Contract\\\\HttpKernel\\\\ExtraConfigAwareKernelInterface given\\.$#"
count: 1
path: src/Testing/AbstractKernelTestCase.php

-
message: "#^Static property Symplify\\\\PackageBuilder\\\\Testing\\\\AbstractKernelTestCase\\:\\:\\$container \\(Symfony\\\\Component\\\\DependencyInjection\\\\ContainerInterface\\|null\\) does not accept Psr\\\\Container\\\\ContainerInterface\\.$#"
count: 2
path: src/Testing/AbstractKernelTestCase.php
21 changes: 21 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
includes:
- phpstan-baseline.neon

parameters:
level: 8

paths:
- src
- tests

excludePaths:
- '*/tests/**/Source/*'
- '*/tests/**/Fixture/*'
- '*/tests/**/data/*'

unused_public:
methods: true
properties: true
constants: true

ignoreErrors:
34 changes: 34 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->sets([
SetList::CODE_QUALITY,
SetList::DEAD_CODE,
LevelSetList::UP_TO_PHP_81,
SetList::CODING_STYLE,
SetList::TYPE_DECLARATION,
SetList::NAMING,
SetList::PRIVATIZATION,
SetList::EARLY_RETURN,
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
]);

$rectorConfig->paths([
__DIR__ . '/src',
__DIR__ . '/tests',
]);

$rectorConfig->importNames();

$rectorConfig->skip([
'*/Source/*',
'*/Fixture/*',
]);
};
2 changes: 1 addition & 1 deletion src/Console/Formatter/ColorConsoleDiffFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ final class ColorConsoleDiffFormatter
*/
private const NEWLINES_REGEX = "#\n\r|\n#";

private string $template;
private readonly string $template;

public function __construct()
{
Expand Down
4 changes: 2 additions & 2 deletions src/Console/Output/ConsoleDiffer.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
final class ConsoleDiffer
{
public function __construct(
private Differ $differ,
private ColorConsoleDiffFormatter $colorConsoleDiffFormatter
private readonly Differ $differ,
private readonly ColorConsoleDiffFormatter $colorConsoleDiffFormatter
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Console/Style/SymfonyStyleFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
final class SymfonyStyleFactory
{
private PrivatesCaller $privatesCaller;
private readonly PrivatesCaller $privatesCaller;

public function __construct()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class AutowireInterfacesCompilerPass implements CompilerPassInterface
* @param string[] $typesToAutowire
*/
public function __construct(
private array $typesToAutowire
private readonly array $typesToAutowire
) {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/
final class ParameterMergingPhpFileLoader extends PhpFileLoader
{
private ParametersMerger $parametersMerger;
private readonly ParametersMerger $parametersMerger;

public function __construct(ContainerBuilder $containerBuilder, FileLocatorInterface $fileLocator)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
final class CompleteUnifiedDiffOutputBuilderFactory
{
public function __construct(
private PrivatesAccessor $privatesAccessor
private readonly PrivatesAccessor $privatesAccessor
) {
}

Expand Down
4 changes: 3 additions & 1 deletion src/Strings/StringFormatConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ private function camelCaseToGlue(string $input, string $glue): string

$parts = [];
foreach ($matches as $match) {
$parts[] = $match[0] === strtoupper($match[0]) ? strtolower($match[0]) : lcfirst($match[0]);
$parts[] = $match[0] === strtoupper((string) $match[0]) ? strtolower($match[0]) : lcfirst(
(string) $match[0]
);
}

return implode($glue, $parts);
Expand Down

0 comments on commit b38dd41

Please sign in to comment.