From ee1266d4d299389eb792ab6fe28f2096f3a5e34f Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Fri, 9 Aug 2024 13:04:04 +0200 Subject: [PATCH 1/3] FEATURE: Introduce EEL tracer for handling Neos9 deprecations --- Neos.Eel/Classes/Context.php | 16 +++++++--------- .../Classes/EelInvocationTracerInterface.php | 13 +++++++++++++ Neos.Eel/Classes/Utility.php | 4 ++-- 3 files changed, 22 insertions(+), 11 deletions(-) create mode 100644 Neos.Eel/Classes/EelInvocationTracerInterface.php diff --git a/Neos.Eel/Classes/Context.php b/Neos.Eel/Classes/Context.php index 584ed50b73..ba441e2d69 100644 --- a/Neos.Eel/Classes/Context.php +++ b/Neos.Eel/Classes/Context.php @@ -26,17 +26,13 @@ */ class Context { - /** - * @var mixed - */ - protected $value; - /** * @param mixed $value */ - public function __construct($value = null) - { - $this->value = $value; + public function __construct( + protected mixed $value = null, + private ?EelInvocationTracerInterface $tracer = null + ) { } /** @@ -62,6 +58,7 @@ public function get($path) if (is_array($this->value)) { return array_key_exists($path, $this->value) ? $this->value[$path] : null; } elseif (is_object($this->value)) { + $this->tracer?->recordPropertyAccess($this->value, $path); try { return ObjectAccess::getProperty($this->value, $path); } catch (PropertyNotAccessibleException $exception) { @@ -97,6 +94,7 @@ public function call($method, array $arguments = []) if ($this->value === null) { return null; } elseif (is_object($this->value)) { + $this->tracer?->recordMethodCall($this->value, $method); $callback = [$this->value, $method]; } elseif (is_array($this->value)) { if (!array_key_exists($method, $this->value)) { @@ -139,7 +137,7 @@ public function callAndWrap($method, array $arguments = []) public function wrap($value) { if (!$value instanceof Context) { - return new static($value); + return new static($value, $this->tracer); } else { return $value; } diff --git a/Neos.Eel/Classes/EelInvocationTracerInterface.php b/Neos.Eel/Classes/EelInvocationTracerInterface.php new file mode 100644 index 0000000000..9ad7c93d0b --- /dev/null +++ b/Neos.Eel/Classes/EelInvocationTracerInterface.php @@ -0,0 +1,13 @@ +allow('q'); // Allow functions on the uppermost context level to allow calling them without From 13ccf72d4a81b2b390a7741cf0a962a45dc7aa03 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Mon, 19 Aug 2024 13:33:38 +0200 Subject: [PATCH 2/3] TASK: Pass arguments to `EelInvocationTracerInterface` and also trace function calls --- Neos.Eel/Classes/Context.php | 9 ++++++++- Neos.Eel/Classes/EelInvocationTracerInterface.php | 10 +++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Neos.Eel/Classes/Context.php b/Neos.Eel/Classes/Context.php index ba441e2d69..ead8d97b54 100644 --- a/Neos.Eel/Classes/Context.php +++ b/Neos.Eel/Classes/Context.php @@ -94,7 +94,6 @@ public function call($method, array $arguments = []) if ($this->value === null) { return null; } elseif (is_object($this->value)) { - $this->tracer?->recordMethodCall($this->value, $method); $callback = [$this->value, $method]; } elseif (is_array($this->value)) { if (!array_key_exists($method, $this->value)) { @@ -113,6 +112,14 @@ public function call($method, array $arguments = []) $arguments[$i] = $arguments[$i]->unwrap(); } } + if ($this->tracer !== null) { + // optional experimental tracing + if (is_object($this->value)) { + $this->tracer->recordMethodCall($this->value, $method, $arguments); + } else { + $this->tracer->recordFunctionCall($callback, $method, $arguments); + } + } return call_user_func_array($callback, $arguments); } diff --git a/Neos.Eel/Classes/EelInvocationTracerInterface.php b/Neos.Eel/Classes/EelInvocationTracerInterface.php index 9ad7c93d0b..4ef07b334d 100644 --- a/Neos.Eel/Classes/EelInvocationTracerInterface.php +++ b/Neos.Eel/Classes/EelInvocationTracerInterface.php @@ -9,5 +9,13 @@ interface EelInvocationTracerInterface { public function recordPropertyAccess(object $object, string $propertyName): void; - public function recordMethodCall(object $object, string $methodName): void; + /** + * @param array $arguments + */ + public function recordMethodCall(object $object, string $methodName, array $arguments): void; + + /** + * @param array $arguments + */ + public function recordFunctionCall(callable $function, string $functionName, array $arguments): void; } From 7cc9fb5d4df9903ab997a38a03f8516049969815 Mon Sep 17 00:00:00 2001 From: Jenkins Date: Thu, 12 Sep 2024 14:15:35 +0000 Subject: [PATCH 3/3] TASK: Update references [skip ci] --- .../TheDefinitiveGuide/PartV/AnnotationReference.rst | 2 +- .../Documentation/TheDefinitiveGuide/PartV/CommandReference.rst | 2 +- .../PartV/FluidAdaptorViewHelperReference.rst | 2 +- .../Documentation/TheDefinitiveGuide/PartV/SignalsReference.rst | 2 +- .../TheDefinitiveGuide/PartV/TYPO3FluidViewHelperReference.rst | 2 +- .../TheDefinitiveGuide/PartV/TypeConverterReference.rst | 2 +- .../TheDefinitiveGuide/PartV/ValidatorReference.rst | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Neos.Flow/Documentation/TheDefinitiveGuide/PartV/AnnotationReference.rst b/Neos.Flow/Documentation/TheDefinitiveGuide/PartV/AnnotationReference.rst index 0659fc3b53..867bc94f57 100644 --- a/Neos.Flow/Documentation/TheDefinitiveGuide/PartV/AnnotationReference.rst +++ b/Neos.Flow/Documentation/TheDefinitiveGuide/PartV/AnnotationReference.rst @@ -3,7 +3,7 @@ Flow Annotation Reference ========================= -This reference was automatically generated from code on 2024-07-09 +This reference was automatically generated from code on 2024-09-12 .. _`Flow Annotation Reference: After`: diff --git a/Neos.Flow/Documentation/TheDefinitiveGuide/PartV/CommandReference.rst b/Neos.Flow/Documentation/TheDefinitiveGuide/PartV/CommandReference.rst index bf1ea9c9b4..96fcb5406d 100644 --- a/Neos.Flow/Documentation/TheDefinitiveGuide/PartV/CommandReference.rst +++ b/Neos.Flow/Documentation/TheDefinitiveGuide/PartV/CommandReference.rst @@ -19,7 +19,7 @@ commands that may be available, use:: ./flow help -The following reference was automatically generated from code on 2024-07-09 +The following reference was automatically generated from code on 2024-09-12 .. _`Flow Command Reference: NEOS.FLOW`: diff --git a/Neos.Flow/Documentation/TheDefinitiveGuide/PartV/FluidAdaptorViewHelperReference.rst b/Neos.Flow/Documentation/TheDefinitiveGuide/PartV/FluidAdaptorViewHelperReference.rst index 09b037dc2c..4b35ae7de8 100644 --- a/Neos.Flow/Documentation/TheDefinitiveGuide/PartV/FluidAdaptorViewHelperReference.rst +++ b/Neos.Flow/Documentation/TheDefinitiveGuide/PartV/FluidAdaptorViewHelperReference.rst @@ -3,7 +3,7 @@ FluidAdaptor ViewHelper Reference ================================= -This reference was automatically generated from code on 2024-07-09 +This reference was automatically generated from code on 2024-09-12 .. _`FluidAdaptor ViewHelper Reference: f:debug`: diff --git a/Neos.Flow/Documentation/TheDefinitiveGuide/PartV/SignalsReference.rst b/Neos.Flow/Documentation/TheDefinitiveGuide/PartV/SignalsReference.rst index 8ad6e8a6d3..58bedc97ae 100644 --- a/Neos.Flow/Documentation/TheDefinitiveGuide/PartV/SignalsReference.rst +++ b/Neos.Flow/Documentation/TheDefinitiveGuide/PartV/SignalsReference.rst @@ -3,7 +3,7 @@ Flow Signals Reference ====================== -This reference was automatically generated from code on 2024-07-09 +This reference was automatically generated from code on 2024-09-12 .. _`Flow Signals Reference: AbstractAdvice (``Neos\Flow\Aop\Advice\AbstractAdvice``)`: diff --git a/Neos.Flow/Documentation/TheDefinitiveGuide/PartV/TYPO3FluidViewHelperReference.rst b/Neos.Flow/Documentation/TheDefinitiveGuide/PartV/TYPO3FluidViewHelperReference.rst index b728d9d591..d890b3b1e3 100644 --- a/Neos.Flow/Documentation/TheDefinitiveGuide/PartV/TYPO3FluidViewHelperReference.rst +++ b/Neos.Flow/Documentation/TheDefinitiveGuide/PartV/TYPO3FluidViewHelperReference.rst @@ -3,7 +3,7 @@ TYPO3 Fluid ViewHelper Reference ================================ -This reference was automatically generated from code on 2024-07-09 +This reference was automatically generated from code on 2024-09-12 .. _`TYPO3 Fluid ViewHelper Reference: f:alias`: diff --git a/Neos.Flow/Documentation/TheDefinitiveGuide/PartV/TypeConverterReference.rst b/Neos.Flow/Documentation/TheDefinitiveGuide/PartV/TypeConverterReference.rst index df02a599c6..14d19da9d1 100644 --- a/Neos.Flow/Documentation/TheDefinitiveGuide/PartV/TypeConverterReference.rst +++ b/Neos.Flow/Documentation/TheDefinitiveGuide/PartV/TypeConverterReference.rst @@ -3,7 +3,7 @@ Flow TypeConverter Reference ============================ -This reference was automatically generated from code on 2024-07-09 +This reference was automatically generated from code on 2024-09-12 .. _`Flow TypeConverter Reference: ArrayConverter`: diff --git a/Neos.Flow/Documentation/TheDefinitiveGuide/PartV/ValidatorReference.rst b/Neos.Flow/Documentation/TheDefinitiveGuide/PartV/ValidatorReference.rst index 5de2b92b5f..bb3aef5716 100644 --- a/Neos.Flow/Documentation/TheDefinitiveGuide/PartV/ValidatorReference.rst +++ b/Neos.Flow/Documentation/TheDefinitiveGuide/PartV/ValidatorReference.rst @@ -3,7 +3,7 @@ Flow Validator Reference ======================== -This reference was automatically generated from code on 2024-07-09 +This reference was automatically generated from code on 2024-09-12 .. _`Flow Validator Reference: AggregateBoundaryValidator`: