Skip to content
This repository has been archived by the owner on Nov 21, 2022. It is now read-only.

Commit

Permalink
update dependencies (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
mimmi20 committed Nov 11, 2021
1 parent b8dd2fd commit 06c0848
Show file tree
Hide file tree
Showing 20 changed files with 128 additions and 68 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:

steps:
- name: "Checkout"
uses: "actions/checkout@v2.3.5"
uses: "actions/checkout@v2.4.0"

- name: "Install PHP"
uses: "shivammathur/[email protected]"
Expand Down Expand Up @@ -77,7 +77,7 @@ jobs:

steps:
- name: "Checkout"
uses: "actions/checkout@v2.3.5"
uses: "actions/checkout@v2.4.0"

- name: "Install PHP"
uses: "shivammathur/[email protected]"
Expand Down Expand Up @@ -129,7 +129,7 @@ jobs:

steps:
- name: "Checkout"
uses: "actions/checkout@v2.3.5"
uses: "actions/checkout@v2.4.0"

- name: "Install PHP"
uses: "shivammathur/[email protected]"
Expand Down Expand Up @@ -181,7 +181,7 @@ jobs:

steps:
- name: "Checkout"
uses: "actions/checkout@v2.3.5"
uses: "actions/checkout@v2.4.0"

- name: "Install PHP"
uses: "shivammathur/[email protected]"
Expand Down Expand Up @@ -231,7 +231,7 @@ jobs:

steps:
- name: "Checkout"
uses: "actions/checkout@v2.3.5"
uses: "actions/checkout@v2.4.0"

- name: "Install PHP"
uses: "shivammathur/[email protected]"
Expand Down Expand Up @@ -283,7 +283,7 @@ jobs:

steps:
- name: "Checkout"
uses: "actions/checkout@v2.3.5"
uses: "actions/checkout@v2.4.0"

- name: "Install PHP"
uses: "shivammathur/[email protected]"
Expand Down Expand Up @@ -337,7 +337,7 @@ jobs:

steps:
- name: "Checkout"
uses: "actions/checkout@v2.3.5"
uses: "actions/checkout@v2.4.0"

- name: "Install PHP"
uses: "shivammathur/[email protected]"
Expand Down Expand Up @@ -392,7 +392,7 @@ jobs:

steps:
- name: "Checkout"
uses: "actions/checkout@v2.3.5"
uses: "actions/checkout@v2.4.0"

- name: "Install PHP"
uses: "shivammathur/[email protected]"
Expand Down Expand Up @@ -460,7 +460,7 @@ jobs:

steps:
- name: "Checkout"
uses: "actions/checkout@v2.3.5"
uses: "actions/checkout@v2.4.0"

- name: "Install PHP"
uses: "shivammathur/[email protected]"
Expand Down Expand Up @@ -531,7 +531,7 @@ jobs:

steps:
- name: "Checkout"
uses: "actions/checkout@v2.3.5"
uses: "actions/checkout@v2.4.0"

- name: "Install PHP"
uses: "shivammathur/[email protected]"
Expand Down Expand Up @@ -602,7 +602,7 @@ jobs:

steps:
- name: "Checkout"
uses: "actions/checkout@v2.3.5"
uses: "actions/checkout@v2.4.0"

- name: "Install PHP"
uses: "shivammathur/[email protected]"
Expand Down Expand Up @@ -670,7 +670,7 @@ jobs:

steps:
- name: "Checkout"
uses: "actions/checkout@v2.3.5"
uses: "actions/checkout@v2.4.0"

- name: "Install PHP"
uses: "shivammathur/[email protected]"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: "actions/checkout@v2.3.5"
- uses: "actions/checkout@v2.4.0"
- uses: "micnncim/[email protected]"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
27 changes: 0 additions & 27 deletions .github/workflows/stale.yml

This file was deleted.

8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"require-dev": {
"actived/microsoft-teams-notifier": "^1.1.0",
"aws/aws-sdk-php": "^3.199.7",
"aws/aws-sdk-php": "^3.202.0",
"bartlett/monolog-callbackfilterhandler": "^2.0.0",
"cmdisp/monolog-microsoft-teams": "^1.2.0",
"doctrine/couchdb": "1.0.0-beta4",
Expand All @@ -35,9 +35,9 @@
"php-amqplib/php-amqplib": "^3.1.0",
"php-console/php-console": "^3.1.8",
"phpstan/extension-installer": "^1.1.0",
"phpstan/phpstan": "^0.12.99",
"phpstan/phpstan-deprecation-rules": "^0.12.6",
"phpstan/phpstan-phpunit": "^0.12.22",
"phpstan/phpstan": "^1.1.2",
"phpstan/phpstan-deprecation-rules": "^1.0.0",
"phpstan/phpstan-phpunit": "^1.0.0",
"phpunit/phpunit": "^9.5.10",
"predis/predis": "^1.1.9",
"rollbar/rollbar": "^2.1.0",
Expand Down
7 changes: 4 additions & 3 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
parameters:
level: max
level: 8
parallel:
maximumNumberOfProcesses: 1
processTimeout: 200.0
Expand All @@ -13,20 +13,21 @@ parameters:
checkGenericClassInNonGenericObjectType: false
checkMissingIterableValueType: false
treatPhpDocTypesAsCertain: false
implicitThrows: false
exceptions:
implicitThrows: false
checkedExceptionRegexes:
- '#Exception#'
- '#Throwable#'
check:
missingCheckedExceptionInThrows: true
tooWideThrowType: true
ignoreErrors:
- '~is not subtype of Throwable~'
- '~Dead catch~'
- '~Call to an undefined method Laminas\\ModuleManager\\ModuleManagerInterface::getEvent~'
- '~MongoDB\\Client~'
- '~Call to deprecated method getType\(\) of class Monolog\\Formatter\\ElasticaFormatter~'
- '~Parameter #2 \$extraFields of class Monolog\\Processor\\WebProcessor constructor expects~'
- '~Parameter #1 \$stream of class Monolog\\Handler\\StreamHandler constructor expects~'
- '~Parameter #2 \$level of class CMDISP\\MonologMicrosoftTeams\\TeamsLogHandler constructor expects~'
- '~Parameter #2 \$channelToActionLevel of class Monolog\\Handler\\FingersCrossed\\ChannelLevelActivationStrategy constructor expects~'
- '~overridden property~'
16 changes: 15 additions & 1 deletion src/AddFormatterTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
namespace Mimmi20\LoggerFactory;

use Interop\Container\ContainerInterface;
use Laminas\ServiceManager\AbstractPluginManager;
use Laminas\ServiceManager\Exception\ServiceNotCreatedException;
use Laminas\ServiceManager\Exception\ServiceNotFoundException;
use Monolog\Formatter\FormatterInterface;
Expand All @@ -21,7 +22,11 @@
use Psr\Container\ContainerExceptionInterface;

use function array_key_exists;
use function assert;
use function get_class;
use function gettype;
use function is_array;
use function is_object;
use function sprintf;

trait AddFormatterTrait
Expand All @@ -30,7 +35,7 @@ trait AddFormatterTrait

/**
* @param array<array<string, array<string, mixed>|bool|string>|FormatterInterface>|null $options
* @phpstan-param array{formatter?: (bool|FormatterInterface|array{enabled?: bool, type?: string, options?: array})}|null $options
* @phpstan-param array{formatter?: (bool|FormatterInterface|array{enabled?: bool, type?: string, options?: array<mixed>})}|null $options
*
* @throws ServiceNotCreatedException
* @throws ServiceNotFoundException
Expand Down Expand Up @@ -61,6 +66,15 @@ private function addFormatter(ContainerInterface $container, HandlerInterface $h
);
}

assert(
$monologFormatterPluginManager instanceof MonologHandlerPluginManager || $monologFormatterPluginManager instanceof AbstractPluginManager,
sprintf(
'$monologFormatterPluginManager should be an Instance of %s, but was %s',
AbstractPluginManager::class,
is_object($monologFormatterPluginManager) ? get_class($monologFormatterPluginManager) : gettype($monologFormatterPluginManager)
)
);

$formatter = $this->createFormatter($options['formatter'], $monologFormatterPluginManager);

if (null === $formatter) {
Expand Down
16 changes: 15 additions & 1 deletion src/AddProcessorTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
namespace Mimmi20\LoggerFactory;

use Interop\Container\ContainerInterface;
use Laminas\ServiceManager\AbstractPluginManager;
use Laminas\ServiceManager\Exception\ServiceNotCreatedException;
use Laminas\ServiceManager\Exception\ServiceNotFoundException;
use Monolog\Handler\HandlerInterface;
Expand All @@ -21,7 +22,11 @@

use function array_key_exists;
use function array_reverse;
use function assert;
use function get_class;
use function gettype;
use function is_array;
use function is_object;
use function sprintf;

trait AddProcessorTrait
Expand All @@ -30,7 +35,7 @@ trait AddProcessorTrait

/**
* @param array<array<string, array<string, mixed>|bool|string>|callable>|null $options
* @phpstan-param array{processors?: (callable|array{enabled?: bool, type?: string, options?: array{mixed}})}|null $options
* @phpstan-param array{processors?: (callable|array{enabled?: bool, type?: string, options?: array<mixed>})}|null $options
*
* @throws ServiceNotCreatedException
* @throws ServiceNotFoundException
Expand All @@ -55,6 +60,15 @@ private function addProcessor(ContainerInterface $container, HandlerInterface $h
throw new ServiceNotFoundException(sprintf('Could not find service %s', MonologProcessorPluginManager::class), 0, $e);
}

assert(
$monologProcessorPluginManager instanceof MonologHandlerPluginManager || $monologProcessorPluginManager instanceof AbstractPluginManager,
sprintf(
'$monologProcessorPluginManager should be an Instance of %s, but was %s',
AbstractPluginManager::class,
is_object($monologProcessorPluginManager) ? get_class($monologProcessorPluginManager) : gettype($monologProcessorPluginManager)
)
);

foreach (array_reverse($options['processors']) as $processorConfig) {
$processor = $this->createProcessor($processorConfig, $monologProcessorPluginManager);

Expand Down
10 changes: 5 additions & 5 deletions src/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ final class ConfigProvider
* Return general-purpose laminas-navigation configuration.
*
* @return array<string, array<string, array<int|string, string>>>
* @phpstan-return array{dependencies: array{aliases: array<string, class-string>, abstract_factories: array<int, class-string>, factories: array<class-string, class-string>}, monolog_handlers: array{aliases: array<string, class-string>, factories: array<class-string, class-string>}, monolog_processors: array{aliases: array<string, class-string>, factories: array<class-string, class-string>}, monolog_formatters: array{aliases: array<string, class-string>, factories: array<class-string, class-string>}, monolog: array{factories: array<class-string, class-string>}}
* @phpstan-return array{dependencies: array{aliases: array<string|class-string, class-string>, abstract_factories: array<int, class-string>, factories: array<class-string, class-string>}, monolog_handlers: array{aliases: array<string|class-string, class-string>, factories: array<class-string, class-string>}, monolog_processors: array{aliases: array<string|class-string, class-string>, factories: array<class-string, class-string>}, monolog_formatters: array{aliases: array<string|class-string, class-string>, factories: array<class-string, class-string>}, monolog: array{factories: array<class-string, class-string>}}
*/
public function __invoke(): array
{
Expand All @@ -210,7 +210,7 @@ public function __invoke(): array
* Return application-level dependency configuration.
*
* @return array<string, array<int|string, string>>
* @phpstan-return array{aliases: array<string, class-string>, abstract_factories: array<int, class-string>, factories: array<class-string, class-string>}
* @phpstan-return array{aliases: array<string|class-string, class-string>, abstract_factories: array<int, class-string>, factories: array<class-string, class-string>}
*/
public function getDependencyConfig(): array
{
Expand All @@ -234,7 +234,7 @@ public function getDependencyConfig(): array

/**
* @return array<string, array<int|string, string>>
* @phpstan-return array{aliases: array<string, class-string>, factories: array<class-string, class-string>}
* @phpstan-return array{aliases: array<string|class-string, class-string>, factories: array<class-string, class-string>}
*/
public function getMonologHandlerConfig(): array
{
Expand Down Expand Up @@ -362,7 +362,7 @@ public function getMonologHandlerConfig(): array

/**
* @return array<string, array<int|string, string>>
* @phpstan-return array{aliases: array<string, class-string>, factories: array<class-string, class-string>}
* @phpstan-return array{aliases: array<string|class-string, class-string>, factories: array<class-string, class-string>}
*/
public function getMonologProcessorConfig(): array
{
Expand Down Expand Up @@ -400,7 +400,7 @@ public function getMonologProcessorConfig(): array

/**
* @return array<string, array<int|string, string>>
* @phpstan-return array{aliases: array<string, class-string>, factories: array<class-string, class-string>}
* @phpstan-return array{aliases: array<string|class-string, class-string>, factories: array<class-string, class-string>}
*/
public function getMonologFormatterConfig(): array
{
Expand Down
9 changes: 7 additions & 2 deletions src/CreateFormatterTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@
use Psr\Container\ContainerExceptionInterface;

use function array_key_exists;
use function assert;
use function sprintf;

trait CreateFormatterTrait
{
/**
* @param array<string, array<string, mixed>|bool|string>|FormatterInterface $formatterConfig
* @phpstan-param FormatterInterface|array{enabled?: bool, type?: string, options?: array} $formatterConfig
* @phpstan-param FormatterInterface|array{enabled?: bool, type?: string, options?: array<mixed>} $formatterConfig
*
* @throws ServiceNotFoundException if unable to resolve the service
* @throws ServiceNotCreatedException if an exception is raised when creating a service
Expand All @@ -45,7 +46,7 @@ private function createFormatter($formatterConfig, AbstractPluginManager $monolo
}

try {
return $monologFormatterPluginManager->get(
$formatter = $monologFormatterPluginManager->get(
$formatterConfig['type'],
$formatterConfig['options'] ?? []
);
Expand All @@ -56,5 +57,9 @@ private function createFormatter($formatterConfig, AbstractPluginManager $monolo
$e
);
}

assert(null === $formatter || $formatter instanceof FormatterInterface);

return $formatter;
}
}
Loading

0 comments on commit 06c0848

Please sign in to comment.