Commit graph

16 commits

Author SHA1 Message Date
Fomafix 9485ab50c4 Use namespaced PHP classes
Change-Id: I9f3a45c2d1ce4b7d7c5bb4bbbe382d32d47ee342
2024-06-07 09:08:55 +00:00
thiemowmde f09228b55a Pull dependency on global MediaWikiServices up one level
This pulls the dependency out of __construct() up into the static
newFromJSON() method.

I'm also replacing the "ContentLanguage" service, which is a Language
object, with the plain language code. Features from the Language
class are never needed.

Change-Id: Ic4892cd22d83ff557af37e36e62e2af14bc58a99
2024-04-08 13:27:18 +02:00
thiemowmde 8f81812242 Enable and enforce a few extra PHPCS sniffs
This is not really anything new. Most code already followed these
sniffs. This patch just fixes the remaining exceptions. Also:
* Remove PHPDoc blocks that don't add anything but just repeat the
  strict types.
* Remove @file comments in favor of class-level comments.
* Add strict types where possible, most notably some `void`.

Change-Id: Iff6872dff68170b0fc4e82ac2ba3cad385e8773e
2023-09-06 18:15:22 +02:00
Thiemo Kreuz 647cd0bc65 Clean up base class reaching into the subclass
This does not change anything. It's only about the readabilility
of the code.

Change-Id: Ia908bd90ebc261f3bebc7854501a6f5d5e736384
2023-06-09 07:10:19 +00:00
Niklas Laxström 6725472575 Fix use of formatnum in templatedata-invalid-length
PLURAL magic word expects formatted numbers, so just format them
in the code already, as is common practice.

Change-Id: I813c45f8959d9d013a6176e999622c81f7e86042
2022-01-31 09:34:57 +02:00
Reedy 166812da07 Namespace extension
Change-Id: I779e97e512ec0c4f74fb6a4b706772fb1428e40f
2021-11-25 22:53:34 +00:00
Thiemo Kreuz 3ea3de8655 Fix and update type hints
The $this->data property stores whatever json_decode() returned,
which could be anything. The validation happens later.

Change-Id: I0d04831b8253005734c1c6c97b48061be35e5d88
2021-10-02 10:50:45 +00:00
libraryupgrader a09e939fe7 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0

npm:
* postcss: 7.0.35 → 7.0.36
  * https://npmjs.com/advisories/1693 (CVE-2021-23368)
* glob-parent: 5.1.0 → 5.1.2
  * https://npmjs.com/advisories/1751 (CVE-2020-28469)
* trim-newlines: 3.0.0 → 3.0.1
  * https://npmjs.com/advisories/1753 (CVE-2021-33623)

Change-Id: I23a441a089501a97f329b7b6d37bc658481e682f
2021-07-24 02:43:18 +00:00
Thiemo Kreuz f6e1004720 Various minor JSDoc/PHPDoc documentation fixes
Change-Id: I537bf4086058a7e18c9118f7433090c4bfaf98e7
2021-07-12 11:47:55 +02:00
jenkins-bot 077cb83cc9 Merge "Add and update soft PHPDoc type hints" 2020-09-21 01:00:27 +00:00
jenkins-bot 81c7cc823e Merge "Make subclass constructors properly call each other" 2020-09-08 22:17:39 +00:00
Thiemo Kreuz a4813c26f3 Add and update soft PHPDoc type hints
In detail:
* Callers don't need to know that the return value can be a
  TemplateDataCompressedBlob. All relevant stuff is declared in
  the base class.
* It's not relevant which internal method returned the status.
  It's just the status of the object after it was constructed.
* "stdClass" is more specific. "object" includes more stuff
  which can't be returned here.
* Avoid duplication and use @inheritDoc instead.

Change-Id: I68878a5b26ecd566fbea88b513ee697b45769659
2020-09-04 06:10:24 +00:00
Thiemo Kreuz 53d6c2fcd9 Make subclass constructors properly call each other
In detail:
* Mark both as protected and make them call each other.
* Avoid duplication.
* Remove unused "null" default value.

Change-Id: I272a68bb3cc0c544ef306b16c2998458c2eb1a2d
2020-09-04 06:09:35 +00:00
Thiemo Kreuz 62c608f172 Add strict type hints in unambiguous places
Notes:
* In PHP, when a function parameter does have a strict type,
  all it does is forcefully casting the value to this type. It
  doesn't cause warnings.
* Violating a strict return type causes a warning.
* I'm intentionally not touching places where the result from
  json_decode() is passed through. In theory this could be
  anything. Let's update these later, after more refactoring
  is done.

Change-Id: I9a203356f70cf9edd434f7dc4ca130c2b7605ab4
2020-09-03 12:12:19 +02:00
Reedy 0deac36b6e Fix PSR12.Properties.ConstantVisibility.NotFound
Bug: T253169
Change-Id: I92970c67565792e8d2282e9f4c4c02a61ed30dbe
2020-05-20 01:06:40 +01:00
saper ce13175017 Do not always store template data compressed
Only MySQL can handle blobs in page_props.pp_value

Bug: T203850
Change-Id: Ie20d412d89855e451d48f7656d97fb305b1c4c55
2019-09-30 14:24:39 +02:00