diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 744ada2..8df3e31 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: tests: name: Tests - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest strategy: matrix: version: ['8.0', '8.1'] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..04e2d84 --- /dev/null +++ b/Makefile @@ -0,0 +1,59 @@ +SHELL=bash +SOURCE_DIR = $(shell pwd) +BIN_DIR = ${SOURCE_DIR}/bin +COMPOSER = composer + +define printSection + @printf "\033[36m\n==================================================\n\033[0m" + @printf "\033[36m $1 \033[0m" + @printf "\033[36m\n==================================================\n\033[0m" +endef + +.PHONY: all +all: install quality test test-dependencies + +.PHONY: ci +ci: quality test + +.PHONY: install +install: clean-vendor composer-install + +.PHONY: quality +quality: cs-ci + +.PHONY: quality-fix +quality-fix: cs-fix + +.PHONY: test +test: atoum + +.PHONY: cs +cs: + ${BIN_DIR}/php-cs-fixer fix --dry-run --stop-on-violation --diff + +.PHONY: cs-fix +cs-fix: + ${BIN_DIR}/php-cs-fixer fix + +.PHONY: cs-ci +cs-ci: + ${BIN_DIR}/php-cs-fixer fix --ansi --dry-run --using-cache=no --verbose + +.PHONY: clean-vendor +clean-vendor: + $(call printSection,CLEAN-VENDOR) + rm -f ${SOURCE_DIR}/composer.lock + rm -rf ${SOURCE_DIR}/vendor + +.PHONY: composer-install +composer-install: ${SOURCE_DIR}/vendor/composer/installed.json + +${SOURCE_DIR}/vendor/composer/installed.json: + $(call printSection,COMPOSER INSTALL) + $(COMPOSER) --no-interaction install --ansi --no-progress --prefer-dist + +.PHONY: atoum +atoum: + $(call printSection,TEST atoum) + ${BIN_DIR}/atoum + diff --git a/src/M6Web/Bundle/LogBridgeBundle/Config/FilterParser.php b/src/M6Web/Bundle/LogBridgeBundle/Config/FilterParser.php index 2af1132..9250863 100644 --- a/src/M6Web/Bundle/LogBridgeBundle/Config/FilterParser.php +++ b/src/M6Web/Bundle/LogBridgeBundle/Config/FilterParser.php @@ -67,9 +67,9 @@ protected function getAllRoutes(): array public function parse(string $name, array $config): Filter { if ( - (!array_key_exists('route', $config) && !array_key_exists('routes', $config)) || - !array_key_exists('method', $config) || - !array_key_exists('status', $config) + (!array_key_exists('route', $config) && !array_key_exists('routes', $config)) + || !array_key_exists('method', $config) + || !array_key_exists('status', $config) ) { throw new ParseException(sprintf('Undefined "route(s)", "method" or "status" parameter from filter "%s"', $name)); } @@ -168,8 +168,8 @@ public function setFilterClass(string $filterClass): self $reflection = new \ReflectionClass($filterClass); if ( - !$reflection->isInstantiable() || - !$reflection->isSubclassOf(Filter::class) + !$reflection->isInstantiable() + || !$reflection->isSubclassOf(Filter::class) ) { throw new \RuntimeException(sprintf('"%s" is not instantiable or is not a subclass of "%s"', $filterClass, Filter::class)); } diff --git a/src/M6Web/Bundle/LogBridgeBundle/Formatter/DefaultFormatter.php b/src/M6Web/Bundle/LogBridgeBundle/Formatter/DefaultFormatter.php index fbc9c55..02ad66c 100644 --- a/src/M6Web/Bundle/LogBridgeBundle/Formatter/DefaultFormatter.php +++ b/src/M6Web/Bundle/LogBridgeBundle/Formatter/DefaultFormatter.php @@ -127,8 +127,8 @@ protected function getUsername(): string } // compatibility Symfony < 6 - if (!method_exists($token, 'getUserIdentifier') && - method_exists($token, 'getUsername')) { + if (!method_exists($token, 'getUserIdentifier') + && method_exists($token, 'getUsername')) { return $token->getUsername(); }