Skip to content

Commit

Permalink
refactor: Add strictObjectChecks
Browse files Browse the repository at this point in the history
  • Loading branch information
khalwat committed Jul 1, 2024
1 parent 23b7136 commit 47c91b6
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/twig/BaseSecurityPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
* @property array|string[] $twigFunctions Functions for the Twig sandbox Security Policy
* @property array|string[] $twigMethods Object methods for the Twig sandbox Security Policy
* @property array|string[] $twigProperties Object properties for the Twig sandbox Security Policy
* @property bool $strictObjectChecks When checking object method & property access, should objects not defined
* in $twigMethods & $twigProperties throw an exception?
*/
abstract class BaseSecurityPolicy extends Model implements SecurityPolicyInterface
{
Expand Down Expand Up @@ -47,6 +49,12 @@ abstract class BaseSecurityPolicy extends Model implements SecurityPolicyInterfa
private array $twigProperties = [
];

/**
* @var bool When checking object method & property access, should objects not defined
* in $twigMethods & $twigProperties throw an exception?
*/
private bool $strictObjectChecks = false;

// Public Methods
// =========================================================================

Expand Down Expand Up @@ -131,4 +139,14 @@ public function setTwigProperties(array $properties): void
{
$this->twigProperties = $properties;
}

public function getStrictObjectChecks(): bool
{
return $this->strictObjectChecks;
}

public function setStrictObjectChecks(bool $strict): void
{
$this->strictObjectChecks = $strict;
}
}

0 comments on commit 47c91b6

Please sign in to comment.