From 69175a1ece38e5150276bacdaf95c1cd7dba8f7a Mon Sep 17 00:00:00 2001 From: Laurent Laville Date: Thu, 22 Feb 2024 08:47:53 +0000 Subject: [PATCH] be able to run examples whatever current directory is --- examples/01-resolving-simple-types.php | 2 +- examples/02-resolving-classes.php | 2 +- examples/03-resolving-all-elements.php | 2 +- .../04-discovering-the-context-using-class-reflection.php | 2 +- .../05-discovering-the-context-using-method-reflection.php | 2 +- examples/06-discovering-the-context-using-file-contents.php | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/01-resolving-simple-types.php b/examples/01-resolving-simple-types.php index 682b1d3..cc04577 100644 --- a/examples/01-resolving-simple-types.php +++ b/examples/01-resolving-simple-types.php @@ -2,7 +2,7 @@ use phpDocumentor\Reflection\TypeResolver; -require '../vendor/autoload.php'; +require __DIR__ . '/../vendor/autoload.php'; $typeResolver = new TypeResolver(); diff --git a/examples/02-resolving-classes.php b/examples/02-resolving-classes.php index 70aa5e4..8f2f59c 100644 --- a/examples/02-resolving-classes.php +++ b/examples/02-resolving-classes.php @@ -3,7 +3,7 @@ use phpDocumentor\Reflection\Types\Context; use phpDocumentor\Reflection\TypeResolver; -require '../vendor/autoload.php'; +require __DIR__ . '/../vendor/autoload.php'; $typeResolver = new TypeResolver(); diff --git a/examples/03-resolving-all-elements.php b/examples/03-resolving-all-elements.php index 4f4282e..d2a1e28 100644 --- a/examples/03-resolving-all-elements.php +++ b/examples/03-resolving-all-elements.php @@ -3,7 +3,7 @@ use phpDocumentor\Reflection\Types\Context; use phpDocumentor\Reflection\FqsenResolver; -require '../vendor/autoload.php'; +require __DIR__ . '/../vendor/autoload.php'; $fqsenResolver = new FqsenResolver(); diff --git a/examples/04-discovering-the-context-using-class-reflection.php b/examples/04-discovering-the-context-using-class-reflection.php index 957c97d..2bc952e 100644 --- a/examples/04-discovering-the-context-using-class-reflection.php +++ b/examples/04-discovering-the-context-using-class-reflection.php @@ -4,7 +4,7 @@ use phpDocumentor\Reflection\TypeResolver; use phpDocumentor\Reflection\Types\ContextFactory; -require '../vendor/autoload.php'; +require __DIR__ . '/../vendor/autoload.php'; require 'Classy.php'; $typeResolver = new TypeResolver(); diff --git a/examples/05-discovering-the-context-using-method-reflection.php b/examples/05-discovering-the-context-using-method-reflection.php index 10c0c88..e8a8db9 100644 --- a/examples/05-discovering-the-context-using-method-reflection.php +++ b/examples/05-discovering-the-context-using-method-reflection.php @@ -4,7 +4,7 @@ use phpDocumentor\Reflection\TypeResolver; use phpDocumentor\Reflection\Types\ContextFactory; -require '../vendor/autoload.php'; +require __DIR__ . '/../vendor/autoload.php'; require 'Classy.php'; $typeResolver = new TypeResolver(); diff --git a/examples/06-discovering-the-context-using-file-contents.php b/examples/06-discovering-the-context-using-file-contents.php index a93728c..3bfbdd7 100644 --- a/examples/06-discovering-the-context-using-file-contents.php +++ b/examples/06-discovering-the-context-using-file-contents.php @@ -4,13 +4,13 @@ use phpDocumentor\Reflection\TypeResolver; use phpDocumentor\Reflection\Types\ContextFactory; -require '../vendor/autoload.php'; +require __DIR__ . '/../vendor/autoload.php'; $typeResolver = new TypeResolver(); $fqsenResolver = new FqsenResolver(); $contextFactory = new ContextFactory(); -$context = $contextFactory->createForNamespace('My\Example', file_get_contents('Classy.php')); +$context = $contextFactory->createForNamespace('My\Example', file_get_contents(__DIR__ . '/Classy.php')); // Class named: \phpDocumentor\Reflection\Types\Resolver var_dump((string)$typeResolver->resolve('Types\Resolver', $context));