Skip to content

Commit

Permalink
bump: all (#156)
Browse files Browse the repository at this point in the history
* bump: all the things

* fix: disable array key check in Psalm (for now)

* fix: remove redundant array_values()

* fix: specific keys in paths()

* fix: enable array key check in Psalm

* fix: add permissions return type

* fix: dry run return type

* fix: dry run, execute args type

* fix: Psalm more/less specific return types

* fix: Psalm remove baseline

* fix1: streamline

* bump: all

* fix: Psalm MoreSpecificType
  • Loading branch information
dkarlovi authored Jan 19, 2024
1 parent 69e1c05 commit 2f10846
Show file tree
Hide file tree
Showing 14 changed files with 93 additions and 194 deletions.
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@
/*baseline* export-ignore
/composer.lock export-ignore
/Makefile export-ignore
/package.json export-ignore
17 changes: 17 additions & 0 deletions infection.json.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"source": {
"directories": [
"src"
]
},
"logs": {
"text": "var/phpqa/infection.log"
},
"minCoveredMsi": 100,
"mutators": {
"@default": true,
"IdenticalEqual": false,
"NotIdenticalNotEqual": false,
"MBString": false
}
}
46 changes: 0 additions & 46 deletions phpstan.baseline.neon

This file was deleted.

1 change: 0 additions & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ includes:
- /tools/.composer/vendor-bin/phpstan/vendor/phpstan/phpstan-strict-rules/rules.neon
- /tools/.composer/vendor-bin/phpstan/vendor/phpstan/phpstan-phpunit/extension.neon
- /tools/.composer/vendor-bin/phpstan/vendor/phpstan/phpstan-symfony/extension.neon
- phpstan.baseline.neon
parameters:
tmpDir: %currentWorkingDirectory%/var/phpqa/phpstan
level: max
Expand Down
135 changes: 0 additions & 135 deletions psalm.baseline.xml

This file was deleted.

1 change: 0 additions & 1 deletion psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
checkForThrowsInGlobalScope="true"
ensureArrayIntOffsetsExist="true"
ensureArrayStringOffsetsExist="true"
errorBaseline="psalm.baseline.xml"
errorLevel="1"
findUnusedBaselineEntry="true"
findUnusedCode="true"
Expand Down
2 changes: 1 addition & 1 deletion resources/Lighthouse/common.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
LIGHTHOUSE_DOCKER_IMAGE ?= cypress/browsers:node-20.9.0-chrome-118.0.5993.88-1-ff-118.0.2-edge-118.0.2088.46-1
LIGHTHOUSE_DOCKER_IMAGE ?= cypress/browsers:node-20.10.0-chrome-118.0.5993.88-1-ff-118.0.2-edge-118.0.2088.46-1
LIGHTHOUSE_DOCKER_COMMAND ?= docker run --init --interactive ${DOCKER_TTY} --rm --env HOME=/tmp ${DOCKER_USER} --volume "${DOCKER_CWD}:/public" --workdir "/public" ${LIGHTHOUSE_DOCKER_IMAGE}

analyze/lighthouse: ## Analyze built files using Lighthouse
Expand Down
2 changes: 1 addition & 1 deletion resources/PHP/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ PHP_VERSION=8.3
endif

ifndef PHPQA_DOCKER_IMAGE
PHPQA_DOCKER_IMAGE=jakzal/phpqa:1.93.0-php${PHP_VERSION}-alpine
PHPQA_DOCKER_IMAGE=jakzal/phpqa:1.95.1-php${PHP_VERSION}-alpine
endif

ifndef PHPQA_DOCKER_COMMAND
Expand Down
2 changes: 1 addition & 1 deletion resources/Visual/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ $(error BASE_URL must be defined before loading Visual/common.mk)
endif

PROJECT_ROOT = ${DOCKER_CWD}
BACKSTOP_DOCKER_IMAGE ?= backstopjs/backstopjs:6.2.2
BACKSTOP_DOCKER_IMAGE ?= backstopjs/backstopjs:6.3.3
BACKSTOP_DOCKER_COMMAND ?= docker run --init --interactive ${TTY} --shm-size 256MB --cap-add=SYS_ADMIN --rm --env PROJECT_ROOT=${PROJECT_ROOT} --env BASE_URL=${BASE_URL} ${DOCKER_USER} --tmpfs /tmp --volume "${PROJECT_ROOT}:${PROJECT_ROOT}" --workdir "${PROJECT_ROOT}" ${BACKSTOP_DOCKER_IMAGE} --config backstop.config.js
visual/test:
${BACKSTOP_DOCKER_COMMAND} test
Expand Down
29 changes: 26 additions & 3 deletions tests/functional/MakefileTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function testHelpIsTheDefaultCommand(): void
public function testMakefileHasInit(): void
{
$expected = array_map(static fn (string $path): string => sprintf('if [ -d "$ROOT/resources/%1$s" ]; then cp -a $ROOT/resources/%1$s/. .; fi', $path), $this->getExpectedInitPaths());
$expected = array_merge(...array_values(array_map(static fn ($value) => [$value, 'if [ -f .gitattributes.dist ]; then mv .gitattributes.dist .gitattributes; fi'], $expected)));
$expected = array_merge(...array_map(static fn ($value) => [$value, 'if [ -f .gitattributes.dist ]; then mv .gitattributes.dist .gitattributes; fi'], $expected));
$actual = self::dryRun('init');

self::assertSame($expected, $actual);
Expand All @@ -109,6 +109,7 @@ public function testMakefileHasInit(): void
/**
* @dataProvider provideMakefileCommandsWorkCases
*
* @param list<string> $expected
* @param array<string, string> $env
*/
public function testMakefileCommandsWork(string $command, array $expected, array $env): void
Expand All @@ -131,17 +132,24 @@ protected function getExpectedHelp(): string
return $this->generateHelpList(array_keys(static::getExpectedHelpCommandsExecutionPath([])));
}

/**
* @param list<string> $commands
*/
protected function generateHelpList(array $commands): string
{
$help = [];
sort($commands);
foreach ($commands as $command) {
$help[] = sprintf('%1$s[45m%2$s%1$s[0m %3$s', "\e", str_pad($command, 20), $this->helpOverride[$command] ?? $this->help[$command] ?? '');
$help[] = sprintf('%1$s[45m%2$s%1$s[0m %3$s', "\e", mb_str_pad($command, 20), $this->helpOverride[$command] ?? $this->help[$command] ?? '');
}

return implode("\n", $help)."\n";
}

/**
* @param list<string> $files
* @param list<string> $additionalFiles
*/
protected static function generateHelpExecutionPath(array $files = [], array $additionalFiles = []): string
{
$files = array_merge($files, [
Expand All @@ -154,7 +162,10 @@ protected static function generateHelpExecutionPath(array $files = [], array $ad
$command = match (\PHP_OS_FAMILY) {
'Darwin' => 'grep --no-filename --extended-regexp \'^ *[-a-zA-Z0-9_/]+ *:.*## \' '.implode(' ', $files).' | awk \'BEGIN {FS = ":.*?## "}; {printf "\033[45m%-20s\033[0m %s\n", $1, $2}\' | sort',
'Linux' => 'grep -h -E \'^ *[-a-zA-Z0-9_/]+ *:.*## \' '.implode(' ', $files).' | awk \'BEGIN {FS = ":.*?## "}; {printf "\033[45m%-20s\033[0m %s\n", $1, $2}\' | sort',
'Windows' => 'Select-String -Pattern \'^ *(?<name>[-a-zA-Z0-9_/]+) *:.*## *(?<help>.+)\' '.implode(',', array_map(static function (string $item, int $index): string {
'Windows' => 'Select-String -Pattern \'^ *(?<name>[-a-zA-Z0-9_/]+) *:.*## *(?<help>.+)\' '.implode(',', array_map(static function (false|string $item, int $index): string {
if ($item === false) {
throw new \LogicException('Invalid item');
}
if ($index === 0) {
return $item;
}
Expand All @@ -167,6 +178,11 @@ protected static function generateHelpExecutionPath(array $files = [], array $ad
return self::normalize($command);
}

/**
* @param list<string> $dirs
*
* @return list<string>
*/
protected static function generatePermissionsExecutionPath(array $dirs): array
{
$commands = [];
Expand Down Expand Up @@ -221,7 +237,13 @@ protected static function getMakefilePath(): string
}

/**
* @param list<string> $args
* @param null|array<string, int|string> $env
*
* @return list<string>
*
* @psalm-suppress MoreSpecificReturnType
* @psalm-suppress LessSpecificReturnStatement
*/
protected static function dryRun(
?string $makeCommand = null,
Expand All @@ -236,6 +258,7 @@ protected static function dryRun(
}

/**
* @param list<string> $args
* @param null|array<string, int|string> $env
*/
protected static function execute(
Expand Down
3 changes: 3 additions & 0 deletions tests/functional/PHP/PharTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ final class PharTest extends MakefileTestCase
{
use PhpTrait;

/**
* @var array<string, string>
*/
protected array $helpOverride = [
'phar/build' => 'Build PHAR file',
];
Expand Down
Loading

0 comments on commit 2f10846

Please sign in to comment.