-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/5.0.1' into v5
- Loading branch information
Showing
5 changed files
with
91 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
# Template Comments Changelog | ||
|
||
## 5.0.1 - 2024.08.06 | ||
### Fixed | ||
* Fixed an issue where Template Comments would cause the Craft Closure `^1.0.6` package to not work | ||
|
||
## 5.0.0 - 2024.04.18 | ||
### Added | ||
* Stable release for Craft CMS 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
/** | ||
* Template Comments plugin for Craft CMS | ||
* | ||
* Adds a HTML comment to demarcate each Twig template that is included or extended. | ||
* | ||
* @link https://nystudio107.com/ | ||
* @copyright Copyright (c) nystudio107 | ||
*/ | ||
|
||
namespace nystudio107\templatecomments\helpers; | ||
|
||
use ReflectionException; | ||
use ReflectionObject; | ||
use ReflectionProperty; | ||
|
||
/** | ||
* @author nystudio107 | ||
* @package TemplateComments | ||
* @since 4.0.2 | ||
*/ | ||
class Reflection | ||
{ | ||
// Public static Methods | ||
// ========================================================================= | ||
/** | ||
* @param object $object | ||
* @param string $propertyName | ||
* | ||
* @return ReflectionProperty | ||
* @throws ReflectionException | ||
*/ | ||
public static function getReflectionProperty(object $object, string $propertyName): ReflectionProperty | ||
{ | ||
$reflectionObject = new ReflectionObject($object); | ||
|
||
$reflectionProperty = null; | ||
|
||
if ($reflectionObject->hasProperty($propertyName)) { | ||
$reflectionProperty = $reflectionObject->getProperty($propertyName); | ||
} else { | ||
|
||
// This is needed for private parent properties only. | ||
$parent = $reflectionObject->getParentClass(); | ||
while ($reflectionProperty === null && $parent !== false) { | ||
if ($parent->hasProperty($propertyName)) { | ||
$reflectionProperty = $parent->getProperty($propertyName); | ||
} | ||
|
||
$parent = $parent->getParentClass(); | ||
} | ||
} | ||
|
||
if (!$reflectionProperty) { | ||
throw new ReflectionException("Property not found: " . $propertyName); | ||
} | ||
|
||
return $reflectionProperty; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters