chore(core): app/Support Pint 사전 드리프트 정리
이번 이슈에서 손대지 않은 파일인데 Pint 실행 시 워킹트리에 떠올라, HEAD 사본을 꺼내 pint --test 로 대조했다. 5개 파일 모두 fail 이며 fixer 목록이 워킹트리 diff 와 일치 — 이전부터 누적된 미적용분이다. 기능 커밋에 섞으면 diff 의 의미가 흐려지므로 분리했다. FakerShim 의 16진 표기 변경은 UUID v4 비트 마스킹 결과에 영향이 없고, bootstrap.php 의 use 임포트 추출은 ::class 가 완전한 FQN 으로 해석되므로 class_alias 대상이 달라지지 않는다. 이 파일은 autoload.files 진입점이라 전역 fake 에 닿는 자리여서 따로 확인했다.
This commit is contained in:
1 parent
327c433250
commit
3044119b37
5 files changed
+25
-25
No files matched your search
@@ -33,8 +33,6 @@ class ConfigCacheHelper
|
||||
*
|
||||
* 재생성 실패(권한/디스크 등)는 치명적이지 않다 — config:clear 로 stale 캐시는
|
||||
* 이미 제거되어 다음 요청이 fresh config 로 안전하게 부팅되므로, 경고만 남기고 넘어간다.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function rebuild(): void
|
||||
{
|
||||
@@ -62,8 +60,6 @@ class ConfigCacheHelper
|
||||
* config 캐시만 제거합니다 (재생성 없음).
|
||||
*
|
||||
* 재생성이 부적절한 특수 경로(예: 설치 직전 초기화)를 위한 보조 진입점.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function clear(): void
|
||||
{
|
||||
|
||||
@@ -64,7 +64,7 @@ class PhpBinaryResolver
|
||||
$checkedPaths = [];
|
||||
|
||||
// PHP_BINARY 상수 (현재 웹 서버가 사용하는 PHP)
|
||||
if (defined('PHP_BINARY') && PHP_BINARY !== '' && !in_array(PHP_BINARY, $checkedPaths, true)) {
|
||||
if (defined('PHP_BINARY') && PHP_BINARY !== '' && ! in_array(PHP_BINARY, $checkedPaths, true)) {
|
||||
$checkedPaths[] = PHP_BINARY;
|
||||
$result = self::validate(PHP_BINARY);
|
||||
if ($result['valid']) {
|
||||
@@ -79,7 +79,7 @@ class PhpBinaryResolver
|
||||
}
|
||||
$checkedPaths[] = $path;
|
||||
|
||||
if (!file_exists($path)) {
|
||||
if (! file_exists($path)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ class PhpBinaryResolver
|
||||
}
|
||||
|
||||
// 시스템 PATH의 'php'
|
||||
if (!in_array('php', $checkedPaths, true)) {
|
||||
if (! in_array('php', $checkedPaths, true)) {
|
||||
$checkedPaths[] = 'php';
|
||||
$result = self::validate('php');
|
||||
if ($result['valid']) {
|
||||
@@ -104,7 +104,7 @@ class PhpBinaryResolver
|
||||
/**
|
||||
* 지정된 PHP 바이너리 경로의 유효성을 검증합니다.
|
||||
*
|
||||
* @param string $path PHP 바이너리 경로
|
||||
* @param string $path PHP 바이너리 경로
|
||||
* @return array{valid: bool, version: string|null, message: string} 검증 결과
|
||||
*/
|
||||
public static function validate(string $path): array
|
||||
@@ -118,7 +118,7 @@ class PhpBinaryResolver
|
||||
}
|
||||
|
||||
// 절대 경로인 경우 파일 존재 여부 확인
|
||||
if ($path !== 'php' && !file_exists($path)) {
|
||||
if ($path !== 'php' && ! file_exists($path)) {
|
||||
return [
|
||||
'valid' => false,
|
||||
'version' => null,
|
||||
@@ -127,7 +127,7 @@ class PhpBinaryResolver
|
||||
}
|
||||
|
||||
// 명령어 실행하여 버전 확인
|
||||
$command = escapeshellarg($path) . ' --version 2>&1';
|
||||
$command = escapeshellarg($path).' --version 2>&1';
|
||||
$output = [];
|
||||
$returnCode = -1;
|
||||
|
||||
@@ -150,14 +150,14 @@ class PhpBinaryResolver
|
||||
return [
|
||||
'valid' => true,
|
||||
'version' => $version,
|
||||
'message' => "PHP {$version} (최소 요구 버전 " . self::MIN_PHP_VERSION . ' 충족)',
|
||||
'message' => "PHP {$version} (최소 요구 버전 ".self::MIN_PHP_VERSION.' 충족)',
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'valid' => false,
|
||||
'version' => $version,
|
||||
'message' => "PHP {$version}은 최소 요구 버전 " . self::MIN_PHP_VERSION . '을 충족하지 않습니다.',
|
||||
'message' => "PHP {$version}은 최소 요구 버전 ".self::MIN_PHP_VERSION.'을 충족하지 않습니다.',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -171,8 +171,8 @@ class PhpBinaryResolver
|
||||
/**
|
||||
* Composer 실행 명령어를 생성합니다.
|
||||
*
|
||||
* @param string $phpBinary PHP 바이너리 경로
|
||||
* @param string $composerBinary Composer 바이너리 경로 (빈 문자열이면 시스템 PATH 사용)
|
||||
* @param string $phpBinary PHP 바이너리 경로
|
||||
* @param string $composerBinary Composer 바이너리 경로 (빈 문자열이면 시스템 PATH 사용)
|
||||
* @return string 실행 가능한 Composer 명령어
|
||||
*/
|
||||
public static function buildComposerCommand(string $phpBinary = 'php', string $composerBinary = ''): string
|
||||
@@ -184,7 +184,7 @@ class PhpBinaryResolver
|
||||
}
|
||||
|
||||
return str_ends_with($composerBinary, '.phar')
|
||||
? escapeshellarg($phpBinary) . ' ' . escapeshellarg($composerBinary)
|
||||
? escapeshellarg($phpBinary).' '.escapeshellarg($composerBinary)
|
||||
: escapeshellarg($composerBinary);
|
||||
}
|
||||
|
||||
|
||||
@@ -236,8 +236,8 @@ class FakerShim
|
||||
public function uuid(): string
|
||||
{
|
||||
$data = random_bytes(16);
|
||||
$data[6] = chr(ord($data[6]) & 0x0f | 0x40);
|
||||
$data[8] = chr(ord($data[8]) & 0x3f | 0x80);
|
||||
$data[6] = chr(ord($data[6]) & 0x0F | 0x40);
|
||||
$data[8] = chr(ord($data[8]) & 0x3F | 0x80);
|
||||
|
||||
return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
<?php
|
||||
|
||||
use App\Support\SampleData\FakerFactoryShim;
|
||||
use App\Support\SampleData\FakerShim;
|
||||
use Faker\Factory;
|
||||
use Faker\Generator;
|
||||
|
||||
/**
|
||||
* FakerShim Bootstrap
|
||||
*
|
||||
@@ -16,16 +21,15 @@
|
||||
* - 매 요청당 1회 (PHP-FPM 워커 수명 동안 캐시되지는 않음 — autoload.files 는 매 요청 require)
|
||||
* - 비용: file_exists ~100ns + class_alias ~500ns (Faker 부재 시) = 총 1μs 미만
|
||||
*/
|
||||
|
||||
$fakerInstalled = file_exists(__DIR__.'/../../../vendor/fakerphp/faker/src/Faker/Factory.php');
|
||||
|
||||
if (! $fakerInstalled) {
|
||||
// Faker 미설치: Shim 을 실제 Faker 클래스명으로 alias
|
||||
if (! class_exists(\Faker\Factory::class, false)) {
|
||||
class_alias(\App\Support\SampleData\FakerFactoryShim::class, \Faker\Factory::class);
|
||||
if (! class_exists(Factory::class, false)) {
|
||||
class_alias(FakerFactoryShim::class, Factory::class);
|
||||
}
|
||||
if (! class_exists(\Faker\Generator::class, false)) {
|
||||
class_alias(\App\Support\SampleData\FakerShim::class, \Faker\Generator::class);
|
||||
if (! class_exists(Generator::class, false)) {
|
||||
class_alias(FakerShim::class, Generator::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +41,7 @@ if (! function_exists('fake')) {
|
||||
* FakerShim 기반 fake() 대체 구현
|
||||
*
|
||||
* @param string|null $locale 로케일 (기본: config('app.faker_locale') 또는 'ko_KR')
|
||||
* @return \Faker\Generator (class_alias 로 App\Support\SampleData\FakerShim 과 동일)
|
||||
* @return Generator (class_alias 로 App\Support\SampleData\FakerShim 과 동일)
|
||||
*/
|
||||
function fake($locale = null)
|
||||
{
|
||||
@@ -45,6 +49,6 @@ if (! function_exists('fake')) {
|
||||
$locale = app('config')->get('app.faker_locale', 'ko_KR');
|
||||
}
|
||||
|
||||
return \Faker\Factory::create($locale ?? 'ko_KR');
|
||||
return Factory::create($locale ?? 'ko_KR');
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@ class UmaskHelper
|
||||
* 그룹 공유 친화 umask(0002) 로 조정한다. 조건이 맞지 않으면 no-op.
|
||||
*
|
||||
* @param string $storagePath 판정 기준 디렉토리 (일반적으로 `base_path('storage')`)
|
||||
* @return int|null 새 umask 로 전환한 경우 이전 umask 값. 조건 불충족 시 null.
|
||||
* @return int|null 새 umask 로 전환한 경우 이전 umask 값. 조건 불충족 시 null.
|
||||
*/
|
||||
public static function configureForGroupSharing(string $storagePath): ?int
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user