Skip to content

Commit 25b690c

Browse files
committed
📦 Declare properties before methods. Add typing. Drop useless phpdoc tags
1 parent 90ef14c commit 25b690c

File tree

1 file changed

+11
-29
lines changed

1 file changed

+11
-29
lines changed

src/DependencyInjection/GraphQLiteCompilerPass.php

Lines changed: 11 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,14 @@
5656
*/
5757
class GraphQLiteCompilerPass implements CompilerPassInterface
5858
{
59-
/**
60-
* @var AnnotationReader|null
61-
*/
62-
private $annotationReader;
59+
private ?AnnotationReader $annotationReader = null;
60+
61+
private string $cacheDir;
62+
63+
private ?CacheInterface $cache = null;
64+
65+
private ?ClassBoundCacheContractInterface $codeCache = null;
6366

64-
/**
65-
* @var string
66-
*/
67-
private $cacheDir;
6867

6968
/**
7069
* You can modify the container here before it is dumped to PHP code.
@@ -317,9 +316,6 @@ private function registerController(string $controllerClassName, ContainerBuilde
317316

318317
/**
319318
* Register a method call on SchemaFactory for each tagged service, passing the service in parameter.
320-
*
321-
* @param string $tag
322-
* @param string $methodName
323319
*/
324320
private function mapAdderToTag(string $tag, string $methodName, ContainerBuilder $container, Definition $schemaFactory): void
325321
{
@@ -371,8 +367,6 @@ private function makePublicInjectedServices(ReflectionClass $refClass, Annotatio
371367
}
372368

373369
/**
374-
* @param ReflectionMethod $method
375-
* @param ContainerBuilder $container
376370
* @return array<string, string> key = value = service name
377371
*/
378372
private function getListOfInjectedServices(ReflectionMethod $method, ContainerBuilder $container): array
@@ -412,7 +406,6 @@ private function getListOfInjectedServices(ReflectionMethod $method, ContainerBu
412406
}
413407

414408
/**
415-
* @param ReflectionMethod $method
416409
* @return array<string, ReflectionParameter>
417410
*/
418411
private static function getParametersByName(ReflectionMethod $method): array
@@ -433,11 +426,6 @@ private function getAnnotationReader(): AnnotationReader
433426
return $this->annotationReader ??= new AnnotationReader();
434427
}
435428

436-
/**
437-
* @var CacheInterface
438-
*/
439-
private $cache;
440-
441429
private function getPsr16Cache(): CacheInterface
442430
{
443431
if ($this->cache === null) {
@@ -447,27 +435,21 @@ private function getPsr16Cache(): CacheInterface
447435
$this->cache = new Psr16Cache(new PhpFilesAdapter('graphqlite_bundle', 0, $this->cacheDir));
448436
}
449437
}
438+
450439
return $this->cache;
451440
}
452441

453-
/**
454-
* @var ClassBoundCacheContractInterface
455-
*/
456-
private $codeCache;
457-
458442
private function getCodeCache(): ClassBoundCacheContractInterface
459443
{
460-
if ($this->codeCache === null) {
461-
$this->codeCache = new ClassBoundCacheContract(new ClassBoundMemoryAdapter(new ClassBoundCache(new FileBoundCache($this->getPsr16Cache()))));
462-
}
463-
return $this->codeCache;
444+
return $this->codeCache ??= new ClassBoundCacheContract(
445+
new ClassBoundMemoryAdapter(new ClassBoundCache(new FileBoundCache($this->getPsr16Cache())))
446+
);
464447
}
465448

466449
/**
467450
* Returns the array of globbed classes.
468451
* Only instantiable classes are returned.
469452
*
470-
* @param string $namespace
471453
* @return Generator<class-string, ReflectionClass<object>, void, void>
472454
*/
473455
private function getClassList(string $namespace): Generator

0 commit comments

Comments
 (0)