Skip to content

Commit

Permalink
Merge 7ff8a85 into d100b43
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-georgiev committed May 31, 2020
2 parents d100b43 + 7ff8a85 commit 318c886
Show file tree
Hide file tree
Showing 14 changed files with 158 additions and 186 deletions.
110 changes: 0 additions & 110 deletions .php_cs

This file was deleted.

16 changes: 5 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,18 @@ cache:
- $HOME/.composer/cache

php:
- 7.1
- 7.2
- 7.3
- 7.4
- nightly

env:
global:
- LATEST_PHP_VERSION="7.3"
- LATEST_PHP_VERSION="7.4"
matrix:
- SYMFONY_VERSION="2.8.*"
- SYMFONY_VERSION="3.4.*"
- SYMFONY_VERSION="4.1.*"
- SYMFONY_VERSION="4.2.*"
- SYMFONY_VERSION="4.3.*"
- SYMFONY_VERSION="4.4.*"
- SYMFONY_VERSION="dev-master"
- DEPENDENCIES="beta"
- DEPENDENCIES="low"
Expand Down Expand Up @@ -57,15 +56,10 @@ install:
fi;

script:
- if [ "$(phpenv version-name)" != "$LATEST_PHP_VERSION" ]; then
echo "File validation is skipped for older PHP versions";
else
composer validate-files;
fi;
- if [ "$(phpenv version-name)" != "$LATEST_PHP_VERSION" ]; then
echo "Static analysis is skipped for older PHP versions";
else
composer run-static-analysis-including-tests;
composer run-static-analysis;
fi;
- if [ "$(phpenv version-name)" != "$LATEST_PHP_VERSION" ]; then
echo "Code style check is skipped for older PHP versions";
Expand Down
18 changes: 18 additions & 0 deletions ci/deptrac/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
paths:
- ./src
- ./tests

layers:
- name: Bundle
collectors:
- type: className
regex: \\MartinGeorgiev\\SocialPostBundle\\.*
- name: Tests
collectors:
- type: className
regex: \\Tests\\MartinGeorgiev\\SocialPostBundle\\.*

ruleset:
Bundle: ~
Tests:
- Bundle
52 changes: 52 additions & 0 deletions ci/php-cs-fixer/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php

declare(strict_types=1);

$rootDirectory = __DIR__.'/../../';

$finder = PhpCsFixer\Finder::create()
->in($rootDirectory.'/src')
->in($rootDirectory.'/tests');

return PhpCsFixer\Config::create()
->setRules(
[
'@PSR2' => true,
'@PHP56Migration' => true,
'@PHP70Migration' => true,
'@PHP71Migration' => true,
'@DoctrineAnnotation' => true,
'@PhpCsFixer' => true,
'align_multiline_comment' => false,
'array_syntax' => ['syntax' => 'short'],
'backtick_to_shell_exec' => true,
'blank_line_before_statement' => ['statements' => ['break', 'declare', 'continue', 'declare', 'die', 'do', 'exit', 'return', 'throw', 'try', 'while']],
'cast_spaces' => ['space' => 'single'],
'concat_space' => ['spacing' => 'none'],
'date_time_immutable' => true,
'declare_equal_normalize' => ['space' => 'none'],
'increment_style' => ['style' => 'post'],
'linebreak_after_opening_tag' => true,
'list_syntax' => ['syntax' => 'short'],
'mb_str_functions' => false,
'method_chaining_indentation' => true,
'multiline_whitespace_before_semicolons' => false,
'native_function_invocation' => ['include' => ['@all']],
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true],
'non_printable_character' => false,
'ordered_class_elements' => ['order' => ['use_trait', 'constant', 'property', 'construct', 'magic', 'method']],
'php_unit_internal_class' => false,
'php_unit_method_casing' => ['case' => 'snake_case'],
'php_unit_test_class_requires_covers' => false,
'phpdoc_types_order' => ['null_adjustment' => 'always_last'],
'simplified_null_return' => false,
'single_line_comment_style' => false,
'static_lambda' => true,
'yoda_style' => false,
]
)
->setRiskyAllowed(true)
->setUsingCache(false)
->setIndent(" ")
->setLineEnding("\n")
->setFinder($finder);
15 changes: 15 additions & 0 deletions ci/phpstan/config.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
includes:
- %rootDir%/../../../vendor/phpstan/phpstan-phpunit/extension.neon
- %rootDir%/../../../vendor/slam/phpstan-extensions/conf/slam-rules.neon
- %rootDir%/../../../vendor/slam/phpstan-extensions/conf/symfony-rules.neon

parameters:
checkMissingIterableValueType: false
reportUnmatchedIgnoredErrors: false
inferPrivatePropertyTypeFromConstructor: true

ignoreErrors:
- '#Cannot call method scalarNode() on Symfony\\Component\\Config\\Definition\\Builder\\NodeParentInterface|null#'
- '#Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition::children().#'
- '#Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\TreeBuilder::root().#'
- '#Class Symfony\\Component\\Config\\Definition\\Builder\\TreeBuilder constructor invoked with 0 parameters, 1-3 required.#'
6 changes: 3 additions & 3 deletions phpunit.xml → ci/phpunit/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
convertNoticesToExceptions="false"
convertWarningsToExceptions="true"
stopOnFailure="false"
bootstrap="vendor/autoload.php"
bootstrap="../../vendor/autoload.php"
verbose="true">

<testsuites>
<testsuite name="SocialPost Bundle Test Suite">
<directory>./tests</directory>
<directory>../../tests</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory suffix=".php">./src</directory>
<directory suffix=".php">../../src</directory>
</whitelist>
</filter>

Expand Down
35 changes: 15 additions & 20 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "martin-georgiev/social-post-bundle",
"type": "symfony-bundle",
"description": "Symfony bundle for simultaneous posting of the same message to Facebook, LinkedIn and Twitter",
"keywords": ["martin georgiev", "symfony3", "symfony4", "bundle", "facebook", "twitter", "linkedin", "twitteroauth", "facabook sdk for php", "post update", "social network", "php7"],
"keywords": ["martin georgiev", "symfony", "bundle", "facebook", "twitter", "linkedin", "twitteroauth", "facabook sdk for php", "post update", "social network", "php7"],
"minimum-stability": "stable",
"license": "MIT",

Expand All @@ -25,47 +25,42 @@
},

"require": {
"php": "^7.1",
"php": "^7.2",
"martin-georgiev/social-post": "^1.0",
"symfony/framework-bundle": "^3.0|^4.1.12",
"symfony/yaml": "^3.0|^4.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.14",
"jakub-onderka/php-parallel-lint": "^1.0",
"php-coveralls/php-coveralls": "^2.1",
"phpstan/phpstan": "^0.11",
"phpstan/phpstan-phpunit": "^0.11",
"phpunit/phpunit": "^7.5|^8.1",
"friendsofphp/php-cs-fixer": "^2.16",
"php-coveralls/php-coveralls": "^2.2",
"phpstan/phpstan": "^0.12",
"phpstan/phpstan-phpunit": "^0.12",
"phpunit/phpunit": "^8.5",
"sensiolabs-de/deptrac-shim": "^0.7.1",
"sensiolabs/security-checker": "^6.0",
"slam/phpstan-extensions": "^5.0",
"symfony/phpunit-bridge": "^3.0|^4.0"
},

"scripts": {
"check-code-style": [
"php-cs-fixer fix --config='./.php_cs' --show-progress=none --dry-run --no-interaction --diff -v"
"php-cs-fixer fix --config='./ci/php-cs-fixer/config.php' --show-progress=none --dry-run --no-interaction --diff -v"
],
"check-security": [
"security-checker security:check"
],
"fix-code-style": [
"php-cs-fixer fix --config='./.php_cs' --show-progress=none --no-interaction --diff -v"
"php-cs-fixer fix --config='./ci/php-cs-fixer/config.php' --show-progress=none --no-interaction --diff -v"
],
"run-static-analysis": [
"phpstan analyse --level=7 src/"
],
"run-static-analysis-including-tests": [
"@run-static-analysis",
"phpstan analyse --level=7 tests/"
"phpstan analyse --configuration='./ci/phpstan/config.neon' --no-progress --level=8 src/ tests/",
"deptrac analyze './ci/deptrac/config.yml' --no-interaction --no-progress"
],
"run-tests": [
"phpunit"
"phpunit --configuration='./ci/phpunit/config.xml'"
],
"run-tests-with-clover": [
"phpunit --coverage-clover build/logs/clover.xml"
],
"validate-files": [
"parallel-lint --exclude vendor --exclude bin ."
"phpunit --configuration='./ci/phpunit/config.xml' --coverage-clover './build/logs/clover.xml'"
]
},

Expand Down
12 changes: 0 additions & 12 deletions phpstan.neon

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@

/**
* @since 1.0.0
*
* @license https://opensource.org/licenses/MIT
* @link https://github.com/martin-georgiev/social-post-bundle
*
* @see https://github.com/martin-georgiev/social-post-bundle
*/
class AllInOnePass implements CompilerPassInterface
{
Expand All @@ -25,10 +27,10 @@ public function process(ContainerBuilder $container): void
foreach ($publishOn as $provider) {
$serviceName = 'social_post.'.$provider;
if (!$container->has($serviceName)) {
throw new OutOfBoundsException(sprintf('Cannot find service %s when injecting dependencies for "social_post"', $serviceName));
throw new OutOfBoundsException(\sprintf('Cannot find service %s when injecting dependencies for "social_post"', $serviceName));
}
if (!$container->get($serviceName) instanceof Publisher) {
throw new InvalidArgumentException(sprintf('Service %s should be an instance of %s', $serviceName, Publisher::class));
throw new InvalidArgumentException(\sprintf('Service %s should be an instance of %s', $serviceName, Publisher::class));
}
$definition->addArgument(new Reference($serviceName));
}
Expand Down

0 comments on commit 318c886

Please sign in to comment.