Skip to content

Param values with PHPdoc `typeString`, attributes on properties and more reported, no "because reasons" in errors, more rules for the same call, few possible bw compat breaks

Compare
Choose a tag to compare
@spaze spaze released this 22 Dec 18:35
· 43 commits to main since this release
69935c9

New major version because some major new features in this release, and some potential backwards compatibility breaks, if you use the extension in one way or another, all described below.

New features

  • Can specify params with a doctype in typeString config option (#234)
    You can now specify dis/allowed parameter values as PHPDoc string like typeString: 'foo'|'bar' or typeString: 'array{}' etc. instead of just value: scalar
  • Support more attribute targets: properties, class constants, params (#225)
    Disallowed attributes will now be also reported when used on/with those.

Changed

  • No "because reasons", because reasons (#221) (Possible backwards compatibility break, if you ignore error messages in your config)
    Previously, if there was no message key in the disallowed configuration, "because reasons" was added automatically. I thought it was funny back when this was an internal extension only, but maybe it's not anymore. So there's no "because reasons" anymore, and the error message will always end with a full stop ., unless it already ends with one, or unless it ends with ? or !.
  • Define extension parameters as a structure (#222, #231 and a follow-up in #229 thanks to @francescolaffi) (Possible BC break, if you have a typo in your config, you may suddenly be alerted about it)
    Bye typos, at least some of them.
  • Can add more rules for the same call to have different messages for various params (#232) (Possible BC break if you for some reason relied on the order of the rules for the same function or method)
  • The allowExceptParamsInAllowed description in docs was flipped around (#235)

Internal test changes

  • Use the DI container in tests (#223, #228)
  • Merge test libs dir into src (#227)
  • Rename attribute tests and drop ClassWithAttributesAllow (#230)