Closed (won't fix)
Project:
Schema.org Metatag
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
8 Jun 2022 at 13:13 UTC
Updated:
18 Feb 2026 at 16:02 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
viniciuscosta commentedI'll work on it =)
Comment #3
viniciuscosta commentedI find the following error "Only string literals should be passed to t() where possible", I suggest changing the name of the function to don't conflict with the t() function that was introduced later.
Comment #5
jmizarela commentedI'm
reviewworking on it.Comment #6
avpadernoComment #7
jmizarela commentedHey, so this patch ended up quite big, with about 9k lines, so I did a breakdown of all the changes to make the review easier, and also a list of suggestions for maintainers at the end (I can open new issues if they are agreed upon):
_= What was done in this patch (to clean up D7 codebase):
On each schema, on schema_metatag/tests/* and schema_metatag/:
- Added function return type hinting
- Renamed test functions to follow convention
- from: SchemaMetatagSchemaNameTest to: SchemaSchemaNameMetatagTest
- on (schema_): filenames, class name and .info files list
- Replaced arrays with short array syntax (param and inside functions)
- Removed information that is added by packaging script to (schema_) .info
- Split long arrays into multi-line arrays
- Used variable $weight (in .inc _info) from the beginning instead of repeating its value
On each file of src/:
- Added function parameters and return type hinting where possible (non-union, non-mixed)
On SchemaActionTrait:
- Corrected docblock @param type of $flattened from string to bool
On SchemaMetatagTestTagInterface:
- Corrected docblock @param type of processTestExplodeValue() $delimiter from int to string
- Changed dockblocks @param type and @return type of several functions from mixed to array|string
On SchemaMetatagManagerInterface:
- Corrected dockblock @return type of explode() and unserialize() from array to array|string
- Corrected dockblock of recomputeSerializedLength() that was previously a copy-paste from is isSerialized()
-------
_= What was NOT done on this patch:
- naming of non-test classes / files (warnings for "Class name must be prefixed with the project name" still present)
- code changes/re-writes
- type hinting unsupported by PHP7 (such as mixed or union)
- new docblocks
------
_= Suggestions (to maybe open new issues after this patch is applied):
- Re-write/remove SchemaDurationBase output() method, as it uses an unexistent parent::output()
- Re-write/remove SchemaGovernmentServiceBase formKeys() method, as it uses an inexistent self::governmentServiceFormKeys()
- Re-write SchemaMetatagManager getRenderedJsonld() to stop trying to access $entity propriety as if it were an object
- OR re-write SchemaMetatagManagerInterface getRenderedJsonld() dockblock to reflect that $entity should be an object
- Re-write SchemaMetatagManager explode() and unserialize() to always return an array, add type hinting, and change back (to array) @return type hinting on the SchemaMetatagManagerInterface dockblock.
- Remove unused param $other from SchemaMetatagManager.php Random name() and string()
- update README.txt list of object types
- update required PHP version (as Drupal7 does not use PHP 5.5 anymore) to PHP 7.4
-----
Anyway, when reviewing, please make sure you have all the dependencies for schema_metatag and for metatag, and also that the 924 tests all pass.
Maintainers, please consider the suggestions =)
Cheers!
Comment #8
jmizarela commentedSeems like there were changes I didn't account for. New patch attempt.
Comment #9
jmizarela commentedOk, my bad again, I had left some ?array/?string etc type hinting that I was sure this PHP version accepted. Well, it doesn't.
I'm very sorry about the comment and hidden/deleted patches trail here, I'm still getting the hang of it.
Comment #10
jmizarela commentedComment #11
jmizarela commentedComment #12
jmizarela commentedI'll try to fix my linting and do a decent and working patch. Sorry again
Comment #13
jmizarela commentedEven after many attempts, I wasn't able to reproduce the test environment locally. I hope @viniciuscosta patch and mine may be useful stepping stones to get this fixed, but I don't think I get further here. GL.
Comment #14
thejimbirch commentedClosing this issue as Drupal 7 is no longer supported.