File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 44
55namespace Efabrica \PHPStanLatte \Temp ;
66
7+ use RuntimeException ;
8+
79final class TempDirResolver
810{
911 private string $ tmpDir ;
1012
1113 public function __construct (?string $ tmpDir )
1214 {
13- $ this ->tmpDir = $ tmpDir ? rtrim ($ tmpDir , DIRECTORY_SEPARATOR ) : sys_get_temp_dir () . '/phpstan-latte ' ;
15+ $ tmpDir = $ tmpDir ? rtrim ($ tmpDir , DIRECTORY_SEPARATOR ) : sys_get_temp_dir () . '/phpstan-latte ' ;
16+ if (!is_dir ($ tmpDir )) {
17+ if (!@mkdir ($ tmpDir ) && !is_dir ($ tmpDir )) {
18+ throw new RuntimeException (sprintf ('Cannot create temp dir "%s" ' , $ tmpDir ));
19+ }
20+ }
21+ $ tmpDir = realpath ($ tmpDir ) ?: $ tmpDir ;
22+ if (!is_writable ($ tmpDir )) {
23+ throw new RuntimeException (sprintf ('Temp dir "%s" is not writable ' , $ tmpDir ));
24+ }
25+ $ this ->tmpDir = $ tmpDir ;
1426 }
1527
1628 public function resolveCompileDir (): string
Original file line number Diff line number Diff line change 11parameters :
22 latte :
3- tmpDir : %rootDir%/../../../tmp/phpstan-latte
43 resolveAllPossiblePaths : true
54 features :
65 transformDynamicFormControlNamesToString : true
You can’t perform that action at this time.
0 commit comments