Skip to content
Merged
Show file tree
Hide file tree
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
43 changes: 0 additions & 43 deletions build/build-preload.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,38 +140,6 @@ public function buildPreloadScript(string $buildDirectory, string $preloadFile):
$this->buildPreloadScriptPhpDocParser($buildDirectory, $preloadFile);
}

public function buildPreloadScriptForSplitPackage(string $buildDirectory, string $preloadFile): void
{
$this->buildPreloadScriptForSplitPhpParser($buildDirectory, $preloadFile);
$this->buildPreloadScriptForSplitPhpDocParser($buildDirectory, $preloadFile);
}

private function buildPreloadScriptForSplitPhpParser(string $buildDirectory, string $preloadFile): void
{
$vendorDir = $buildDirectory . '/vendor';
if (! is_dir($vendorDir . '/nikic/php-parser/lib/PhpParser')) {
return;
}

// 1. find php-parser file infos
$fileInfos = $this->findPhpParserFilesAndSortThem($vendorDir);

file_put_contents($preloadFile, $preloadFileContent);
}

private function buildPreloadScriptForSplitPhpDocParser(string $buildDirectory, string $preloadFile): void
{
$vendorDir = $buildDirectory . '/vendor';
if (! is_dir($vendorDir . '/phpstan/phpdoc-parser')) {
return;
}

// 1. find phpdoc-parser file infos
$fileInfos = $this->findPhpDocParserFilesAndSortThem($vendorDir);

file_put_contents($preloadFile, $preloadFileContent, FILE_APPEND);
}

private function buildPreloadScriptPhpDocParser(string $buildDirectory, string $preloadFile): void
{
$vendorDir = $buildDirectory . '/vendor';
Expand Down Expand Up @@ -254,17 +222,6 @@ private function createPreloadFileContent(array $fileInfos, bool $append = false
return $preloadFileContent;
}

private function createRequireOnceFilePathLineForSplitPackage(string $realPath): string
{
if (! str_contains($realPath, 'vendor')) {
$filePath = '/src/' . Strings::after($realPath, '/src/');
return "require_once __DIR__ . '" . $filePath . "';" . PHP_EOL;
}

$filePath = '/../../../vendor/' . Strings::after($realPath, 'vendor/');
return "require_once __DIR__ . '" . $filePath . "';" . PHP_EOL;
}

private function createRequireOnceFilePathLine(string $realPath): string
{
if (! str_contains($realPath, 'vendor')) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function getNodeTypes(): array
public function refactor(Node $node): ?Node
{
// skip if has no private property
$hasAnyPrivateProperty = array_any($node->getProperties(), fn(Property $property): bool => $property->isPrivate());
$hasAnyPrivateProperty = array_any($node->getProperties(), fn (Property $property): bool => $property->isPrivate());

if (! $hasAnyPrivateProperty) {
return null;
Expand Down
Loading