FrontYAML icon indicating copy to clipboard operation
FrontYAML copied to clipboard

Add type annotations

Open DivineDominion opened this issue 1 year ago • 7 comments

This PR adds type annotations esp. to the Document type so that in apps, tools have an easier time figuring out that $document->getYAML() ?? [] is valid.

At least in some cases -- I was surprised that string is also possible! So good to know, need to work around that.

  • Honestly, I'm not sure how to deal with this w.r.t. releasing new versions of the package and making sure that the minimum PHP version is installed to support these annotations :)
  • The test case function return type annotations of void were added to comply with tools to check consistency (phpstan) mostly; I don't feel strongly about adding or keeeping them out either way. Can revert that commit if you want.

DivineDominion avatar Jun 29 '24 06:06 DivineDominion

Tests are failing, we could remove support for PHP 7.4 if that helps?

mnapoli avatar Jun 30 '24 16:06 mnapoli

Ugh, of course I just ran the tests locally and didn't think of CI and older PHP's!

@mnapoli What's a sensibel schedule to drop support for older language versions in the PHP community? I can't help, I'm new :)

DivineDominion avatar Jul 01 '24 19:07 DivineDominion

7.4 is ancient, no problem at all to remove support from it. 8.0 is possible too.

mnapoli avatar Jul 02 '24 06:07 mnapoli

@mnapoli Could you rerun tests with PHP 8 to check? I tested with PHP 8.2 and 8.3

DivineDominion avatar Jul 03 '24 13:07 DivineDominion

Even though the build was canceled it seems the tests passed:

Screen-001872

mnapoli avatar Jul 04 '24 16:07 mnapoli

Yeah looks like an odd timeout?

WDYT about a php-8 branch, then I change the merge target to that? Dropping PHP 7.x support, one can probably make other changes while at it

DivineDominion avatar Jul 06 '24 06:07 DivineDominion

This wasn't a timeout, this is normal the job was cancelled because teh 7.4 job failed.

So we just need to remove 7.4. Can be in another PR or here.

mnapoli avatar Jul 06 '24 12:07 mnapoli