Skip to content

Fix namespace hardcode #148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/FontLib/Font.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static function load($file) {
}

if ($class) {
$class = "FontLib\\$class";
$class = __NAMESPACE__ . "\\$class";

/** @var TrueType\File $obj */
$obj = new $class;
Expand Down
9 changes: 1 addition & 8 deletions src/FontLib/TrueType/File.php
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does strauss automatically handle namespace references in use statements? What about the strings containing \FontLib\Table\... references around line 400 in this file?

Original file line number Diff line number Diff line change
Expand Up @@ -380,11 +380,6 @@ function parseHeader() {
$this->header->parse();
}

function getFontType(){
$class_parts = explode("\\", get_class($this));
return $class_parts[1];
}

function parseTableEntries() {
$this->parseHeader();

Expand All @@ -396,9 +391,7 @@ function parseTableEntries() {
return;
}


$type = $this->getFontType();
$class = "FontLib\\$type\\TableDirectoryEntry";
$class = __NAMESPACE__ . "\\TableDirectoryEntry";

for ($i = 0; $i < $this->header->data["numTables"]; $i++) {
/** @var TableDirectoryEntry $entry */
Expand Down