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
@@ -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');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user