Skip to content
Merged
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
10 changes: 8 additions & 2 deletions src/Generator/AbstractTypeGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,19 @@ function (%s) <closureUseStatements>{
*/
private $expressionLanguage;

/**
* @var int
*/
protected $cacheDirMask;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the value can be set using construct making this private in a first place could ease maintenance.

Suggested change
protected $cacheDirMask;
private $cacheDirMask;


/**
* @param string $classNamespace The namespace to use for the classes.
* @param string[]|string $skeletonDirs
*/
public function __construct($classNamespace = self::DEFAULT_CLASS_NAMESPACE, $skeletonDirs = [])
public function __construct($classNamespace = self::DEFAULT_CLASS_NAMESPACE, $skeletonDirs = [], $cacheDirMask = 0775)
{
parent::__construct($classNamespace, $skeletonDirs);
$this->cacheDirMask = $cacheDirMask;
}

public function setExpressionLanguage(ExpressionLanguage $expressionLanguage = null)
Expand Down Expand Up @@ -361,7 +367,7 @@ public function generateClass(array $config, $outputDirectory, $mode = false)
if ($mode & self::MODE_WRITE) {
$dir = dirname($path);
if (!is_dir($dir)) {
mkdir($dir, 0775, true);
mkdir($dir, $this->cacheDirMask, true);
}
if (($mode & self::MODE_OVERRIDE) || !file_exists($path)) {
file_put_contents($path, $code);
Expand Down