Skip to content
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

Fix build failures for the cake 5 upgrade #326

Merged
merged 16 commits into from
Oct 3, 2023
Merged

Conversation

BGehrels
Copy link
Contributor

@BGehrels BGehrels commented Sep 18, 2023

I tried to give speaking commit messages. The code is tested with MPDF and Cake and PHP 8.2 and it works fine.

bgehrels added 11 commits September 18, 2023 15:57
…with CakePHP 5, and fixing the PHPUnit tests afterwards
…Cake, so no need to have special logic for it
…Info() might return null on errors leading to a possible NPE. Static code analysis B does not know that $fileInfo->getPathInfo() might return null and therefore complains that the comparison is always true. Fix one of them, ignore the other
…cake\cache\cacheengineinterface" error, so let's upgrade to a more current version
@codecov
Copy link

codecov bot commented Sep 18, 2023

Codecov Report

All modified lines are covered by tests ✅

❗ No coverage uploaded for pull request base (cake5@e65d3af). Click here to learn what that means.

❗ Current head 21c3938 differs from pull request most recent head 6f83dce. Consider uploading reports for the commit 6f83dce to get more accurate results

Additional details and impacted files
@@           Coverage Diff            @@
##             cake5     #326   +/-   ##
========================================
  Coverage         ?   53.72%           
  Complexity       ?      213           
========================================
  Files            ?       10           
  Lines            ?      590           
  Branches         ?        0           
========================================
  Hits             ?      317           
  Misses           ?      273           
  Partials         ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

/**
* @inheritDoc
*/
public function getConfig(?string $key = null, mixed $default = null): mixed
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cake 5 makes the base method protected, but it's used in the unit tests. I opened it again, but i'm also open to other solutions.

Copy link
Member

Choose a reason for hiding this comment

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

The protected visibility is a mistake in the core. It will be fixed in 5.0.1.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess we'll wait for te release of 5.0.1 here, then.

Copy link
Member

Choose a reason for hiding this comment

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

This class also needs

/**
 * Mime-type this view class renders as.
 *
 * @return string Either the content type or '' which means no type.
 */
public static function contentType(): string {
	return '...;
}

It seems.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With this fragment, the testRenderErrorTemplate fails and i'm wondering, if that test actually makes sense. I think i do not know enough about Cakes Error handling to judge that.

Copy link
Member

Choose a reason for hiding this comment

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

I'll look into it.

.github/workflows/ci.yml Show resolved Hide resolved
config/bootstrap.php Outdated Show resolved Hide resolved
phpunit.xml.dist Outdated Show resolved Hide resolved
src/View/PdfView.php Outdated Show resolved Hide resolved
/**
* @inheritDoc
*/
public function getConfig(?string $key = null, mixed $default = null): mixed
Copy link
Member

Choose a reason for hiding this comment

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

The protected visibility is a mistake in the core. It will be fixed in 5.0.1.

@BGehrels
Copy link
Contributor Author

Do you have any plans to split the Get/Set methods in CakePdf in getters and setters? That way, you could use proper typing for the return types instead of mixed. A Major release might be a good opportunity to introduce such a breaking change

@ADmad
Copy link
Member

ADmad commented Sep 19, 2023

Do you have any plans to split the Get/Set methods in CakePdf in getters and setters?

I personally don't have the time to make non essential changes but I am fine with it if someone wants to submit a PR.

composer.json Outdated Show resolved Hide resolved
src/View/PdfView.php Outdated Show resolved Hide resolved
src/View/PdfView.php Show resolved Hide resolved
src/View/PdfView.php Outdated Show resolved Hide resolved
@ADmad ADmad merged commit 47e8f98 into FriendsOfCake:cake5 Oct 3, 2023
1 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants