Skip to content

Commit

Permalink
Fix backwards compatible namespace class aliases causing warnings whe…
Browse files Browse the repository at this point in the history
…n using with OPCache preloading
  • Loading branch information
DavidBennettUK authored and dvdoug committed Sep 24, 2024
1 parent 2634d1a commit 0baa7a2
Showing 1 changed file with 40 additions and 10 deletions.
50 changes: 40 additions & 10 deletions src/bc_namespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,44 @@
namespace PHPCoord\Point;

use function class_alias;
use function class_exists;

class_alias(Point::class, 'PHPCoord\Point');
class_alias(BritishNationalGridPoint::class, 'PHPCoord\BritishNationalGridPoint');
class_alias(CompoundPoint::class, 'PHPCoord\CompoundPoint');
class_alias(GeocentricPoint::class, 'PHPCoord\GeocentricPoint');
class_alias(GeographicPoint::class, 'PHPCoord\GeographicPoint');
class_alias(IrishGridPoint::class, 'PHPCoord\IrishGridPoint');
class_alias(IrishTransverseMercatorPoint::class, 'PHPCoord\IrishTransverseMercatorPoint');
class_alias(ProjectedPoint::class, 'PHPCoord\ProjectedPoint');
class_alias(UTMPoint::class, 'PHPCoord\UTMPoint');
class_alias(VerticalPoint::class, 'PHPCoord\VerticalPoint');
if (!class_exists('PHPCoord\Point')) {
class_alias(Point::class, 'PHPCoord\Point');
}

if (!class_exists('PHPCoord\BritishNationalGridPoint')) {
class_alias(BritishNationalGridPoint::class, 'PHPCoord\BritishNationalGridPoint');
}

if (!class_exists('PHPCoord\CompoundPoint')) {
class_alias(CompoundPoint::class, 'PHPCoord\CompoundPoint');
}

if (!class_exists('PHPCoord\GeocentricPoint')) {
class_alias(GeocentricPoint::class, 'PHPCoord\GeocentricPoint');
}

if (!class_exists('PHPCoord\GeographicPoint')) {
class_alias(GeographicPoint::class, 'PHPCoord\GeographicPoint');
}

if (!class_exists('PHPCoord\IrishGridPoint')) {
class_alias(IrishGridPoint::class, 'PHPCoord\IrishGridPoint');
}

if (!class_exists('PHPCoord\IrishTransverseMercatorPoint')) {
class_alias(IrishTransverseMercatorPoint::class, 'PHPCoord\IrishTransverseMercatorPoint');
}

if (!class_exists('PHPCoord\ProjectedPoint')) {
class_alias(ProjectedPoint::class, 'PHPCoord\ProjectedPoint');
}

if (!class_exists('PHPCoord\UTMPoint')) {
class_alias(UTMPoint::class, 'PHPCoord\UTMPoint');
}

if (!class_exists('PHPCoord\VerticalPoint')) {
class_alias(VerticalPoint::class, 'PHPCoord\VerticalPoint');
}

0 comments on commit 0baa7a2

Please sign in to comment.