Skip to content

Commit

Permalink
PhpCodeBuilder: add reference to the compiler used to compile the map…
Browse files Browse the repository at this point in the history
…per (#18)
  • Loading branch information
JanTvrdik authored Aug 7, 2023
1 parent 84986ea commit 499b8dc
Show file tree
Hide file tree
Showing 68 changed files with 136 additions and 68 deletions.
4 changes: 3 additions & 1 deletion src/Compiler/Php/PhpCodeBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -454,13 +454,15 @@ public function mapperClass(string $shortClassName, MapperCompiler $mapperCompil
$outputType = $mapperCompiler->getOutputType();
$this->importType($outputType);

$mapperCompilerType = $this->importClass($mapperCompiler::class);

$implementsType = new GenericTypeNode(
new IdentifierTypeNode($this->importClass(Mapper::class)),
[$outputType],
);

$phpDoc = $this->phpDoc([
'Generated mapper. Do not edit directly.',
"Generated mapper by {@see $mapperCompilerType}. Do not edit directly.",
'',
"@implements {$implementsType}",
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace ShipMonkTests\InputMapper\Compiler\Mapper\Array\Data;

use ShipMonk\InputMapper\Compiler\Mapper\Array\MapArrayShape;
use ShipMonk\InputMapper\Runtime\Exception\MappingFailedException;
use ShipMonk\InputMapper\Runtime\Mapper;
use ShipMonk\InputMapper\Runtime\MapperProvider;
Expand All @@ -11,7 +12,7 @@
use function is_array;

/**
* Generated mapper. Do not edit directly.
* Generated mapper by {@see MapArrayShape}. Do not edit directly.
*
* @implements Mapper<array{}>
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

namespace ShipMonkTests\InputMapper\Compiler\Mapper\Array\Data;

use ShipMonk\InputMapper\Compiler\Mapper\Array\MapArrayShape;
use ShipMonk\InputMapper\Runtime\Exception\MappingFailedException;
use ShipMonk\InputMapper\Runtime\Mapper;
use ShipMonk\InputMapper\Runtime\MapperProvider;
use function is_array;

/**
* Generated mapper. Do not edit directly.
* Generated mapper by {@see MapArrayShape}. Do not edit directly.
*
* @implements Mapper<array{...}>
*/
Expand Down
3 changes: 2 additions & 1 deletion tests/Compiler/Mapper/Array/Data/GenericArrayMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace ShipMonkTests\InputMapper\Compiler\Mapper\Array\Data;

use ShipMonk\InputMapper\Compiler\Mapper\Array\MapArray;
use ShipMonk\InputMapper\Runtime\Exception\MappingFailedException;
use ShipMonk\InputMapper\Runtime\Mapper;
use ShipMonk\InputMapper\Runtime\MapperProvider;
Expand All @@ -10,7 +11,7 @@
use function is_string;

/**
* Generated mapper. Do not edit directly.
* Generated mapper by {@see MapArray}. Do not edit directly.
*
* @implements Mapper<array<string, int>>
*/
Expand Down
3 changes: 2 additions & 1 deletion tests/Compiler/Mapper/Array/Data/GenericListMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace ShipMonkTests\InputMapper\Compiler\Mapper\Array\Data;

use ShipMonk\InputMapper\Compiler\Mapper\Array\MapList;
use ShipMonk\InputMapper\Runtime\Exception\MappingFailedException;
use ShipMonk\InputMapper\Runtime\Mapper;
use ShipMonk\InputMapper\Runtime\MapperProvider;
Expand All @@ -10,7 +11,7 @@
use function is_int;

/**
* Generated mapper. Do not edit directly.
* Generated mapper by {@see MapList}. Do not edit directly.
*
* @implements Mapper<list<int>>
*/
Expand Down
3 changes: 2 additions & 1 deletion tests/Compiler/Mapper/Array/Data/SealedArrayShapeMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace ShipMonkTests\InputMapper\Compiler\Mapper\Array\Data;

use ShipMonk\InputMapper\Compiler\Mapper\Array\MapArrayShape;
use ShipMonk\InputMapper\Runtime\Exception\MappingFailedException;
use ShipMonk\InputMapper\Runtime\Mapper;
use ShipMonk\InputMapper\Runtime\MapperProvider;
Expand All @@ -14,7 +15,7 @@
use function is_string;

/**
* Generated mapper. Do not edit directly.
* Generated mapper by {@see MapArrayShape}. Do not edit directly.
*
* @implements Mapper<array{a: int, b?: string}>
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/Compiler/Mapper/Data/MultiplyBySevenMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use ShipMonk\InputMapper\Runtime\MapperProvider;

/**
* Generated mapper. Do not edit directly.
* Generated mapper by {@see MapMultiplyBySeven}. Do not edit directly.
*
* @implements Mapper<int>
*/
Expand Down
3 changes: 2 additions & 1 deletion tests/Compiler/Mapper/Mixed/Data/MixedMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

namespace ShipMonkTests\InputMapper\Compiler\Mapper\Mixed\Data;

use ShipMonk\InputMapper\Compiler\Mapper\Mixed\MapMixed;
use ShipMonk\InputMapper\Runtime\Exception\MappingFailedException;
use ShipMonk\InputMapper\Runtime\Mapper;
use ShipMonk\InputMapper\Runtime\MapperProvider;

/**
* Generated mapper. Do not edit directly.
* Generated mapper by {@see MapMixed}. Do not edit directly.
*
* @implements Mapper<mixed>
*/
Expand Down
3 changes: 2 additions & 1 deletion tests/Compiler/Mapper/Object/Data/DateMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
namespace ShipMonkTests\InputMapper\Compiler\Mapper\Object\Data;

use DateTimeImmutable;
use ShipMonk\InputMapper\Compiler\Mapper\Object\MapDateTimeImmutable;
use ShipMonk\InputMapper\Runtime\Exception\MappingFailedException;
use ShipMonk\InputMapper\Runtime\Mapper;
use ShipMonk\InputMapper\Runtime\MapperProvider;
use function is_string;

/**
* Generated mapper. Do not edit directly.
* Generated mapper by {@see MapDateTimeImmutable}. Do not edit directly.
*
* @implements Mapper<DateTimeImmutable>
*/
Expand Down
3 changes: 2 additions & 1 deletion tests/Compiler/Mapper/Object/Data/DateStandaloneMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
namespace ShipMonkTests\InputMapper\Compiler\Mapper\Object\Data;

use DateTimeImmutable;
use ShipMonk\InputMapper\Compiler\Mapper\Object\MapDate;
use ShipMonk\InputMapper\Runtime\Exception\MappingFailedException;
use ShipMonk\InputMapper\Runtime\Mapper;
use ShipMonk\InputMapper\Runtime\MapperProvider;
use function is_string;

/**
* Generated mapper. Do not edit directly.
* Generated mapper by {@see MapDate}. Do not edit directly.
*
* @implements Mapper<DateTimeImmutable>
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@

use DateTimeImmutable;
use DateTimeZone;
use ShipMonk\InputMapper\Compiler\Mapper\Object\MapDateTimeImmutable;
use ShipMonk\InputMapper\Runtime\Exception\MappingFailedException;
use ShipMonk\InputMapper\Runtime\Mapper;
use ShipMonk\InputMapper\Runtime\MapperProvider;
use function is_string;

/**
* Generated mapper. Do not edit directly.
* Generated mapper by {@see MapDateTimeImmutable}. Do not edit directly.
*
* @implements Mapper<DateTimeImmutable>
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
namespace ShipMonkTests\InputMapper\Compiler\Mapper\Object\Data;

use DateTimeImmutable;
use ShipMonk\InputMapper\Compiler\Mapper\Object\MapDateTimeImmutable;
use ShipMonk\InputMapper\Runtime\Exception\MappingFailedException;
use ShipMonk\InputMapper\Runtime\Mapper;
use ShipMonk\InputMapper\Runtime\MapperProvider;
use function is_string;

/**
* Generated mapper. Do not edit directly.
* Generated mapper by {@see MapDateTimeImmutable}. Do not edit directly.
*
* @implements Mapper<DateTimeImmutable>
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@

use DateTimeImmutable;
use DateTimeZone;
use ShipMonk\InputMapper\Compiler\Mapper\Object\MapDateTimeImmutable;
use ShipMonk\InputMapper\Runtime\Exception\MappingFailedException;
use ShipMonk\InputMapper\Runtime\Mapper;
use ShipMonk\InputMapper\Runtime\MapperProvider;
use function is_string;

/**
* Generated mapper. Do not edit directly.
* Generated mapper by {@see MapDateTimeImmutable}. Do not edit directly.
*
* @implements Mapper<DateTimeImmutable>
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@

use DateTimeImmutable;
use DateTimeZone;
use ShipMonk\InputMapper\Compiler\Mapper\Object\MapDateTimeImmutable;
use ShipMonk\InputMapper\Runtime\Exception\MappingFailedException;
use ShipMonk\InputMapper\Runtime\Mapper;
use ShipMonk\InputMapper\Runtime\MapperProvider;
use function is_string;

/**
* Generated mapper. Do not edit directly.
* Generated mapper by {@see MapDateTimeImmutable}. Do not edit directly.
*
* @implements Mapper<DateTimeImmutable>
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@

use DateTimeImmutable;
use DateTimeZone;
use ShipMonk\InputMapper\Compiler\Mapper\Object\MapDateTimeImmutable;
use ShipMonk\InputMapper\Runtime\Exception\MappingFailedException;
use ShipMonk\InputMapper\Runtime\Mapper;
use ShipMonk\InputMapper\Runtime\MapperProvider;
use function is_string;

/**
* Generated mapper. Do not edit directly.
* Generated mapper by {@see MapDateTimeImmutable}. Do not edit directly.
*
* @implements Mapper<DateTimeImmutable>
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@

use DateTimeImmutable;
use DateTimeZone;
use ShipMonk\InputMapper\Compiler\Mapper\Object\MapDateTimeImmutable;
use ShipMonk\InputMapper\Runtime\Exception\MappingFailedException;
use ShipMonk\InputMapper\Runtime\Mapper;
use ShipMonk\InputMapper\Runtime\MapperProvider;
use function is_string;

/**
* Generated mapper. Do not edit directly.
* Generated mapper by {@see MapDateTimeImmutable}. Do not edit directly.
*
* @implements Mapper<DateTimeImmutable>
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@

use DateTimeImmutable;
use DateTimeZone;
use ShipMonk\InputMapper\Compiler\Mapper\Object\MapDateTimeImmutable;
use ShipMonk\InputMapper\Runtime\Exception\MappingFailedException;
use ShipMonk\InputMapper\Runtime\Mapper;
use ShipMonk\InputMapper\Runtime\MapperProvider;
use function is_string;

/**
* Generated mapper. Do not edit directly.
* Generated mapper by {@see MapDateTimeImmutable}. Do not edit directly.
*
* @implements Mapper<DateTimeImmutable>
*/
Expand Down
3 changes: 2 additions & 1 deletion tests/Compiler/Mapper/Object/Data/DateWithTimeZoneMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@

use DateTimeImmutable;
use DateTimeZone;
use ShipMonk\InputMapper\Compiler\Mapper\Object\MapDateTimeImmutable;
use ShipMonk\InputMapper\Runtime\Exception\MappingFailedException;
use ShipMonk\InputMapper\Runtime\Mapper;
use ShipMonk\InputMapper\Runtime\MapperProvider;
use function is_string;

/**
* Generated mapper. Do not edit directly.
* Generated mapper by {@see MapDateTimeImmutable}. Do not edit directly.
*
* @implements Mapper<DateTimeImmutable>
*/
Expand Down
3 changes: 2 additions & 1 deletion tests/Compiler/Mapper/Object/Data/MovieMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace ShipMonkTests\InputMapper\Compiler\Mapper\Object\Data;

use ShipMonk\InputMapper\Compiler\Mapper\Object\MapObject;
use ShipMonk\InputMapper\Runtime\Exception\MappingFailedException;
use ShipMonk\InputMapper\Runtime\Mapper;
use ShipMonk\InputMapper\Runtime\MapperProvider;
Expand All @@ -16,7 +17,7 @@
use function is_string;

/**
* Generated mapper. Do not edit directly.
* Generated mapper by {@see MapObject}. Do not edit directly.
*
* @implements Mapper<MovieInput>
*/
Expand Down
3 changes: 2 additions & 1 deletion tests/Compiler/Mapper/Object/Data/PersonMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace ShipMonkTests\InputMapper\Compiler\Mapper\Object\Data;

use ShipMonk\InputMapper\Compiler\Mapper\Object\MapObject;
use ShipMonk\InputMapper\Runtime\Exception\MappingFailedException;
use ShipMonk\InputMapper\Runtime\Mapper;
use ShipMonk\InputMapper\Runtime\MapperProvider;
Expand All @@ -15,7 +16,7 @@
use function is_string;

/**
* Generated mapper. Do not edit directly.
* Generated mapper by {@see MapObject}. Do not edit directly.
*
* @implements Mapper<PersonInput>
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace ShipMonkTests\InputMapper\Compiler\Mapper\Object\Data;

use ShipMonk\InputMapper\Compiler\Mapper\Object\MapObject;
use ShipMonk\InputMapper\Runtime\Exception\MappingFailedException;
use ShipMonk\InputMapper\Runtime\Mapper;
use ShipMonk\InputMapper\Runtime\MapperProvider;
Expand All @@ -12,7 +13,7 @@
use function is_string;

/**
* Generated mapper. Do not edit directly.
* Generated mapper by {@see MapObject}. Do not edit directly.
*
* @implements Mapper<PersonInput>
*/
Expand Down
3 changes: 2 additions & 1 deletion tests/Compiler/Mapper/Object/Data/SuitEnumMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace ShipMonkTests\InputMapper\Compiler\Mapper\Object\Data;

use ShipMonk\InputMapper\Compiler\Mapper\Object\MapEnum;
use ShipMonk\InputMapper\Runtime\Exception\MappingFailedException;
use ShipMonk\InputMapper\Runtime\Mapper;
use ShipMonk\InputMapper\Runtime\MapperProvider;
Expand All @@ -10,7 +11,7 @@
use function is_string;

/**
* Generated mapper. Do not edit directly.
* Generated mapper by {@see MapEnum}. Do not edit directly.
*
* @implements Mapper<SuitEnum>
*/
Expand Down
3 changes: 2 additions & 1 deletion tests/Compiler/Mapper/Scalar/Data/BoolMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

namespace ShipMonkTests\InputMapper\Compiler\Mapper\Scalar\Data;

use ShipMonk\InputMapper\Compiler\Mapper\Scalar\MapBool;
use ShipMonk\InputMapper\Runtime\Exception\MappingFailedException;
use ShipMonk\InputMapper\Runtime\Mapper;
use ShipMonk\InputMapper\Runtime\MapperProvider;
use function is_bool;

/**
* Generated mapper. Do not edit directly.
* Generated mapper by {@see MapBool}. Do not edit directly.
*
* @implements Mapper<bool>
*/
Expand Down
3 changes: 2 additions & 1 deletion tests/Compiler/Mapper/Scalar/Data/FloatMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace ShipMonkTests\InputMapper\Compiler\Mapper\Scalar\Data;

use ShipMonk\InputMapper\Compiler\Mapper\Scalar\MapFloat;
use ShipMonk\InputMapper\Runtime\Exception\MappingFailedException;
use ShipMonk\InputMapper\Runtime\Mapper;
use ShipMonk\InputMapper\Runtime\MapperProvider;
Expand All @@ -11,7 +12,7 @@
use function is_int;

/**
* Generated mapper. Do not edit directly.
* Generated mapper by {@see MapFloat}. Do not edit directly.
*
* @implements Mapper<float>
*/
Expand Down
Loading

0 comments on commit 499b8dc

Please sign in to comment.