diff --git a/Neos.Flow/Classes/Aop/Builder/ProxyClassBuilder.php b/Neos.Flow/Classes/Aop/Builder/ProxyClassBuilder.php
index b1052792f7..a175e0cf8d 100644
--- a/Neos.Flow/Classes/Aop/Builder/ProxyClassBuilder.php
+++ b/Neos.Flow/Classes/Aop/Builder/ProxyClassBuilder.php
@@ -441,10 +441,8 @@ public function buildProxyClass(string $targetClassName, array $aspectContainers
* @param ClassNameIndex $targetClassNameCandidates target class names for advices
* @param ClassNameIndex $treatedSubClasses Already treated (sub) classes to avoid duplication
* @return ClassNameIndex The new collection of already treated classes
- * @throws ClassLoadingForReflectionFailedException
- * @throws \ReflectionException
- * @throws InvalidClassException
* @throws CannotBuildObjectException
+ * @throws \ReflectionException
*/
protected function proxySubClassesOfClassToEnsureAdvices(string $className, ClassNameIndex $targetClassNameCandidates, ClassNameIndex $treatedSubClasses): ClassNameIndex
{
diff --git a/Neos.Flow/Classes/Cache/CacheManager.php b/Neos.Flow/Classes/Cache/CacheManager.php
index 404b699205..b4e6b4c6d6 100644
--- a/Neos.Flow/Classes/Cache/CacheManager.php
+++ b/Neos.Flow/Classes/Cache/CacheManager.php
@@ -375,9 +375,10 @@ protected function flushClassCachesByChangedFiles(array $changedFiles): void
$flushDoctrineProxyCache = false;
$flushPolicyCache = false;
if (count($modifiedClassNamesWithUnderscores) > 0) {
- $reflectionStatusCache = $this->getCache('Flow_Reflection_Status');
+ $reflectionDataRuntimeCache = $this->getCache('Flow_Reflection_RuntimeData');
foreach (array_keys($modifiedClassNamesWithUnderscores) as $classNameWithUnderscores) {
- $reflectionStatusCache->remove($classNameWithUnderscores);
+ $this->logger->debug('File change detected, removing reflection for ' . $classNameWithUnderscores);
+ $reflectionDataRuntimeCache->remove($classNameWithUnderscores);
if ($flushDoctrineProxyCache === false && preg_match('/_Domain_Model_(.+)/', $classNameWithUnderscores) === 1) {
$flushDoctrineProxyCache = true;
}
diff --git a/Neos.Flow/Classes/Command/CacheCommandController.php b/Neos.Flow/Classes/Command/CacheCommandController.php
index 9999ac98d5..2f79738aa2 100644
--- a/Neos.Flow/Classes/Command/CacheCommandController.php
+++ b/Neos.Flow/Classes/Command/CacheCommandController.php
@@ -134,9 +134,6 @@ public function injectEnvironment(Environment $environment)
* from running, the removal of any temporary data can be forced by specifying
* the option --force.
*
- * This command does not remove the precompiled data provided by frozen
- * packages unless the --force option is used.
- *
* @param boolean $force Force flushing of any temporary data
* @return void
* @see neos.flow:cache:warmup
@@ -156,23 +153,6 @@ public function flushCommand(bool $force = false)
$this->lockManager->unlockSite();
}
- $frozenPackages = [];
- foreach (array_keys($this->packageManager->getAvailablePackages()) as $packageKey) {
- if ($this->packageManager->isPackageFrozen($packageKey)) {
- $frozenPackages[] = $packageKey;
- }
- }
- if ($frozenPackages !== []) {
- $this->outputFormatted(PHP_EOL . 'Please note that the following package' . (count($frozenPackages) === 1 ? ' is' : 's are') . ' currently frozen: ' . PHP_EOL);
- $this->outputFormatted(implode(PHP_EOL, $frozenPackages) . PHP_EOL, [], 2);
-
- $message = 'As code and configuration changes in these packages are not detected, the application may respond ';
- $message .= 'unexpectedly if modifications were done anyway or the remaining code relies on these changes.' . PHP_EOL . PHP_EOL;
- $message .= 'You may call package:refreeze all in order to refresh frozen packages or use the --force ';
- $message .= 'option of this cache:flush command to flush caches if Flow becomes unresponsive.' . PHP_EOL;
- $this->outputFormatted($message, [$frozenPackages]);
- }
-
$this->sendAndExit(0);
}
diff --git a/Neos.Flow/Classes/Command/PackageCommandController.php b/Neos.Flow/Classes/Command/PackageCommandController.php
index 25e6616f5a..79649b5d0c 100644
--- a/Neos.Flow/Classes/Command/PackageCommandController.php
+++ b/Neos.Flow/Classes/Command/PackageCommandController.php
@@ -14,8 +14,6 @@
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Cli\CommandController;
use Neos\Flow\Composer\ComposerUtility;
-use Neos\Flow\Core\Booting\Scripts;
-use Neos\Flow\Core\Bootstrap;
use Neos\Flow\Package\PackageInterface;
use Neos\Flow\Package\PackageKeyAwareInterface;
use Neos\Flow\Package\PackageManager;
@@ -32,25 +30,6 @@ class PackageCommandController extends CommandController
*/
protected $packageManager;
- /**
- * @var array
- */
- protected $settings;
-
- /**
- * @var Bootstrap
- */
- protected $bootstrap;
-
- /**
- * @param array $settings The Flow settings
- * @return void
- */
- public function injectSettings(array $settings)
- {
- $this->settings = $settings;
- }
-
/**
* @param PackageManager $packageManager
* @return void
@@ -60,15 +39,6 @@ public function injectPackageManager(PackageManager $packageManager)
$this->packageManager = $packageManager;
}
- /**
- * @param Bootstrap $bootstrap
- * @return void
- */
- public function injectBootstrap(Bootstrap $bootstrap)
- {
- $this->bootstrap = $bootstrap;
- }
-
/**
* Create a new package
*
@@ -112,9 +82,7 @@ public function createCommand(string $packageKey, string $packageType = PackageI
public function listCommand(bool $loadingOrder = false)
{
$availablePackages = [];
- $frozenPackages = [];
$longestPackageKey = 0;
- $freezeSupported = $this->bootstrap->getContext()->isDevelopment();
foreach ($this->packageManager->getAvailablePackages() as $packageKey => $package) {
if (strlen($packageKey) > $longestPackageKey) {
@@ -122,10 +90,6 @@ public function listCommand(bool $loadingOrder = false)
}
$availablePackages[$packageKey] = $package;
-
- if ($this->packageManager->isPackageFrozen($packageKey)) {
- $frozenPackages[$packageKey] = $package;
- }
}
if ($loadingOrder === false) {
@@ -135,13 +99,7 @@ public function listCommand(bool $loadingOrder = false)
$this->outputLine('PACKAGES:');
/** @var PackageInterface|PackageKeyAwareInterface $package */
foreach ($availablePackages as $package) {
- $frozenState = ($freezeSupported && isset($frozenPackages[$package->getPackageKey()]) ? '* ' : ' ');
- $this->outputLine(' ' . str_pad($package->getPackageKey(), $longestPackageKey + 3) . $frozenState . str_pad($package->getInstalledVersion(), 15));
- }
-
- if (count($frozenPackages) > 0 && $freezeSupported) {
- $this->outputLine();
- $this->outputLine(' * frozen package');
+ $this->outputLine(' ' . str_pad($package->getPackageKey(), $longestPackageKey + 3) . str_pad($package->getInstalledVersion(), 15));
}
}
@@ -165,47 +123,11 @@ public function listCommand(bool $loadingOrder = false)
* @return void
* @see neos.flow:package:unfreeze
* @see neos.flow:package:refreeze
+ * @deprecated since 8.4
*/
public function freezeCommand(string $packageKey = 'all')
{
- if (!$this->bootstrap->getContext()->isDevelopment()) {
- $this->outputLine('Package freezing is only supported in Development context.');
- $this->quit(3);
- }
-
- $packagesToFreeze = [];
-
- if ($packageKey === 'all') {
- foreach (array_keys($this->packageManager->getAvailablePackages()) as $packageKey) {
- if (!$this->packageManager->isPackageFrozen($packageKey)) {
- $packagesToFreeze[] = $packageKey;
- }
- }
- if ($packagesToFreeze === []) {
- $this->outputLine('Nothing to do, all packages were already frozen.');
- $this->quit(0);
- }
- } elseif ($packageKey === 'blackberry') {
- $this->outputLine('http://bit.ly/freeze-blackberry');
- $this->quit(42);
- } else {
- if (!$this->packageManager->isPackageAvailable($packageKey)) {
- $this->outputLine('Package "%s" is not available.', [$packageKey]);
- $this->quit(2);
- }
-
- if ($this->packageManager->isPackageFrozen($packageKey)) {
- $this->outputLine('Package "%s" was already frozen.', [$packageKey]);
- $this->quit(0);
- }
-
- $packagesToFreeze = [$packageKey];
- }
-
- foreach ($packagesToFreeze as $packageKey) {
- $this->packageManager->freezePackage($packageKey);
- $this->outputLine('Froze package "%s".', [$packageKey]);
- }
+ $this->outputLine('Package freezing is no longer supported, this command is deprecated and will be removed with 9.0.');
}
/**
@@ -222,47 +144,11 @@ public function freezeCommand(string $packageKey = 'all')
* @return void
* @see neos.flow:package:freeze
* @see neos.flow:cache:flush
+ * @deprecated since 8.4
*/
public function unfreezeCommand(string $packageKey = 'all')
{
- if (!$this->bootstrap->getContext()->isDevelopment()) {
- $this->outputLine('Package freezing is only supported in Development context.');
- $this->quit(3);
- }
-
- $packagesToUnfreeze = [];
-
- if ($packageKey === 'all') {
- foreach (array_keys($this->packageManager->getAvailablePackages()) as $packageKey) {
- if ($this->packageManager->isPackageFrozen($packageKey)) {
- $packagesToUnfreeze[] = $packageKey;
- }
- }
- if ($packagesToUnfreeze === []) {
- $this->outputLine('Nothing to do, no packages were frozen.');
- $this->quit(0);
- }
- } else {
- if ($packageKey === null) {
- $this->outputLine('You must specify a package to unfreeze.');
- $this->quit(1);
- }
-
- if (!$this->packageManager->isPackageAvailable($packageKey)) {
- $this->outputLine('Package "%s" is not available.', [$packageKey]);
- $this->quit(2);
- }
- if (!$this->packageManager->isPackageFrozen($packageKey)) {
- $this->outputLine('Package "%s" was not frozen.', [$packageKey]);
- $this->quit(0);
- }
- $packagesToUnfreeze = [$packageKey];
- }
-
- foreach ($packagesToUnfreeze as $packageKey) {
- $this->packageManager->unfreezePackage($packageKey);
- $this->outputLine('Unfroze package "%s".', [$packageKey]);
- }
+ $this->outputLine('Package freezing is no longer supported, this command is deprecated and will be removed with 9.0.');
}
/**
@@ -280,50 +166,11 @@ public function unfreezeCommand(string $packageKey = 'all')
* @return void
* @see neos.flow:package:freeze
* @see neos.flow:cache:flush
+ * @deprecated since 8.4
*/
public function refreezeCommand(string $packageKey = 'all')
{
- if (!$this->bootstrap->getContext()->isDevelopment()) {
- $this->outputLine('Package freezing is only supported in Development context.');
- $this->quit(3);
- }
-
- $packagesToRefreeze = [];
-
- if ($packageKey === 'all') {
- foreach (array_keys($this->packageManager->getAvailablePackages()) as $packageKey) {
- if ($this->packageManager->isPackageFrozen($packageKey)) {
- $packagesToRefreeze[] = $packageKey;
- }
- }
- if ($packagesToRefreeze === []) {
- $this->outputLine('Nothing to do, no packages were frozen.');
- $this->quit(0);
- }
- } else {
- if ($packageKey === null) {
- $this->outputLine('You must specify a package to refreeze.');
- $this->quit(1);
- }
-
- if (!$this->packageManager->isPackageAvailable($packageKey)) {
- $this->outputLine('Package "%s" is not available.', [$packageKey]);
- $this->quit(2);
- }
- if (!$this->packageManager->isPackageFrozen($packageKey)) {
- $this->outputLine('Package "%s" was not frozen.', [$packageKey]);
- $this->quit(0);
- }
- $packagesToRefreeze = [$packageKey];
- }
-
- foreach ($packagesToRefreeze as $packageKey) {
- $this->packageManager->refreezePackage($packageKey);
- $this->outputLine('Refroze package "%s".', [$packageKey]);
- }
-
- Scripts::executeCommand('neos.flow:cache:flush', $this->settings, false);
- $this->sendAndExit(0);
+ $this->outputLine('Package freezing is no longer supported, this command is deprecated and will be removed with 9.0.');
}
/**
diff --git a/Neos.Flow/Classes/Core/Booting/Scripts.php b/Neos.Flow/Classes/Core/Booting/Scripts.php
index 7614aedf75..74edfed2e0 100644
--- a/Neos.Flow/Classes/Core/Booting/Scripts.php
+++ b/Neos.Flow/Classes/Core/Booting/Scripts.php
@@ -247,7 +247,7 @@ public static function initializeSystemLogger(Bootstrap $bootstrap): void
$throwableStorage = self::initializeExceptionStorage($bootstrap, $settings);
$bootstrap->setEarlyInstance(ThrowableStorageInterface::class, $throwableStorage);
- /** @var PsrLoggerFactoryInterface $psrLoggerFactoryName */
+ /** @var class-string $psrLoggerFactoryName */
$psrLoggerFactoryName = $settings['log']['psr3']['loggerFactory'];
$psrLogConfigurations = $settings['log']['psr3'][$psrLoggerFactoryName] ?? [];
$psrLogFactory = $psrLoggerFactoryName::create($psrLogConfigurations);
@@ -578,10 +578,6 @@ public static function initializeSystemFileMonitor(Bootstrap $bootstrap)
/** @var FlowPackageInterface $package */
foreach ($packageManager->getFlowPackages() as $packageKey => $package) {
- if ($packageManager->isPackageFrozen($packageKey)) {
- continue;
- }
-
self::monitorDirectoryIfItExists($fileMonitors['Flow_ConfigurationFiles'], $package->getConfigurationPath(), '\.y(a)?ml$');
self::monitorDirectoryIfItExists($fileMonitors['Flow_TranslationFiles'], $package->getResourcesPath() . 'Private/Translations/', '\.xlf');
diff --git a/Neos.Flow/Classes/Package.php b/Neos.Flow/Classes/Package.php
index 7aedd92240..f6ad59cbfb 100644
--- a/Neos.Flow/Classes/Package.php
+++ b/Neos.Flow/Classes/Package.php
@@ -21,6 +21,7 @@
use Neos\Flow\ObjectManagement\Proxy;
use Neos\Flow\Package\Package as BasePackage;
use Neos\Flow\Package\PackageManager;
+use Neos\Flow\Reflection\ReflectionService;
use Neos\Flow\ResourceManagement\ResourceManager;
use Neos\Flow\ResourceManagement\ResourceRepository;
use Neos\Flow\Security\Authentication\AuthenticationProviderManager;
@@ -105,10 +106,6 @@ public function boot(Core\Bootstrap $bootstrap)
/** @var PackageManager $packageManager */
$packageManager = $bootstrap->getEarlyInstance(Package\PackageManager::class);
foreach ($packageManager->getFlowPackages() as $packageKey => $package) {
- if ($packageManager->isPackageFrozen($packageKey)) {
- continue;
- }
-
$publicResourcesPath = $package->getResourcesPath() . 'Public/';
if (is_dir($publicResourcesPath)) {
$publicResourcesFileMonitor->monitorDirectory($publicResourcesPath);
@@ -139,6 +136,7 @@ public function boot(Core\Bootstrap $bootstrap)
$dispatcher->connect(Core\Bootstrap::class, 'bootstrapShuttingDown', ObjectManagement\ObjectManagerInterface::class, 'shutdown');
$dispatcher->connect(Core\Bootstrap::class, 'bootstrapShuttingDown', Configuration\ConfigurationManager::class, 'shutdown');
+ /** @see ReflectionService::saveToCache() */
$dispatcher->connect(Core\Bootstrap::class, 'bootstrapShuttingDown', Reflection\ReflectionService::class, 'saveToCache');
$dispatcher->connect(Command\CoreCommandController::class, 'finishedCompilationRun', Security\Authorization\Privilege\Method\MethodPrivilegePointcutFilter::class, 'savePolicyCache');
diff --git a/Neos.Flow/Classes/Package/PackageManager.php b/Neos.Flow/Classes/Package/PackageManager.php
index 41d6f2ce7d..8b0e8e9432 100644
--- a/Neos.Flow/Classes/Package/PackageManager.php
+++ b/Neos.Flow/Classes/Package/PackageManager.php
@@ -15,7 +15,6 @@
use Neos\Flow\Composer\Exception\InvalidConfigurationException;
use Neos\Flow\Composer\ComposerUtility;
use Neos\Flow\Core\Bootstrap;
-use Neos\Flow\Reflection\ReflectionService;
use Neos\Flow\SignalSlot\Dispatcher;
use Neos\Flow\SignalSlot\Exception\InvalidSlotException;
use Neos\Utility\Exception\FilesException;
@@ -229,22 +228,11 @@ public function getAvailablePackages(): array
* precompiled reflection data in order to improve performance.
*
* @return array
+ * @deprecated since 8.4
*/
public function getFrozenPackages(): array
{
- $frozenPackages = [];
- if ($this->bootstrap->getContext()->isDevelopment()) {
- /** @var PackageInterface $package */
- foreach ($this->packages as $packageKey => $package) {
- if (isset($this->packageStatesConfiguration['packages'][$package->getComposerName()]['frozen']) &&
- $this->packageStatesConfiguration['packages'][$package->getComposerName()]['frozen'] === true
- ) {
- $frozenPackages[$packageKey] = $package;
- }
- }
- }
-
- return $frozenPackages;
+ return [];
}
/**
@@ -401,6 +389,7 @@ public function createPackage($packageKey, array $manifest = [], $packagesPath =
* @param string $toAbsolutePath
* @return void
* @throws FilesException
+ * @deprecated since 8.4
*/
protected function movePackage($fromAbsolutePath, $toAbsolutePath): void
{
@@ -409,95 +398,16 @@ protected function movePackage($fromAbsolutePath, $toAbsolutePath): void
Files::removeDirectoryRecursively($fromAbsolutePath);
}
- /**
- * Freezes a package
- *
- * @param string $packageKey The package to freeze
- * @return void
- * @throws Exception\PackageStatesFileNotWritableException
- * @throws Exception\UnknownPackageException
- * @throws \Neos\Flow\Exception
- * @throws FilesException
- */
- public function freezePackage($packageKey): void
- {
- if (!$this->bootstrap->getContext()->isDevelopment()) {
- throw new \LogicException('Package freezing is only supported in Development context.', 1338810870);
- }
-
- if (!$this->isPackageAvailable($packageKey)) {
- throw new Exception\UnknownPackageException('Package "' . $packageKey . '" is not available.', 1331715956);
- }
- if ($this->isPackageFrozen($packageKey)) {
- return;
- }
-
- $package = $this->packages[$packageKey];
- $this->bootstrap->getObjectManager()->get(ReflectionService::class)->freezePackageReflection($packageKey);
-
- $this->packageStatesConfiguration['packages'][$package->getComposerName()]['frozen'] = true;
- $this->savePackageStates($this->packageStatesConfiguration);
- }
-
/**
* Tells if a package is frozen
*
* @param string $packageKey The package to check
* @return boolean
+ * @deprecated since 8.4
*/
public function isPackageFrozen($packageKey): bool
{
- if (!isset($this->packages[$packageKey])) {
- return false;
- }
- $composerName = $this->packages[$packageKey]->getComposerName();
-
- return (
- $this->bootstrap->getContext()->isDevelopment()
- && isset($this->packageStatesConfiguration['packages'][$composerName]['frozen'])
- && $this->packageStatesConfiguration['packages'][$composerName]['frozen'] === true
- );
- }
-
- /**
- * Unfreezes a package
- *
- * @param string $packageKey The package to unfreeze
- * @return void
- * @throws Exception\PackageStatesFileNotWritableException
- * @throws \Neos\Flow\Exception
- * @throws FilesException
- */
- public function unfreezePackage($packageKey): void
- {
- if (!$this->isPackageFrozen($packageKey)) {
- return;
- }
- if (!isset($this->packages[$packageKey])) {
- return;
- }
- $composerName = $this->packages[$packageKey]->getComposerName();
-
- $this->bootstrap->getObjectManager()->get(ReflectionService::class)->unfreezePackageReflection($packageKey);
-
- unset($this->packageStatesConfiguration['packages'][$composerName]['frozen']);
- $this->savePackageStates($this->packageStatesConfiguration);
- }
-
- /**
- * Refreezes a package
- *
- * @param string $packageKey The package to refreeze
- * @return void
- * @throws \Neos\Flow\Exception
- */
- public function refreezePackage($packageKey): void
- {
- if (!$this->isPackageFrozen($packageKey)) {
- return;
- }
-
- $this->bootstrap->getObjectManager()->get(ReflectionService::class)->unfreezePackageReflection($packageKey);
+ return false;
}
/**
diff --git a/Neos.Flow/Classes/Reflection/ReflectionService.php b/Neos.Flow/Classes/Reflection/ReflectionService.php
index 835f4a2414..4f5707daf2 100644
--- a/Neos.Flow/Classes/Reflection/ReflectionService.php
+++ b/Neos.Flow/Classes/Reflection/ReflectionService.php
@@ -19,10 +19,8 @@
use Doctrine\Persistence\Proxy as DoctrineProxy;
use Neos\Cache\Backend\FreezableBackendInterface;
use Neos\Cache\Exception;
-use Neos\Cache\Frontend\StringFrontend;
use Neos\Cache\Frontend\VariableFrontend;
use Neos\Flow\Annotations as Flow;
-use Neos\Flow\Core\ApplicationContext;
use Neos\Flow\Log\Utility\LogEnvironment;
use Neos\Flow\ObjectManagement\Proxy\ProxyInterface;
use Neos\Flow\Package\PackageManager;
@@ -32,14 +30,9 @@
use Neos\Flow\Reflection\Exception\InvalidClassException;
use Neos\Flow\Reflection\Exception\InvalidPropertyTypeException;
use Neos\Flow\Reflection\Exception\InvalidValueObjectException;
-use Neos\Flow\Utility\Environment;
-use Neos\Utility\Arrays;
-use Neos\Utility\Exception\FilesException;
-use Neos\Utility\Files;
use Neos\Utility\TypeHandling;
use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel;
-use ReflectionException;
/**
* A service for acquiring reflection based information in a performant way. This
@@ -74,15 +67,9 @@ class ReflectionService
// Implementations of an interface
protected const DATA_INTERFACE_IMPLEMENTATIONS = 1;
- // Implemented interfaces of a class
- protected const DATA_CLASS_INTERFACES = 2;
-
// Subclasses of a class
protected const DATA_CLASS_SUBCLASSES = 3;
- // Class tag values
- protected const DATA_CLASS_TAGS_VALUES = 4;
-
// Class annotations
protected const DATA_CLASS_ANNOTATIONS = 5;
protected const DATA_CLASS_ABSTRACT = 6;
@@ -113,14 +100,9 @@ class ReflectionService
protected Reader $annotationReader;
protected array $availableClassNames = [];
- protected StringFrontend $statusCache;
- protected VariableFrontend $reflectionDataCompiletimeCache;
protected VariableFrontend $reflectionDataRuntimeCache;
protected VariableFrontend $classSchemataRuntimeCache;
protected ?LoggerInterface $logger = null;
- protected PackageManager $packageManager;
- protected Environment $environment;
- protected ApplicationContext $context;
/**
* The doctrine PHP parser which can parse "use" statements. Is initialized
@@ -135,11 +117,6 @@ class ReflectionService
*/
protected array $useStatementsForClassCache;
- /**
- * In Production context, with frozen caches, this flag will be true
- */
- protected bool $loadFromClassSchemaRuntimeCache = false;
-
protected array $settings = [];
/**
@@ -181,24 +158,6 @@ class ReflectionService
*/
protected array $methodAnnotationsRuntimeCache = [];
- /**
- * Sets the status cache
- *
- * The cache must be set before initializing the Reflection Service
- */
- public function setStatusCache(StringFrontend $cache): void
- {
- $this->statusCache = $cache;
- $backend = $this->statusCache->getBackend();
- if (is_callable([$backend, 'initializeObject'])) {
- $backend->initializeObject();
- }
- }
-
- public function setReflectionDataCompiletimeCache(VariableFrontend $cache): void
- {
- $this->reflectionDataCompiletimeCache = $cache;
- }
public function setReflectionDataRuntimeCache(VariableFrontend $cache): void
{
@@ -220,16 +179,6 @@ public function injectLogger(LoggerInterface $logger): void
$this->logger = $logger;
}
- public function injectPackageManager(PackageManager $packageManager): void
- {
- $this->packageManager = $packageManager;
- }
-
- public function injectEnvironment(Environment $environment): void
- {
- $this->environment = $environment;
- }
-
protected function getDoctrinePhpParser(): PhpParser
{
if ($this->doctrinePhpParser === null) {
@@ -243,20 +192,14 @@ protected function getDoctrinePhpParser(): PhpParser
* Initialize the reflection service lazily
*
* This method must be run only after all dependencies have been injected.
- *
- * @throws FilesException
- * @throws \Neos\Flow\Utility\Exception
*/
protected function initialize(): void
{
- $this->context = $this->environment->getContext();
-
- if ($this->hasFrozenCacheInProduction()) {
- $this->classReflectionData = $this->reflectionDataRuntimeCache->get('__classNames');
+ $classNames = $this->reflectionDataRuntimeCache->get('__classNames');
+ if (is_array($classNames)) {
+ $this->classReflectionData = $classNames;
$this->annotatedClasses = $this->reflectionDataRuntimeCache->get('__annotatedClasses');
- $this->loadFromClassSchemaRuntimeCache = true;
- } else {
- $this->loadClassReflectionCompiletimeCache();
+ $this->classesByMethodAnnotations = $this->reflectionDataRuntimeCache->get('__classesByMethodAnnotations');
}
$this->annotationReader = new AnnotationReader();
@@ -275,13 +218,14 @@ protected function initialize(): void
* This method is called by the Compile Time Object Manager which also determines
* the list of classes to consider for reflection.
*
+ * @param array $availableClassNames
* @throws ClassLoadingForReflectionFailedException
* @throws ClassSchemaConstraintViolationException
* @throws Exception
- * @throws FilesException
* @throws InvalidClassException
- * @throws ReflectionException
- * @throws \Neos\Flow\Utility\Exception
+ * @throws InvalidPropertyTypeException
+ * @throws InvalidValueObjectException
+ * @throws \ReflectionException
*/
public function buildReflectionData(array $availableClassNames): void
{
@@ -297,6 +241,8 @@ public function buildReflectionData(array $availableClassNames): void
* Tells if the specified class is known to this reflection service and
* reflection information is available.
*
+ * @param class-string $className
+ *
* @api
*/
public function isClassReflected(string $className): bool
@@ -306,7 +252,7 @@ public function isClassReflected(string $className): bool
}
$className = $this->cleanClassName($className);
- return isset($this->classReflectionData[$className]);
+ return isset($this->classReflectionData[$className]) && is_array($this->classReflectionData[$className]);
}
/**
@@ -328,19 +274,19 @@ public function getAllClassNames(): array
* interface name. If no class implementing the interface was found or more than one
* implementation was found in the package defining the interface, false is returned.
*
+ * @param class-string $interfaceName
+ * @return string|bool
+ * @throws ClassLoadingForReflectionFailedException
+ * @throws InvalidClassException
+ * @throws \ReflectionException
* @api
*/
public function getDefaultImplementationClassNameForInterface(string $interfaceName): string|bool
{
- if (!$this->initialized) {
- $this->initialize();
- }
- $interfaceName = $this->cleanClassName($interfaceName);
-
if (interface_exists($interfaceName) === false) {
throw new \InvalidArgumentException('"' . $interfaceName . '" does not exist or is not the name of an interface.', 1238769559);
}
- $this->loadOrReflectClassIfNecessary($interfaceName);
+ $interfaceName = $this->prepareClassReflectionForUsage($interfaceName);
$classNamesFound = isset($this->classReflectionData[$interfaceName][self::DATA_INTERFACE_IMPLEMENTATIONS]) ? array_keys($this->classReflectionData[$interfaceName][self::DATA_INTERFACE_IMPLEMENTATIONS]) : [];
if (count($classNamesFound) === 1) {
@@ -369,19 +315,15 @@ public function getDefaultImplementationClassNameForInterface(string $interfaceN
* @return list>
* @throws ClassLoadingForReflectionFailedException
* @throws InvalidClassException
+ * @throws \ReflectionException
* @api
*/
public function getAllImplementationClassNamesForInterface(string $interfaceName): array
{
- if (!$this->initialized) {
- $this->initialize();
- }
- $interfaceName = $this->cleanClassName($interfaceName);
-
if (interface_exists($interfaceName) === false) {
throw new \InvalidArgumentException('"' . $interfaceName . '" does not exist or is not the name of an interface.', 1238769560);
}
- $this->loadOrReflectClassIfNecessary($interfaceName);
+ $interfaceName = $this->prepareClassReflectionForUsage($interfaceName);
return (isset($this->classReflectionData[$interfaceName][self::DATA_INTERFACE_IMPLEMENTATIONS])) ? array_keys($this->classReflectionData[$interfaceName][self::DATA_INTERFACE_IMPLEMENTATIONS]) : [];
}
@@ -394,20 +336,15 @@ public function getAllImplementationClassNamesForInterface(string $interfaceName
* @return array
* @throws ClassLoadingForReflectionFailedException
* @throws InvalidClassException
+ * @throws \ReflectionException
* @api
*/
public function getAllSubClassNamesForClass(string $className): array
{
- if (!$this->initialized) {
- $this->initialize();
- }
- $className = $this->cleanClassName($className);
-
if (class_exists($className) === false) {
throw new \InvalidArgumentException('"' . $className . '" does not exist or is not the name of a class.', 1257168042);
}
- $this->loadOrReflectClassIfNecessary($className);
-
+ $className = $this->prepareClassReflectionForUsage($className);
return (isset($this->classReflectionData[$className][self::DATA_CLASS_SUBCLASSES])) ? array_keys($this->classReflectionData[$className][self::DATA_CLASS_SUBCLASSES]) : [];
}
@@ -445,9 +382,12 @@ public function isClassAnnotatedWith(string $className, string $annotationClassN
/**
* Returns the specified class annotations or an empty array
*
- * @param null|string $annotationClassName
+ * @param class-string $className
+ * @param null|class-string $annotationClassName
* @return array