Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion src/DependencyInjection/Configurator.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
use function count;
use function error_reporting;
use function explode;
use function fclose;
use function flock;
use function fopen;
use function implode;
use function in_array;
use function is_dir;
Expand All @@ -29,6 +32,8 @@
use function trim;
use function unlink;
use const E_USER_DEPRECATED;
use const LOCK_EX;
use const LOCK_UN;
use const PHP_RELEASE_VERSION;
use const PHP_VERSION_ID;

Expand Down Expand Up @@ -74,7 +79,16 @@
#[Override]
public function loadContainer(): string
{
$directory = $this->getContainerCacheDirectory();
$locked = false;
if ($this->journalContainer && is_dir($directory)) {
$lockFile = $directory . '/container.lock';
$handle = fopen($lockFile, 'c'); // @ is escalated to exception
flock($handle, LOCK_EX);

Check failure on line 87 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.4)

Parameter #1 $stream of function flock expects resource, resource|false given.

Check failure on line 87 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.2)

Parameter #1 $stream of function flock expects resource, resource|false given.

Check failure on line 87 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, ubuntu-latest)

Parameter #1 $stream of function flock expects resource, resource|false given.

Check failure on line 87 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, ubuntu-latest)

Parameter #1 $stream of function flock expects resource, resource|false given.

Check failure on line 87 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.5)

Parameter #1 $stream of function flock expects resource, resource|false given.

Check failure on line 87 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.3)

Parameter #1 $stream of function flock expects resource, resource|false given.

Check failure on line 87 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, ubuntu-latest)

Parameter #1 $stream of function flock expects resource, resource|false given.

Check failure on line 87 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.5, ubuntu-latest)

Parameter #1 $stream of function flock expects resource, resource|false given.

Check failure on line 87 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1, ubuntu-latest)

Parameter #1 $stream of function flock expects resource, resource|false given.

Check failure on line 87 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, ubuntu-latest)

Parameter #1 $stream of function flock expects resource, resource|false given.

Check failure on line 87 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, windows-latest)

Parameter #1 $stream of function flock expects resource, resource|false given.

Check failure on line 87 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, windows-latest)

Parameter #1 $stream of function flock expects resource, resource|false given.

Check failure on line 87 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.5, windows-latest)

Parameter #1 $stream of function flock expects resource, resource|false given.

Check failure on line 87 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, windows-latest)

Parameter #1 $stream of function flock expects resource, resource|false given.

Check failure on line 87 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, windows-latest)

Parameter #1 $stream of function flock expects resource, resource|false given.

Check failure on line 87 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1, windows-latest)

Parameter #1 $stream of function flock expects resource, resource|false given.
$locked = true;
}

$loader = new ContainerLoader(

Check failure on line 91 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, ubuntu-latest)

Parameter #1 $fp of function flock expects resource, resource|false given.

Check failure on line 91 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, windows-latest)

Parameter #1 $fp of function flock expects resource, resource|false given.
$this->getContainerCacheDirectory(),
$this->staticParameters['debugMode'],
);
Expand All @@ -95,9 +109,13 @@

if ($this->journalContainer) {
$this->journal($className);
if ($locked) {
flock($handle, LOCK_UN);

Check failure on line 113 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.4)

Parameter #1 $stream of function flock expects resource, resource|false given.

Check failure on line 113 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.2)

Parameter #1 $stream of function flock expects resource, resource|false given.

Check failure on line 113 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, ubuntu-latest)

Parameter #1 $stream of function flock expects resource, resource|false given.

Check failure on line 113 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, ubuntu-latest)

Parameter #1 $stream of function flock expects resource, resource|false given.

Check failure on line 113 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.5)

Parameter #1 $stream of function flock expects resource, resource|false given.

Check failure on line 113 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.3)

Parameter #1 $stream of function flock expects resource, resource|false given.

Check failure on line 113 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, ubuntu-latest)

Parameter #1 $stream of function flock expects resource, resource|false given.

Check failure on line 113 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.5, ubuntu-latest)

Parameter #1 $stream of function flock expects resource, resource|false given.

Check failure on line 113 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1, ubuntu-latest)

Parameter #1 $stream of function flock expects resource, resource|false given.

Check failure on line 113 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, ubuntu-latest)

Parameter #1 $stream of function flock expects resource, resource|false given.

Check failure on line 113 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, windows-latest)

Parameter #1 $stream of function flock expects resource, resource|false given.

Check failure on line 113 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, windows-latest)

Parameter #1 $stream of function flock expects resource, resource|false given.

Check failure on line 113 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.5, windows-latest)

Parameter #1 $stream of function flock expects resource, resource|false given.

Check failure on line 113 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, windows-latest)

Parameter #1 $stream of function flock expects resource, resource|false given.

Check failure on line 113 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, windows-latest)

Parameter #1 $stream of function flock expects resource, resource|false given.

Check failure on line 113 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1, windows-latest)

Parameter #1 $stream of function flock expects resource, resource|false given.
fclose($handle);

Check failure on line 114 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.4)

Parameter #1 $stream of function fclose expects resource, resource|false given.

Check failure on line 114 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.2)

Parameter #1 $stream of function fclose expects resource, resource|false given.

Check failure on line 114 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, ubuntu-latest)

Parameter #1 $stream of function fclose expects resource, resource|false given.

Check failure on line 114 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, ubuntu-latest)

Parameter #1 $stream of function fclose expects resource, resource|false given.

Check failure on line 114 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.5)

Parameter #1 $stream of function fclose expects resource, resource|false given.

Check failure on line 114 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.3)

Parameter #1 $stream of function fclose expects resource, resource|false given.

Check failure on line 114 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, ubuntu-latest)

Parameter #1 $stream of function fclose expects resource, resource|false given.

Check failure on line 114 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.5, ubuntu-latest)

Parameter #1 $stream of function fclose expects resource, resource|false given.

Check failure on line 114 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1, ubuntu-latest)

Parameter #1 $stream of function fclose expects resource, resource|false given.

Check failure on line 114 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, ubuntu-latest)

Parameter #1 $stream of function fclose expects resource, resource|false given.

Check failure on line 114 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, windows-latest)

Parameter #1 $stream of function fclose expects resource, resource|false given.

Check failure on line 114 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, windows-latest)

Parameter #1 $stream of function fclose expects resource, resource|false given.

Check failure on line 114 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.5, windows-latest)

Parameter #1 $stream of function fclose expects resource, resource|false given.

Check failure on line 114 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, windows-latest)

Parameter #1 $stream of function fclose expects resource, resource|false given.

Check failure on line 114 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, windows-latest)

Parameter #1 $stream of function fclose expects resource, resource|false given.

Check failure on line 114 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1, windows-latest)

Parameter #1 $stream of function fclose expects resource, resource|false given.
}
}

Check failure on line 117 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, ubuntu-latest)

Parameter #1 $fp of function flock expects resource, resource|false given.

Check failure on line 117 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, windows-latest)

Parameter #1 $fp of function flock expects resource, resource|false given.
return $className;

Check failure on line 118 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, ubuntu-latest)

Parameter #1 $fp of function fclose expects resource, resource|false given.

Check failure on line 118 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, windows-latest)

Parameter #1 $fp of function fclose expects resource, resource|false given.
}

private function journal(string $currentContainerClassName): void
Expand Down Expand Up @@ -173,11 +191,11 @@
continue;
}
$fileName = $fileInfo->getFilename();
if ($fileName === 'container.journal') {
if ($fileName === 'container.journal' || $fileName === 'container.lock') {

Check failure on line 194 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.4)

This chain of identical comparisons can be simplified using in_array().

Check failure on line 194 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.2)

This chain of identical comparisons can be simplified using in_array().

Check failure on line 194 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, ubuntu-latest)

This chain of identical comparisons can be simplified using in_array().

Check failure on line 194 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, ubuntu-latest)

This chain of identical comparisons can be simplified using in_array().

Check failure on line 194 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.5)

This chain of identical comparisons can be simplified using in_array().

Check failure on line 194 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan with result cache (8.3)

This chain of identical comparisons can be simplified using in_array().

Check failure on line 194 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, ubuntu-latest)

This chain of identical comparisons can be simplified using in_array().

Check failure on line 194 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.5, ubuntu-latest)

This chain of identical comparisons can be simplified using in_array().

Check failure on line 194 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1, ubuntu-latest)

This chain of identical comparisons can be simplified using in_array().

Check failure on line 194 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, ubuntu-latest)

This chain of identical comparisons can be simplified using in_array().

Check failure on line 194 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.3, windows-latest)

This chain of identical comparisons can be simplified using in_array().

Check failure on line 194 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.4, windows-latest)

This chain of identical comparisons can be simplified using in_array().

Check failure on line 194 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.5, windows-latest)

This chain of identical comparisons can be simplified using in_array().

Check failure on line 194 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.2, windows-latest)

This chain of identical comparisons can be simplified using in_array().

Check failure on line 194 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.0, windows-latest)

This chain of identical comparisons can be simplified using in_array().

Check failure on line 194 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1, windows-latest)

This chain of identical comparisons can be simplified using in_array().
continue;
}
if (!str_ends_with($fileName, '.php')) {
continue;

Check failure on line 198 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, ubuntu-latest)

This chain of identical comparisons can be simplified using in_array().

Check failure on line 198 in src/DependencyInjection/Configurator.php

View workflow job for this annotation

GitHub Actions / PHPStan (7.4, windows-latest)

This chain of identical comparisons can be simplified using in_array().
}
$fileClassName = substr($fileName, 0, -4);
if (in_array($fileClassName, $usedInTheLastWeek, true)) {
Expand Down
Loading